//脚本对象方法 function initEditorJS() { //特征点:山顶点 var workPoint1Sdd = { activate: function () { JB.showPanel("山顶点"); //视角定位 map.centerAt({ y: 36.061395, x: 113.94298, alt: 1903, heading: 0, pitch: -57.5 }); //清除所有点 workPoint1Sdd.clearPoint(); workPoint2Abd.clearPoint(); workPoint3Pdbhd.clearPoint(); workPoint4Sjd.clearPoint(); workPoint5Sjpdbhd.clearPoint(); workPoint6Qxbhd.clearPoint(); workLine1Sjx.clearLine(); workLine2Sgx.clearLine(); var arrPoint = [ [113.944168, 36.071057, 536.1], [113.939593, 36.072087, 510.42], [113.942957, 36.067383, 462.29], [113.949512, 36.07117, 460.67], ]; this.pointLayer = createArrPoint(arrPoint); //添加点 this.textLayer = createArrText(arrPoint, "山顶点"); //添加注记 }, //移除点 clearPoint: function () { if (this.pointLayer) { this.pointLayer.destroy(); delete this.pointLayer; } }, disable: function () { JB.closePanel(); if (this.textLayer) { this.textLayer.destroy(); delete this.textLayer; } }, }; //特征点:鞍部点 var workPoint2Abd = { activate: function () { JB.showPanel("鞍部点"); //视角定位 map.centerAt( { y: 36.06062, x: 113.942836, z: 1351, heading: 0, pitch: -43.5, }, { complete: () => { JB.startRotatePoint(); this.timeOut = setTimeout(() => { JB.stopRotatePoint(); }, 6000); }, } ); var arrPoint = [ [113.943496, 36.068508, 449.63], [113.941962, 36.071444, 481.09], [113.948862, 36.071282, 453.99], ]; this.pointLayer = createArrPoint(arrPoint); this.textLayer = createArrText(arrPoint, "鞍部点"); //添加注记 }, //移除点 clearPoint: function () { if (this.pointLayer) { this.pointLayer.destroy(); delete this.pointLayer; } }, disable: function () { JB.closePanel(); JB.stopRotatePoint(); if (this.timeOut) { clearTimeout(this.timeOut); delete this.timeOut; } if (this.textLayer) { this.textLayer.destroy(); delete this.textLayer; } }, }; //特征点:坡度变换点 var workPoint3Pdbhd = { activate: function () { JB.showPanel("坡度变换点"); //视角定位 map.centerAt({ y: 36.062523, x: 113.946202, z: 1343.59, heading: 353.6, pitch: -42, roll: 0 }); var arrPoint = [ [113.945927, 36.069593, 431.33], [113.94593, 36.073602, 427.86], [113.942159, 36.072318, 443.86], [113.940766, 36.0693, 389.26], ]; this.pointLayer = createArrPoint(arrPoint); this.textLayer = createArrText(arrPoint, "坡度变换点"); //添加注记 }, //移除点 clearPoint: function () { if (this.pointLayer) { this.pointLayer.destroy(); delete this.pointLayer; } }, disable: function () { JB.closePanel(); if (this.textLayer) { this.textLayer.destroy(); delete this.textLayer; } }, }; //特征点:山脚点 var workPoint4Sjd = { activate: function () { JB.showPanel("山脚点"); //视角定位 map.centerAt({ y: 36.05423, x: 113.945328, z: 1087.7, heading: 352.4, pitch: -25.4, roll: 360 }); var arrPoint = [ [113.944745, 36.063709, 350.32], [113.950068, 36.066712, 363.01], [113.936588, 36.065365, 351.94], ]; this.pointLayer = createArrPoint(arrPoint); this.textLayer = createArrText(arrPoint, "山脚点"); //添加注记 }, //移除点 clearPoint: function () { if (this.pointLayer) { this.pointLayer.destroy(); delete this.pointLayer; } }, disable: function () { JB.closePanel(); if (this.textLayer) { this.textLayer.destroy(); delete this.textLayer; } }, }; //特征点:山脚坡度变化点 var workPoint5Sjpdbhd = { activate: function () { JB.showPanel("山脚坡度变换点"); //视角定位 map.centerAt({ y: 36.055819, x: 113.950153, z: 696.74, heading: 334.4, pitch: -13.2, roll: 359.9 }); var arrPoint = [ [113.948382, 36.068049, 414.36], [113.938975, 36.06497, 395.87], [113.941956, 36.064592, 365.89], ]; this.pointLayer = createArrPoint(arrPoint); this.textLayer = createArrText(arrPoint, "山脚坡度变换点"); //添加注记 }, //移除点 clearPoint: function () { if (this.pointLayer) { this.pointLayer.destroy(); delete this.pointLayer; } }, disable: function () { JB.closePanel(); if (this.textLayer) { this.textLayer.destroy(); delete this.textLayer; } }, }; //特征点:倾斜变换点 var workPoint6Qxbhd = { activate: function () { JB.showPanel("倾斜变换点"); //视角定位 map.centerAt( { y: 36.064181, x: 113.94491, z: 1139.24, heading: 352.6, pitch: -41.2, roll: 360 }, { complete: function () { JB.startRotatePoint(); }, } ); var arrPoint = [ [113.941119, 36.070139, 415.86], [113.945836, 36.069939, 453.99], [113.942108, 36.072372, 443.98], [113.945918, 36.073087, 452.72], ]; this.pointLayer = createArrPoint(arrPoint); this.textLayer = createArrText(arrPoint, "倾斜变换点"); //添加注记 }, //移除点 clearPoint: function () { if (this.pointLayer) { this.pointLayer.destroy(); delete this.pointLayer; } }, disable: function () { JB.closePanel(); if (this.textLayer) { this.textLayer.destroy(); delete this.textLayer; } }, }; //特征线:山脊线 var workLine1Sjx = { activate: function () { JB.showPanel("山脊线"); map.centerAt({ y: 36.05982, x: 113.943515, z: 1534.08, heading: 354.6, pitch: -46.1, roll: 0, }); workPoint6Qxbhd.clearPoint(); // 以防止暂停过后继续转换视角 JB.stopRotatePoint(); //添加线 var lineArr = [ { point: [ [113.944168, 36.071057, 536.1], [113.943975, 36.070229, 497.2], [113.943899, 36.0693, 467.49], [113.943496, 36.068508, 449.63], ], }, { point: [ [113.944168, 36.071057, 536.1], [113.943383, 36.071112, 517.51], [113.94277, 36.071261, 495.99], [113.941962, 36.071444, 481.09], ], }, { point: [ [113.944168, 36.071057, 536.1], [113.945999, 36.071174, 506.33], [113.946798, 36.071624, 506.06], [113.948012, 36.071508, 485.02], [113.948862, 36.071282, 453.99], ], }, { point: [ [113.939593, 36.072087, 510.42], [113.941962, 36.071444, 481.09], ], }, { point: [ [113.942957, 36.067383, 462.29], [113.943496, 36.068508, 449.63], ], }, { point: [ [113.939593, 36.072087, 510.42], [113.93902, 36.071731, 506.14], [113.938092, 36.071371, 492.84], [113.937261, 36.07093, 493.41], [113.936637, 36.070518, 477.11], ], }, { point: [ [113.944168, 36.071057, 536.1], [113.944119, 36.07132, 538.46], [113.943971, 36.071771, 534.68], [113.944034, 36.072314, 524.35], [113.944123, 36.073456, 477.01], [113.944412, 36.074636, 432.25], ], }, { point: [ [113.939593, 36.072087, 510.42], [113.939058, 36.072637, 507.68], [113.938715, 36.073519, 506.89], [113.937723, 36.07391, 483.06], ], }, ]; this.clearLine(); this.polyLineLayer = new mars3d.layer.GraphicLayer(); map.addLayer(this.polyLineLayer); for (var i = 0; i < lineArr.length; i++) { var item = lineArr[i]; let line = new mars3d.graphic.PolylineEntity({ positions: item.point, style: { width: 5, clampToGround: true, material: mars3d.MaterialUtil.createMaterialProperty(mars3d.MaterialType.LineFlow, { color: Cesium.Color.YELLOW, speed: 3, //控制速度 url: "img/textures/lineClr.png", }), }, tooltip: "山脊线", }); this.polyLineLayer.addGraphic(line); } this.timeOut = setTimeout(() => { if (this.polyLineLayer) { this.polyLineLayer.eachGraphic((graphic) => { delete graphic.style.material; graphic.setStyle({ material: Cesium.Color.YELLOW, }); }); } }, 4000); }, clearLine: function () { if (this.polyLineLayer) { this.polyLineLayer.destroy(); delete this.polyLineLayer; } }, disable: function () { JB.closePanel(); if (this.timeOut) { clearTimeout(this.timeOut); delete this.timeOut; } if (this.polyLineLayer) { this.polyLineLayer.eachGraphic(function (graphic) { delete graphic.style.material; graphic.setStyle({ material: Cesium.Color.YELLOW, }); }); } }, }; //特征线:山谷线 var workLine2Sgx = { activate: function () { JB.showPanel("山谷线"); map.centerAt({ y: 36.05648, x: 113.944653, z: 2092, heading: 354.4, pitch: -44.6 }); //添加线 var lineArr = [ { point: [ [113.941971, 36.073964, 403.46], [113.941941, 36.073397, 414.46], [113.942012, 36.072802, 427.98], [113.94214, 36.072218, 445.57], [113.941901, 36.071582, 482.41], [113.941634, 36.071088, 468.32], [113.941371, 36.070708, 446.86], [113.941284, 36.070435, 431.69], [113.94103, 36.069954, 408.35], [113.941016, 36.06991, 406.56], [113.940603, 36.069227, 385.57], [113.939335, 36.067923, 367.22], ], }, { point: [ [113.946025, 36.074151, 403.28], [113.945954, 36.073467, 433.98], [113.945871, 36.072436, 484.02], [113.94603, 36.07161, 507.66], [113.946168, 36.071048, 501.99], [113.945904, 36.070101, 468.17], [113.945797, 36.069853, 447.03], [113.946002, 36.069094, 406.59], [113.946279, 36.067475, 378.83], ], }, ]; this.clearLine(); this.polyLineLayer = new mars3d.layer.GraphicLayer(); map.addLayer(this.polyLineLayer); for (var i = 0; i < lineArr.length; i++) { var item = lineArr[i]; let line = new mars3d.graphic.PolylineEntity({ positions: item.point, style: { width: 5, clampToGround: true, material: mars3d.MaterialUtil.createMaterialProperty(mars3d.MaterialType.LineFlow, { color: Cesium.Color.AQUA, speed: 3, //控制速度 url: "img/textures/lineClr.png", }), }, tooltip: "山谷线", }); this.polyLineLayer.addGraphic(line); } this.timeOut = setTimeout(() => { if (this.polyLineLayer) { this.polyLineLayer.eachGraphic((graphic) => { delete graphic.style.material; graphic.setStyle({ material: new Cesium.PolylineDashMaterialProperty({ color: Cesium.Color.AQUA, dashLength: 10.0, }), }); }); } }, 4000); }, clearLine: function () { if (this.polyLineLayer) { this.polyLineLayer.destroy(); delete this.polyLineLayer; } }, disable: function () { JB.closePanel(); if (this.timeOut) { clearTimeout(this.timeOut); delete this.timeOut; } if (this.polyLineLayer) { this.polyLineLayer.eachGraphic(function (graphic) { delete graphic.style.material; graphic.setStyle({ material: new Cesium.PolylineDashMaterialProperty({ color: Cesium.Color.AQUA, dashLength: 10.0, }), }); }); } }, }; //特征线:俯瞰 var workLine3Fk = { activate: function () { JB.showPanel("俯瞰"); map.centerAt({ y: 36.070613, x: 113.943032, z: 3059, heading: 356.6, pitch: -88.9 }); }, disable: function () { JB.closePanel(); }, }; //绘制过程:计算通过点 var workDgx1Point = { activate: function () { JB.showPanel(`等高线计算过程展示