From cbbbc6bd2d854270b9342ce2ff2a3432aaca22cf Mon Sep 17 00:00:00 2001
From: Surpriseplus <845948745@qq.com>
Date: 星期六, 18 二月 2023 15:19:31 +0800
Subject: [PATCH] 版本更新

---
 src/components/MapView/mapSpacePop.vue |  136 +++++++++++++++++++++++++++++++++------------
 1 files changed, 99 insertions(+), 37 deletions(-)

diff --git a/src/components/MapView/mapSpacePop.vue b/src/components/MapView/mapSpacePop.vue
index 8a265ff..37ef809 100644
--- a/src/components/MapView/mapSpacePop.vue
+++ b/src/components/MapView/mapSpacePop.vue
@@ -45,12 +45,14 @@
           ></el-input>
         </el-form-item>
         <el-form-item>
-          <el-button size="small"
+          <el-button
+            size="small"
             plain
             @click="setSpaceTableLayer"
           >鏌ヨ</el-button>
           <el-button
-            plain size="small"
+            plain
+            size="small"
             @click="restSpacePopLayer"
           >閲嶇疆</el-button>
         </el-form-item>
@@ -140,6 +142,11 @@
       attributeData: [],
       optionx: [],
       options: [],
+      conditions: [
+        ['<>', 'like'],
+        ['>=', '>', ' =', '<=', '<', '<>'],
+        ['>=', '<='],
+      ],
       options1: [
         {
           value: '=',
@@ -220,15 +227,35 @@
       this.showSpacePopLayer();
     },
     changeValue(value) {
+
       var obj = {};
       obj = this.optionx.find(function (item) {
-        return item.value === value;
+        return item.field === value;
       });
-      if (obj.type == 'serial' || obj.type == 'int') {
-        this.options = this.options2;
+      // debugger
+      // if (obj.type == 'serial' || obj.type == 'int') {
+      //   this.options = this.options2;
+      // } else {
+      //   this.options = this.options1;
+      // }
+      this.options = [];
+
+      var std = [];
+
+      if (obj.type == "text" || obj.type == "blob") {
+        std = this.conditions[0];
+      } else if (obj.type == "date" || obj.type == "datetime") {
+        std = this.conditions[2];
       } else {
-        this.options = this.options1;
+        std = this.conditions[1];
       }
+      for (var i in std) {
+        this.options.push({
+          label: std[i],
+          value: std[i],
+        });
+      }
+
       this.formInline.region = this.options[0].value;
     },
     setListDataStart() {
@@ -240,11 +267,22 @@
     showSpacePopLayer() {
       let val_date = this.optionx[0];
       this.formInline.name = val_date.field;
-      if (val_date.type == 'serial' || val_date.type == 'int') {
-        this.options = this.options2;
+      this.options = [];
+      var std = [];
+      if (val_date.type == "text" || val_date.type == "blob") {
+        std = this.conditions[0];
+      } else if (val_date.type == "date" || val_date.type == "datetime") {
+        std = this.conditions[2];
       } else {
-        this.options = this.options1;
+        std = this.conditions[1];
       }
+      for (var i in std) {
+        this.options.push({
+          label: std[i],
+          value: std[i],
+        });
+      }
+
       this.formInline.region = this.options[0].value;
       this.getSpaceTableLayer();
     },
@@ -336,6 +374,7 @@
       var val1 = decr(data.result);
       if (val1) {
         if (this.$store.state.primitLayer != null) {
+          sgworld.Viewer.entities.remove(this.$store.state.primitLayer);
           sgworld.Creator.DeleteObject(this.$store.state.primitLayer);
           this.$store.state.primitLayer = null;
         }
@@ -352,37 +391,63 @@
       this.getSpaceTableLayer();
     },
     setMapLoaction(res) {
-          if (this.$store.state.primitLayer != null) {
-          sgworld.Creator.DeleteObject(this.$store.state.primitLayer);
-          this.$store.state.primitLayer = null;
-        }
+      if (this.$store.state.primitLayer != null) {
+        sgworld.Creator.DeleteObject(this.$store.state.primitLayer);
+        // this.$store.state.primitLayer = null;
+        sgworld.Viewer.entities.remove(this.$store.state.primitLayer);
+        this.$store.state.primitLayer = null;
+      }
       var coord = res.coordinates;
       if (res.type == 'Point') {
-        this.$store.state.primitLayer = sgworld.Creator.CreateLabel(
-          { X: coord[0], Y: coord[1], Altitude: 2000 },
-          '',
-          SmartEarthRootUrl + 'Workers/image/mark.png',
-          {
-            disableDepthTestDistance: Infinity,
-            scale: 0.8,
-          },
-          0,
-          '宸℃鐐�'
+        var val = Cesium.Cartesian3.fromDegrees(
+          res.coordinates[0],
+          res.coordinates[1],
+
         );
-        sgworld.Navigate.flyToObj(this.$store.state.primitLayer.item);
-      } else if (res.type == 'MultiPolygon') {
+        this.$store.state.primitLayer = Viewer.entities.add({
+          position: val,
+          billboard: {
+            // 鍥惧儚鍦板潃锛孶RI鎴朇anvas鐨勫睘鎬�
+            image: SmartEarthRootUrl + "Workers/image/mark.png",
+            heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
+            // 澶у皬鏄惁浠ョ背涓哄崟浣�
+            sizeInMeters: false,
+            // 鐩稿浜庡潗鏍囩殑鍨傜洿浣嶇疆
+            verticalOrigin: Cesium.VerticalOrigin.CENTER,
+            // 鐩稿浜庡潗鏍囩殑姘村钩浣嶇疆
+            horizontalOrigin: Cesium.HorizontalOrigin.LEFT,
+            // 搴旂敤浜庡浘鍍忕殑缁熶竴姣斾緥銆傛瘮渚嬪ぇ浜庝細1.0鏀惧ぇ鏍囩锛岃�屾瘮渚嬪皬浜庝細1.0缂╁皬鏍囩銆�
+            scale: 1.0,
+            // 鏄惁鏄剧ず
+            show: true
+          }
+        });
+        this.$store.state.primitLayer.billboard.disableDepthTestDistance = Number.POSITIVE_INFINITY;
+
+        sgworld.Navigate.flyToObj(this.$store.state.primitLayer)
+
+      } else if (res.type == 'MultiPolygon' || res.type == 'LineString') {
         var val = res.coordinates[0][0];
         var std = [];
         for (var i in val) {
 
-          std.push({ x: val[i][0], y: val[i][1], z: 1000 })
+          std.push({ x: val[i][0], y: val[i][1] })
         }
-        this.$store.state.primitLayer = sgworld.Creator.createPolygon(std, {
-          fillColor: '#ffff00',
-          outlineColor: '#fff',
-          outlineWidth: 2
-        }, 1, 0, "闈�");
-        sgworld.Navigate.flyToObj(this.$store.state.primitLayer.item);
+        this.$store.state.primitLayer = Viewer.entities.add({
+          polyline: {
+            positions: Cesium.Cartesian3.fromDegreesArray(std),
+            width: 5,
+            material: new Cesium.Color(1.0, 0.0, 0.0, 0.3),
+            clampToGround: true,
+          }
+        })
+
+        // this.$store.state.primitLayer = sgworld.Creator.createPolygon(std, {
+        //   fillColor: '#ffff00',
+        //   outlineColor: '#fff',
+        //   outlineWidth: 2
+        // }, 1, 0, "闈�");
+        sgworld.Navigate.flyToObj(this.$store.state.primitLayer);
       } else if (res.type == 'MultiLineString') {
         var line = res.coordinates[0];
         var std = [];
@@ -390,7 +455,7 @@
 
           std.push({ x: line[i][0], y: line[i][1], z: 1000 })
         }
-       this.$store.state.primitLayer = sgworld.Creator.createPolyline(std, "#ffff00", 1, 0, "绾�");
+        this.$store.state.primitLayer = sgworld.Creator.createPolyline(std, "#ffff00", 1, 0, "绾�");
         sgworld.Navigate.flyToObj(this.$store.state.primitLayer.item);
       }
     },
@@ -412,19 +477,16 @@
   }
   .rightTitle {
     padding: 5px;
-    
+
     width: 100%;
     .boxClose {
       float: right;
       margin-right: 20px;
-    
     }
   }
   .bottomPage {
     position: absolute;
     bottom: 1%;
   }
-  
-  
 }
 </style>

--
Gitblit v1.9.3