From b0623031f7839e3f5b061f712c6ead91f57db5cf Mon Sep 17 00:00:00 2001
From: Surpriseplus <845948745@qq.com>
Date: 星期日, 08 十月 2023 15:42:37 +0800
Subject: [PATCH] 地块展示效果优化

---
 src/assets/js/rpc.js |  126 +++++++++++++++++------------------------
 1 files changed, 52 insertions(+), 74 deletions(-)

diff --git a/src/assets/js/rpc.js b/src/assets/js/rpc.js
index ffbf4d7..939495f 100644
--- a/src/assets/js/rpc.js
+++ b/src/assets/js/rpc.js
@@ -5,8 +5,7 @@
 import {
     liushisijiayuanqudizhibianmafuwu,
     findAddressCandidates,
-    getLandBorder,
-    getParkBorder,
+    getDiKuanFanWei,
     ent_selectByName
 } from "../../api/api";
 import vueEvents from "@/utils/vueEvent.js";
@@ -129,7 +128,7 @@
                     lon: val.location.x,
                     lat: val.location.y,
                 };
-                objArr.push(itemObj);
+                that.objArr.push(itemObj);
             });
             if (index == length) {
                 if (that.objArr.length <= 0) {
@@ -178,69 +177,46 @@
     },
     // 鏄剧ず鍦板潡鑼冨洿
     getLandmass(res) {
+
         let that = this;
-        getLandBorder(res.lon, res.lat).then(response => {
-            let center = { lon: 0, lat: 0 };
-            let polygon = that.read(response.geometry);
-            if (polygon.length > 0) {
-                var geometry = [];
-                let points = polygon[0].split(",");
-                for (let i = 0; i < points.length; i++) {
-                    let point = points[i].replace(/^\s+|\s+$/g, "").split(" ");
-                    center.lon += parseFloat(point[0]) / points.length;
-                    center.lat += parseFloat(point[1]) / points.length;
-                    geometry.push({
-                        x: parseFloat(point[0]),
-                        y: parseFloat(point[1]),
-                        z: 0
-                    });
+        if (res.type == "鍥尯") {
+
+        } else if (res.type == "鍦板潡") {
+
+            getDiKuanFanWei(res.lon, res.lat).then(response => {
+                let center = { lon: 0, lat: 0 };
+                let polygon = that.read(response.geometry);
+                if (polygon.length > 0) {
+                    var geometry = [];
+                    let points = polygon[0].split(",");
+                    for (let i = 0; i < points.length; i++) {
+                        let point = points[i].replace(/^\s+|\s+$/g, "").split(" ");
+                        // center.lon += parseFloat(point[0]) / points.length;
+                        // center.lat += parseFloat(point[1]) / points.length;
+                        geometry.push(parseFloat(point[0]), parseFloat(point[1]))
+
+                    }
+                    that.setLacationLineClear()
+                    var position = Cesium.Cartesian3.fromDegreesArray(geometry)
+
+                    that.lacationLine = Viewer.entities.add({
+                        name: "绔嬩綋澧欐晥鏋�",
+                        wall: {
+                            positions: position,
+
+
+                            material: new Cesium.DynamicWallMaterialProperty({
+                                color: Cesium.Color.RED,
+                                duration: 4000
+                            }),
+                            // 璁剧疆楂樺害
+                            maximumHeights: Array(position.length).fill(80),
+                            minimumHeights: Array(position.length).fill(10),
+                        }
+                    })
                 }
-                if (that.lacationLine) {
-                    sgworld.Creator.DeleteObject(that.lacationLine);
-                    that.lacationLine = null;
-                }
-                that.lacationLine = sgworld.Creator.createPolyline(
-                    geometry,
-                    "#ff0000",
-                    1,
-                    0,
-                    "绾�"
-                );
-            }
-        });
-    },
-    // 鏄剧ず鍥尯鑼冨洿
-    getPark(res) {
-        let that = this;
-        getParkBorder(res.lon, res.lat).then(response => {
-            let center = { lon: 0, lat: 0 };
-            let polygon = that.read(response.geometry);
-            if (polygon.length > 0) {
-                var geometry = [];
-                let points = polygon[0].split(",");
-                for (let i = 0; i < points.length; i++) {
-                    let point = points[i].replace(/^\s+|\s+$/g, "").split(" ");
-                    center.lon += parseFloat(point[0]) / points.length;
-                    center.lat += parseFloat(point[1]) / points.length;
-                    geometry.push({
-                        x: parseFloat(point[0]),
-                        y: parseFloat(point[1]),
-                        z: 0
-                    });
-                }
-                if (that.lacationLine) {
-                    sgworld.Creator.DeleteObject(that.lacationLine);
-                    that.lacationLine = null;
-                }
-                that.lacationLine = sgworld.Creator.createPolyline(
-                    geometry,
-                    "#ff0000",
-                    1,
-                    0,
-                    "绾�"
-                );
-            }
-        });
+            });
+        }
     },
 
     read(wkt) {
@@ -530,11 +506,7 @@
         //娣诲姞瀹氫綅寮圭獥
         this.setAddPointLocation(objdata);
         //鑼冨洿璋冪敤
-        if (res.type == '鍥尯') {
-            this.getPark(res)
-        } else if (res.type == '鍦板潡') {
-            this.getLandmass(res);
-        }
+        this.getLandmass(res);
     },
 
     setAddPointLocation(res) {
@@ -671,7 +643,7 @@
         });
         setTimeout(() => {
             this.setClearPointFly();
-        }, 5000);
+        }, 8000);
     },
     changeCameraHeading(res) {
         var nextIndex = this.marksIndex + 1;
@@ -794,10 +766,8 @@
             this.instance && this.instance.$destroy();
             this.instance = null;
         }
-        if (this.lacationLine) {
-            sgworld.Creator.DeleteObject(this.lacationLine);
-            this.lacationLine = null;
-        }
+        //鍦板潡
+        this.setLacationLineClear()
         // 杞ㄨ抗绾�
         this.setClosePathLine();
         // 婕父
@@ -806,6 +776,14 @@
         this.setClearPointFly();
         vueEvents.$emit("queryLayer", false);
     },
+
+
+    setLacationLineClear() {
+        if (this.lacationLine) {
+            Viewer.entities.remove(this.lacationLine)
+            this.lacationLine = null;
+        }
+    },
     setClearPointFly() {
         if (this.pointerFly) {
             this.pointerFly && this.pointerFly.end();

--
Gitblit v1.9.3