import mapRoam from "./mapRoam.js"; import mapServer from "./mapServer.js"; const layerUrl = "https://cim.smartearth.cn/geoserver/JiaShanBase/ows"; const mapImg = { label: null, label2: null, label3: null, layObj2: [ { sid: "l21", url: layerUrl, layer: "JiaShanBase:RadarS", sourceType: "PolylineWfs", color: "#FF0000" }, { sid: "l22", url: layerUrl, layer: "JiaShanBase:RadarM", color: "#de3", sourceType: "PolylineWfs" }, { sid: "l23", url: layerUrl, layer: "JiaShanBase:RadarL", sourceType: "PolylineWfs", color: "#87CEFA" } ], layerObj4: { id: "132", url: layerUrl, layer: "JiaShanBase:RehersalPolygon", sourceType: "PolygonWfs", width: 1, outlineColor: "#FF0000", alpha: 0.2, height: 500, color: "#FF0000" }, init() { this.addLabel1(); }, addLabel1() { this.label = earthCtrl.factory.createLabel({ lon: 123.13255714786649, lat: 23.067683098974722, alt: 3000, text: "Nanchang", image: "https://cim.smartearth.cn/sdkdemo/master/src/static/image/ChinaFlag.png", // 文本偏移量 pixelOffset: new SmartEarth.Cesium.Cartesian2(0, 10), // 图片偏移量 iPixelOffset: new SmartEarth.Cesium.Cartesian2(0, -20), iWidth: 20, iHeight: 20 }); this.addLabel2(); }, addLabel2() { this.label2 = earthCtrl.factory.createLabel({ lon: 122.74666265573835, lat: 22.682558205364717, alt: 3000, text: "Hainan", image: "https://cim.smartearth.cn/sdkdemo/master/src/static/image/ChinaFlag.png", // 文本偏移量 pixelOffset: new SmartEarth.Cesium.Cartesian2(0, 10), // 图片偏移量 iPixelOffset: new SmartEarth.Cesium.Cartesian2(0, -20), iWidth: 20, iHeight: 20 }); this.addLabel3(); }, addLabel3() { this.label3 = earthCtrl.factory.createLabel({ lon: 123.64553245193589, lat: 23.739138102644453, alt: 3000, text: "Jiaozuo", image: "https://cim.smartearth.cn/sdkdemo/master/src/static/image/ChinaFlag.png", // 文本偏移量 pixelOffset: new SmartEarth.Cesium.Cartesian2(0, 10), // 图片偏移量 iPixelOffset: new SmartEarth.Cesium.Cartesian2(0, -20), iWidth: 20, iHeight: 20 }); mapRoam.startRoam(); }, addImageLayer() { setTimeout(() => { mapServer.addServer(this.layerObj4); }, 1000); setTimeout(() => { for (var i in this.layObj2) { mapServer.addServer(this.layObj2[i]); } }, 1500); setTimeout(() => { mapImg.init(); }, 2000); }, removeInit() { if (this.label) { this.label3.removeFromMap(); this.label2.removeFromMap(); this.label.removeFromMap(); } mapRoam.closeRoam(); mapServer.remoServer(this.layerObj4); for (var i in this.layObj2) { mapServer.remoServer(this.layObj2[i]); } } }; export default mapImg;