From 6069325e1a37cf0462afda1627d4c660735dc57e Mon Sep 17 00:00:00 2001
From: suerprisePlus <15810472099@163.com>
Date: 星期二, 16 七月 2024 09:51:56 +0800
Subject: [PATCH] 版本更新

---
 src/assets/js/map/mapJsonLayer.js |  341 +++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 323 insertions(+), 18 deletions(-)

diff --git a/src/assets/js/map/mapJsonLayer.js b/src/assets/js/map/mapJsonLayer.js
index 8e3f97c..e5d3022 100644
--- a/src/assets/js/map/mapJsonLayer.js
+++ b/src/assets/js/map/mapJsonLayer.js
@@ -17,6 +17,11 @@
   url: null,
   coord: null,
   rectangularSensor: null,
+  targetList: [],
+  linePath: null,
+  richTextPoint1: null,
+  wfsLayer: null,
+  dataSource: null,
   init(url) {
     this.url = url;
     this.getJsonLayer();
@@ -73,7 +78,7 @@
     });
   },
   setQyeryData(res) {
-    this.setTitleSetRest();
+    // this.setTitleSetRest();
     if (res.indexOf("娴峰啗闄嗘垬闃�") > -1) {
       this.setQueryExtent2();
     } else if (res.indexOf("鍐涗簨鐩爣") > -1) {
@@ -93,9 +98,28 @@
     encrypt.setPublicKey(modelLayer.publickey + "");
     return encrypt.encrypt(res);
   },
-  setQueryTF2(name) {
-    const obj = "weaponname = '" + name + "'" + "";
+  async setQueryFlywire() {
+    const obj = "ejfl = '缇庣┖鍐涙寚鎸ヤ腑蹇�'" + "";
     const filed = this.getPublickey(obj);
+    const layer = modelLayer.layers.filter((item) => {
+      if (item.name == "寤虹瓚") {
+        return item;
+      }
+    });
+    if (layer.length <= 0) return;
+    const data = getQueryEentity({
+      token: getToken(),
+      start: 1,
+      count: 0,
+      containCount: true,
+      layerid: layer[0].id,
+      dbid: modelLayer.dbid,
+      where: filed
+    });
+  },
+  setQueryTF2(name) {
+    //  const obj = "weaponname like '%鍫や赴绯荤粺%'" + "";
+    const filed = this.getPublickey(name);
     const layer = modelLayer.layers.filter((item) => {
       if (item.name == "姝﹀櫒鐐�") {
         return item;
@@ -111,11 +135,12 @@
       dbid: modelLayer.dbid,
       where: filed
     }).then((response) => {
+ 
       if (response.code != 200) return;
       const geom = response.data.items[0];
       const position = [geom._x, geom._y, 0];
       const cylinder = {
-        radius: 1000, //鍗婂緞
+        radius: 400000, //鍗婂緞
         angle: 30, //鎵弿瑙掑害锛堝彲閫夛級
         speed: 5, //鍊嶉�燂紙鍙�夛級
         stackPartitions: 80, //妯悜缃戞牸鏁帮紙鍙�夛級
@@ -126,10 +151,52 @@
         position,
         cylinder
       );
-      Viewer.zoomTo(this.rectangularSensor.item);
+     
+      
+      earthCtrl.camera.flyTo(
+        113.00849464328284,
+        10.437567580726105,
+        1101300.7027243855,
+        57, -45, 0, 2
+        );
+       
     });
   },
-  setQueryByFiled(name, color, label) {
+  setQueryByFiled(name, color) {
+    const filed = this.getPublickey(name);
+    var objItem = mapServer.listData.filter((item) => {
+      if (item.type === "Tileset") {
+        return item;
+      }
+    });
+    if (objItem.length <= 0) return;
+    var tileset = objItem[0];
+    getQueryEentity({
+      token: getToken(),
+      start: 1,
+      count: 0,
+      containCount: true,
+      layerid: tileset.layerId,
+      dbid: modelLayer.dbid,
+      where: filed
+    }).then((response) => {
+      if (response.code != 200) return;
+      var std = [];
+      const items = response.data.items;
+      items.map((item) => {
+        std.push(item.seid);
+      });
+      nextTick(() => {
+        if (std.length > 0) {
+          this.setTilesetColorChange(tileset, std, color);
+        }
+      });
+    });
+  },
+  setQueryByFiledList(list, flag) {
+    const result = list[flag];
+    const name = result.name;
+    const color = result.color;
     const obj = "targettype = '" + name + "'" + "";
     const filed = this.getPublickey(obj);
     var objItem = mapServer.listData.filter((item) => {
@@ -152,17 +219,45 @@
       var std = [];
       const items = response.data.items;
       items.map((item) => {
-        if (item.targettype == name) {
-          std.push(item.seid);
-        }
+        // if (item.targettype == name) {
+        std.push(item.seid);
+        // }.
       });
       nextTick(() => {
-        if (std.length <= 0) return;
-        this.setTilesetColorChange(tileset, std, color);
+        if (std.length > 0) {
+          this.targetList.push({
+            ids: std,
+            color: color
+          });
+        }
+        flag = flag + 1;
+
+        if (flag >= list.length) {
+          this.setTilesetColorChangeTarget();
+        } else {
+          this.setQueryByFiledList(list, flag);
+        }
       });
     });
   },
   setTitleSetRest() {
+    this.targetList = [];
+    if (this.dataSource) {
+      Viewer.dataSources.remove(this.dataSource);
+      this.dataSource = null
+    }
+    if (this.wfsLayer) {
+      // this.wfsLayer.removeFromMap();
+      this.wfsLayer.destroy();
+    }
+    if (this.linePath) {
+      this.linePath.clear();
+      this.linePath = null;
+    }
+    if (this.richTextPoint1) {
+      this.richTextPoint1.deleteObject();
+      this.richTextPoint1 = null;
+    }
     if (this.rectangularSensor) {
       this.rectangularSensor.wall.forEach((wall) => {
         Viewer.entities.remove(wall);
@@ -193,11 +288,98 @@
           const id = feature.getProperty("id");
           if (ids.indexOf(id) > -1) {
             return new SmartEarth.Cesium.Color.fromCssColorString(color);
-          } else {
-            return new SmartEarth.Cesium.Color.fromCssColorString("#FFFFFF");
           }
         }
       }
+    });
+  },
+  setTilesetColorChangeTarget() {
+    var objItem = mapServer.listData.filter((item) => {
+      if (item.type === "Tileset") {
+        return item;
+      }
+    });
+    if (objItem.length <= 0) return;
+    var tileset = objItem[0].layer;
+    const list = this.targetList;
+
+    tileset.style = new Cesium.Cesium3DTileStyle({
+      color: {
+        evaluateColor: (feature) => {
+          const id = feature.getProperty("id");
+          for (var i in list) {
+            if (list[i].ids.indexOf(id) > -1) {
+              return new SmartEarth.Cesium.Color.fromCssColorString(
+                list[i].color
+              );
+            }
+          }
+          // if (ids.indexOf(id) > -1) {
+          //   return new SmartEarth.Cesium.Color.fromCssColorString(color);
+          // }
+        }
+      }
+    });
+  },
+  setAddWfsLayer() {
+    this.wfsLayer = earthCtrl.factory.createWfsLayer("polygon", {
+      urls: "https://cim.smartearth.cn/SEserver/wfsserver/SubicBayWeapon_wfs",
+      layer: "weapons",
+      outlineColor: "#ff0000",
+      alpha: 0
+    });
+  },
+  setAddWfsJson() {
+    const url = this.getQueryUrl("SubicBayWeapon_wfs", "weapons");
+    const that = this;
+    Cesium.GeoJsonDataSource.load(url, {
+      fill: Cesium.Color.fromCssColorString("#FFFFFF00"),
+      stroke: Cesium.Color.fromCssColorString("#FFFFFF00"), //澶氳竟褰㈡垨绾跨殑棰滆壊
+
+      strokeWidth: 0 //澶氳竟褰㈡垨绾� 瀹藉害
+    }).then((dataSource) => {
+      that.dataSource = dataSource;
+      const entities = that.dataSource.entities.values;
+      entities.map((item) => {
+        item.polygon._material.color =
+          Cesium.Color.fromCssColorString("#FFFFFF00");
+        item.polygon.heightReference =
+          Cesium.HeightReference.RELATIVE_TO_GROUND; // 璐村湴
+        item.polygon.height = 0; // 璺濆湴楂樺害0绫�
+        var polyPositions = item.polygon.hierarchy.getValue().positions;
+        var polyCenter = Cesium.BoundingSphere.fromPoints(polyPositions).center; //涓績鐐�
+        polyCenter = Cesium.Ellipsoid.WGS84.scaleToGeodeticSurface(polyCenter);
+        item.position = polyCenter;
+        let positions = item.polygon.hierarchy._value.positions;
+        // 璁剧疆闈㈣疆寤�
+        item.polyline = new Cesium.PolylineGraphics({
+          positions: positions,
+          clampToGround: true, // 璐村湴
+          width: 5,
+          material: Cesium.Color.fromCssColorString("#FFA500")
+        });
+
+        const label_name = item.name ? item.name : "";
+        item.label = {
+          text: label_name,
+          font: "500 16x sans-serif",
+          style: Cesium.LabelStyle.FILL_AND_OUTLINE, // 瀛椾綋鏍峰紡
+          fillColor: new Cesium.Color.fromCssColorString("#FFFFFF"),
+          outlineWidth: 1, // 瀛椾綋澶栧湀绾垮搴︼紙鍚屾牱涔熸湁棰滆壊鍙缃級
+          outlineColor: new Cesium.Color.fromCssColorString("#FFFFFF"),
+          verticalOrigin: Cesium.VerticalOrigin.BASELINE, // 鍨傜洿浣嶇疆
+          pixelOffset: new Cesium.Cartesian2(0, 0), // 涓績浣嶇疆
+          disableDepthTestDistance: Number.POSITIVE_INFINITY,
+          distanceDisplayCondition: new Cesium.DistanceDisplayCondition(
+            500.0,
+            3000.0
+          )
+          // showBackground:true,
+          // backgroundColor: new Cesium.Color(26 / 255, 196 / 255, 228 / 255, 1.0) //鑳屾櫙椤旇壊
+        };
+      });
+
+      Viewer.dataSources.add(that.dataSource);
     });
   },
   getTileSet() {
@@ -211,13 +393,13 @@
     }
     return objItem[0];
   },
-  setQueryExtent2() {
+  setQueryExtent2(res, boolen) {
     const tileset = this.getTileSet();
     if (!tileset) {
       return;
     }
-    const obj = "ejfl like '%绌哄啗鍩哄湴%'";
-    const filed = this.getPublickey(obj);
+    //
+    const filed = this.getPublickey(res);
     getQueryEentity({
       token: getToken(),
       start: 1,
@@ -229,10 +411,133 @@
     }).then((response) => {
       if (response.code != 200) return;
       const items = response.data.items[0];
-
-      this.getQueryGeomExtent(items, tileset.layerId);
+      const obj_val = response.data.items.filter((rs) => {
+        if (rs.seid == "1_b810b88e1c7144bcb1c73eb6f45c3cf0") {
+          return rs;
+        }
+      });
+      if (boolen) {
+        this.getQueryGeomExtent(obj_val[0], tileset.layerId);
+      } else {
+        this.getshowQueryExtentLabel(obj_val[0]);
+      }
     });
   },
+  getshowQueryExtentLabel(res) {
+    this.richTextPoint1 = earthCtrl.factory.createRichTextPoint(
+      res.ejfl,
+      [res.lon, res.lat],
+      {
+        fontColor: "#ffff00",
+        fontSize: 18
+      },
+      "0"
+    );
+    const center = { lon: res.lon, lat: res.lat };
+    const cities = [
+      {
+        lon: 120.26923413,
+        lat: 14.7887635155
+      },
+      {
+        lon: 120.266906151,
+        lat: 14.799529948
+      },
+      {
+        lon: 120.267382051,
+        lat: 14.788105695
+      },
+      {
+        lon: 120.26710735,
+        lat: 14.7993756478
+      },
+      {
+        lon: 120.286842844,
+        lat: 14.7924281921
+      },
+      {
+        lon: 120.286923225,
+
+        lat: 14.7933412456
+      },
+      {
+        lon: 120.266707102,
+
+        lat: 14.7996392512
+      },
+      {
+        lon: 120.268701861,
+
+        lat: 14.7886095373
+      },
+      {
+        lon: 120.270684963,
+
+        lat: 14.7919831852
+      },
+      {
+        lon: 120.266265954,
+
+        lat: 14.7999317012
+      },
+      {
+        lon: 120.269896499,
+
+        lat: 14.7901043245
+      },
+      {
+        lon: 120.286600837,
+
+        lat: 14.7926858017
+      },
+      {
+        lon: 120.286991515,
+
+        lat: 14.7927451318
+      },
+      {
+        lon: 120.286760149,
+
+        lat: 14.7930139536
+      },
+      {
+        lon: 120.28633835,
+
+        lat: 14.7929774056
+      },
+      {
+        lon: 120.266684567,
+
+        lat: 14.7877010021
+      },
+      {
+        lon: 120.283448259,
+
+        lat: 14.7972858134
+      },
+      {
+        lon: 120.286503613,
+
+        lat: 14.7932728306
+      },
+      {
+        lon: 120.286649886,
+        lat: 14.7935912152
+      }
+    ];
+    let pathOption = {
+      width: 3, //绾垮锛堝彲閫夛級
+      color: "#00ffff", //绾块鑹诧紙鍙�夛級,
+      LightSpot: true, //鏄惁浣跨敤鍏夌偣鏁堟灉锛堝彲閫夛級
+      LightSpotColor: "#ffffff", //鍏夌偣棰滆壊锛堝彲閫夛級
+      height: 100
+    };
+    this.linePath = earthCtrl.factory.createTrailLinePath(
+      center,
+      cities,
+      pathOption
+    );
+  },
   getQueryGeomExtent(items, layerid) {
     var geom = mapConfig.setPointToCrical(items.lon, items.lat, 1);
     const token = getToken();

--
Gitblit v1.9.3