From fef12378282c0a8cf44411b079ac20ad4f397817 Mon Sep 17 00:00:00 2001 From: guonan <guonan201020@163.com> Date: 星期五, 23 五月 2025 16:56:48 +0800 Subject: [PATCH] 修改比较多 --- src/views/GisView.vue | 26 +++++++++++++++----------- 1 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/views/GisView.vue b/src/views/GisView.vue index 322259a..5c8a762 100644 --- a/src/views/GisView.vue +++ b/src/views/GisView.vue @@ -27,7 +27,7 @@ // 1. 璁剧疆鍒濆鏃堕棿 const date = new Date(2025, 3, 11, 12, 0, 0, 0); - const julianDate = SmartEarth.Cesium.JulianDate.fromDate(date); + const julianDate = SmartEarth.Cesium.JulianDate.fromDate(date); // earthCtrl.viewer.clock.currentTime = julianDate; // 2. 閰嶇疆鏃堕挓閫夐」锛岀姝㈣嚜鍔ㄦ帹杩涙椂闂� @@ -58,10 +58,13 @@ const MULTIPOLYGON_COORDS = ref([]); let previousEntities = []; // 鐢ㄤ簬瀛樺偍涔嬪墠鍒涘缓鐨勫疄浣� const flyToHeight = ref(null); +const ShowFill = ref(true); // 鐩戝惉鏂板缓鏂规閫夋嫨鐨勫尯鍩熻寖鍥� -EventBus.on("select-geom", ({ geom, flyHeight }) => { +EventBus.on("select-geom", ({ geom, flyHeight, shouldShowFill }) => { flyToHeight.value = flyHeight; + ShowFill.value = shouldShowFill; + console.log(ShowFill.value, "ShowFill.valueShowFill.value"); const coordsStr = geom .replace("MULTIPOLYGON(((", "") // 鍘绘帀寮�澶� .replace(")))", ""); // 鍘绘帀缁撳熬 @@ -87,7 +90,7 @@ // 娓呴櫎涔嬪墠鐨勬墍鏈夊疄浣� clearPreviousEntities(); // 閫変腑鍖哄煙鏍囪壊 - addCustomPolygon(); + addCustomPolygon(ShowFill.value); }); // 娓呴櫎涔嬪墠鐨勬墍鏈夊疄浣� @@ -127,25 +130,27 @@ }; } -function addCustomPolygon() { +function addCustomPolygon(ShowFill = true) { // 灏� MULTIPOLYGON_COORDS.value 杞崲涓� GeoJSON 鏍煎紡 const geoJson = convertToGeoJson(MULTIPOLYGON_COORDS.value); const center = geoJson.properties.center; - // 鍒涘缓澶氳竟褰㈠疄浣� + // 鍒涘缓澶氳竟褰㈠疄浣擄紝骞舵牴鎹� ShowFill 鍙傛暟鍐冲畾鏄惁鏄剧ず濉厖棰滆壊 const polygonEntity = viewer.entities.add({ - // name: "鑷畾涔夊尯鍩�", polygon: { hierarchy: Cesium.Cartesian3.fromDegreesArray( geoJson.geometry.coordinates[0][0].flat() ), - material: Cesium.Color.RED.withAlpha(0.3), // 鍗婇�忔槑绾㈣壊濉厖 + material: ShowFill + ? Cesium.Color.RED.withAlpha(0.3) // 鍗婇�忔槑绾㈣壊濉厖 + : new Cesium.ColorMaterialProperty(Cesium.Color.TRANSPARENT), // 濡傛灉涓嶉渶瑕佸~鍏咃紝鍒欎娇鐢ㄩ�忔槑鏉愯川 outline: true, outlineColor: Cesium.Color.RED, // 绾㈣壊杈规 outlineWidth: 5, clampToGround: true, // 璐村湴鏄剧ず }, }); + previousEntities.push(polygonEntity); // 椋炲悜涓績鐐� @@ -154,14 +159,13 @@ center.lon, center.lat, flyToHeight.value - ), // 鎻愰珮鍒� 100000绫抽珮搴� + ), // 鎻愰珮鍒版寚瀹氶珮搴� orientation: { heading: Cesium.Math.toRadians(0), // 姝e寳鏂瑰悜 pitch: Cesium.Math.toRadians(-90), // 鍚戜笅鍊炬枩90搴︼紙鍨傜洿淇锛� roll: 0.0, }, }); - } EventBus.on("close-selectArea", () => { @@ -469,7 +473,7 @@ } // // 淇敼鎸囧崡閽堜綅缃� /deep/ .compass { - right: 128px !important; - top: 112px; + right: 128px !important; + top: 112px; } </style> -- Gitblit v1.9.3