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
124
125
126
127
128
129
import mapServer from "./mapServer";
import fwv from "./json/FWV2.js";
const mapInfo = {
  layer: null,
  init(res) {
    switch (res) {
      case "flyto-tool":
        this.setFlyToImageryLayer();
        break;
      case "addWeapons":
        this.setAddWeapons();
        break;
      case "EntityQueryInput":
        this.setEntityQueryInput();
        break;
    }
  },
  setFlyToImageryLayer() {
    mapServer.addServer({
      sourceType: "tms",
      url: "http://103.135.160.14:9038/gisserver/tmsserver/SubicBayArea"
    });
  },
  setAddWeapons() {
    mapServer.addServer({
      sourceType: "wfs",
      url: "https://cim.smartearth.cn/geoserver/PolygonFeature/ows",
      layer: "PolygonFeature:Weapon",
      outlineColor: "#ff0000",
      alpha: 0
    });
  },
 
  delRadarMaskScan() {
    if (this.layer) {
      this.layer.deleteObject();
      this.layer = null;
    }
  },
  createRadarMaskScan() {
    const option = {
      radius: 150000, //半径
        yaw: 300,  //雷达方向(可选)
      angle: 120, //雷达夹角(可选)
      scanAngle: 30, //扫描夹角(可选)
      speed: 5, //倍速(可选)
      maxLat: 90, //下维度(可选)
      minLat: 45, //上维度(可选)
      stackPartitions: 40, //横向网格数(可选)
      slicePartitions: 80 //纵向网格数(可选)
      //color: 'rgba(255,255,255,0.5)',  //雷达遮罩颜色(可选)
      //outlineColor: 'rgba(255,255,255,0.5)',  //雷达遮罩边框线颜色(可选)
      //scanColor: 'rgba(255,0,0,0.5)',   //扫描颜色(可选)
    };
    const position1 = [121.614202387521061, 23.990136825668284, 120];
    this.layer = earthCtrl.factory.createRadarMaskScan(
      "雷达遮罩扫描1",
      position1,
      option
    );
  },
  setEntityQueryInput() {
    // earthCtrl.camera.flyTo(120.27012029869624, 14.794107005718674, 2921.642108119077, 0, -90, 0, 2);
    // earthCtrl.camera.flyTo(120.298738742, 14.80902903, 2921.642108119077, 0, -90, 0, 2);
    earthCtrl.camera.flyTo(
      121.51795297995497,
      23.884136798593303,
      1463114.1994667982,
      0,
      -90,
      0,
      2
    );
  },
  setModelChaneColor(res) {
    const colorList = res;
    const fwvJson = fwv.features;
    const modelLayer = mapServer.listData.filter((i) => {
      if (i.type == "Tileset") return i;
    });
    console.log("modelLayer", modelLayer);
    if (modelLayer.length < 0) return;
    modelLayer[0].layer.style = new Cesium.Cesium3DTileStyle({
      color: {
        evaluateColor: (feature) => {
          const id = feature.getProperty("id");
          console.log("id", id);
          var property = fwvJson.filter((p) => {
            console.log("property", property);
            if (p.properties.enti_uuid == id) {
              return p;
            }
          });
          console.log("property", property);
          if (property.length > 0) {
            var obj = property[0].properties;
            var objColor = colorList.filter((j) => {
              if (j.name == obj.fclass_1) {
                return j;
              }
            });
 
            if (objColor.length > 0) {
              return new SmartEarth.Cesium.Color.fromCssColorString(
                objColor[0].color
              );
            }
          }
 
          // if (ids.indexOf(id) > -1) {
          //
          // }
        }
      }
    });
  },
  setFlyTo(res) {
    earthCtrl.camera.flyTo(
      res.longitude,
      res.latitude,
      res.height,
      0,
      -90,
      0,
      2
    );
  }
};
export default mapInfo;