From 8632c09b383b0070cf1bf683b58bc59b23288d1b Mon Sep 17 00:00:00 2001 From: lixuliang <lixuliang_hd@126.com> Date: 星期日, 08 十月 2023 10:59:55 +0800 Subject: [PATCH] 新增园区范围 --- src/assets/js/rpc.js | 45 +++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 41 insertions(+), 4 deletions(-) diff --git a/src/assets/js/rpc.js b/src/assets/js/rpc.js index 8667074..ffbf4d7 100644 --- a/src/assets/js/rpc.js +++ b/src/assets/js/rpc.js @@ -5,7 +5,8 @@ import { liushisijiayuanqudizhibianmafuwu, findAddressCandidates, - getDiKuanFanWei, + getLandBorder, + getParkBorder, ent_selectByName } from "../../api/api"; import vueEvents from "@/utils/vueEvent.js"; @@ -178,8 +179,40 @@ // 鏄剧ず鍦板潡鑼冨洿 getLandmass(res) { let that = this; - // 鍒掔嚎 - getDiKuanFanWei(res.lon, res.lat).then(response => { + 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 (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) { @@ -497,7 +530,11 @@ //娣诲姞瀹氫綅寮圭獥 this.setAddPointLocation(objdata); //鑼冨洿璋冪敤 - this.getLandmass(res); + if (res.type == '鍥尯') { + this.getPark(res) + } else if (res.type == '鍦板潡') { + this.getLandmass(res); + } }, setAddPointLocation(res) { -- Gitblit v1.9.3