suerprisePlus
2024-12-17 5dfcbd19cd041e1f8a5fb7ed9ab694bf4de00352
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
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;