From 87b6f0f45fdaf01ddf96122e26ef25d0cd865972 Mon Sep 17 00:00:00 2001
From: lixuliang <lixuliang_hd@126.com>
Date: 星期日, 08 十月 2023 14:32:34 +0800
Subject: [PATCH] rpc

---
 src/assets/js/rpc.js |   85 ++++++++++++++++++++----------------------
 1 files changed, 40 insertions(+), 45 deletions(-)

diff --git a/src/assets/js/rpc.js b/src/assets/js/rpc.js
index a216f8b..de220a1 100644
--- a/src/assets/js/rpc.js
+++ b/src/assets/js/rpc.js
@@ -85,7 +85,7 @@
         ]).then(result => {
             var that = this;
             store.queryLayer.data = [];
-            //浼乿涓�
+            //浼佷笟
             var EntArr = result[0].result.filter(item => {
                 return item.entName.includes(res);
             });
@@ -114,30 +114,22 @@
                 that.objArr.push(itemObj);
             });
             //鍦板潡
-            var LandArr = result[2].candidates.filter(item => {
+            var LandArr = result[2].candidates.filter((item) => {
                 return item.attributes.QYMC.includes(res);
-            });
+            })
             // 缁撴灉鏍规嵁QYMC浠庣煭鍒伴暱鎺掑簭
-            LandArr.sort((a, b) =>
-                b.attributes.QYMC.length === a.attributes.QYMC.length
-                    ? 0
-                    : a.attributes.QYMC.length > b.attributes.QYMC.length
-                        ? 1
-                        : -1
-            );
-
-            LandArr.forEach(val => {
+            LandArr.sort((a, b) => (b.attributes.QYMC.length === a.attributes.QYMC.length ? 0 : a.attributes.QYMC.length > b.attributes.QYMC.length ? 1 : -1))
+            LandArr.forEach((val) => {
                 let itemObj = {
                     type: "鍦板潡",
                     name: val.attributes.QYMC,
                     area: val.attributes.area,
                     code: val.attributes["鍦板潡缂�"],
                     lon: val.location.x,
-                    lat: val.location.y
+                    lat: val.location.y,
                 };
-                that.objArr.push(itemObj);
+                objArr.push(itemObj);
             });
-
             if (index == length) {
                 if (that.objArr.length <= 0) {
 
@@ -186,36 +178,39 @@
     // 鏄剧ず鍦板潡鑼冨洿
     getLandmass(res) {
         let that = this;
-        // 鍒掔嚎
-        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({
-                        x: parseFloat(point[0]),
-                        y: parseFloat(point[1]),
-                        z: 0
-                    });
+        if (res.tpye == "鍥尯") {
+
+        } else if (res.tpye == "鍦板潡") {
+            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({
+                            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,
+                        "绾�"
+                    );
                 }
-                if (that.lacationLine) {
-                    sgworld.Creator.DeleteObject(that.lacationLine);
-                    that.lacationLine = null;
-                }
-                that.lacationLine = sgworld.Creator.createPolyline(
-                    geometry,
-                    "#ff0000",
-                    1,
-                    0,
-                    "绾�"
-                );
-            }
-        });
+            });
+        }
     },
 
     read(wkt) {
@@ -642,7 +637,7 @@
         });
         setTimeout(() => {
             this.setClearPointFly();
-        }, 5000);
+        }, 8000);
     },
     changeCameraHeading(res) {
         var nextIndex = this.marksIndex + 1;

--
Gitblit v1.9.3