From d3f9feb20237dec5215b9fd338f719725f406b1e Mon Sep 17 00:00:00 2001
From: TreeWish <1131093754@qq.com>
Date: 星期二, 07 二月 2023 17:01:18 +0800
Subject: [PATCH] 二维比例尺&指北针功能修改

---
 src/assets/lang/zh.js            |    1 +
 public/index.html                |   17 +++++++++++++++++
 src/views/Synthesis/LeftMenu.vue |   35 ++++++++++++++++++++++++++++++++++-
 3 files changed, 52 insertions(+), 1 deletions(-)

diff --git a/public/index.html b/public/index.html
index 7becb65..107f6f9 100644
--- a/public/index.html
+++ b/public/index.html
@@ -42,21 +42,38 @@
         border-radius: 2px;
       }
       .ol-full-screen {
+        display: none;
         position: absolute;
         right: 0.5em;
         top: 0.5em;
       }
       .ol-rotate {
+        display: none;
         position: absolute;
         top: 3em;
         right: 0.5em;
         transition: opacity 0.25s linear, visibility 0s linear;
       }
       .ol-scale-line {
+        display: none;
         right: 0.3em;
         bottom: 0.5em;
         position: absolute;
       }
+      .ol-scale-line-inner {
+        /* padding: 5px 10px; */
+        color: rgb(102, 102, 102);
+        font-weight: bold;
+        background-color: #fff;
+        text-align: center;
+        border-radius: 5px;
+      }
+      .ol-zoom {
+        display: none;
+        right: 0.3em;
+        bottom: 3em;
+        position: absolute;
+      }
     </style>
   </head>
 
diff --git a/src/assets/lang/zh.js b/src/assets/lang/zh.js
index c5ac3db..2427e0a 100644
--- a/src/assets/lang/zh.js
+++ b/src/assets/lang/zh.js
@@ -470,6 +470,7 @@
     areasurvey: "闈㈢Н娴嬮噺",
     volummeasure: "浣撶Н娴嬮噺",
     point: "鐐�",
+    textLabel: '鏂囨湰鐐�',
     line: "绾�",
     rectangle: "鐭╁舰",
     polygon: "澶氳竟褰�",
diff --git a/src/views/Synthesis/LeftMenu.vue b/src/views/Synthesis/LeftMenu.vue
index a775bb9..d02c0ee 100644
--- a/src/views/Synthesis/LeftMenu.vue
+++ b/src/views/Synthesis/LeftMenu.vue
@@ -285,6 +285,12 @@
             css: "twoMenu_imge81",
           },
           {
+            id: "h8",
+            label: "synthesis.textLabel",
+            name: "鏂囨湰鐐�",
+            css: "twoMenu_imge81",
+          },
+          {
             id: "h2",
             label: "synthesis.line",
             name: "绾�",
@@ -427,6 +433,9 @@
           sgworld.Creator.SimpleGraphic.clear()
 
           break
+        case "h8":
+          sgworld.Creator.createSimpleGraphic("label", {}, function (entity) {})
+          break
       }
     },
     handleSaveClick() {
@@ -474,6 +483,7 @@
         let files = evt.target.files
         if (files.length > 0) {
           let file = evt.target.files[0]
+          // sgworld.Creator.addKmlLayer('kml鏁版嵁', file, true);
           let fileReader = new FileReader()
           fileReader.readAsDataURL(file)
           fileReader.onload = () => {
@@ -482,6 +492,7 @@
               canvas: sgworld.Viewer.scene.canvas,
               clampToGround: true,
             }
+            files
             var geocachePromise = Cesium.KmlDataSource.load(
               fileReader.result,
               kmlOptions
@@ -491,8 +502,8 @@
 
               for (var i = 0; i < geocacheEntities.length; i++) {
                 var entity = geocacheEntities[i]
-
                 sgworld.Viewer.entities.add(entity)
+                console.log("entity", entity)
               }
             })
             // sgworld.Viewer.dataSources
@@ -1069,10 +1080,32 @@
         case "b7": //姣斾緥灏�
           this.isRuler = !this.isRuler
           window.sgworld.navControl("scale", this.isRuler)
+          let scale = document.querySelector(".ol-scale-line")
+          let zoomCtrl = document.querySelector(".ol-zoom")
+
+          if (!this.isRuler) {
+            scale.style.display = "none"
+            zoomCtrl.style.display = "none"
+          } else {
+            scale.style.display = "block"
+            zoomCtrl.style.display = "block"
+          }
+
           break
         case "b8": //鎸囧寳閽�
           this.isNaviget = !this.isNaviget
           window.sgworld.navControl("nav", this.isNaviget)
+          let rotate = document.querySelector(".ol-rotate")
+          let fullscreen = document.querySelector(".ol-full-screen")
+
+          if (!this.isNaviget) {
+            rotate.style.display = "none"
+            fullscreen.style.display = "none"
+          } else {
+            rotate.style.display = "block"
+            fullscreen.style.display = "block"
+          }
+
           break
         case "b9": //鍦颁笅妯″紡
           this.UndergroundMode = !this.UndergroundMode

--
Gitblit v1.9.3