From f0efddd9e32b9c5dc828401c4092be004b4826cf Mon Sep 17 00:00:00 2001
From: ansel0926 <ansel0926@gmail.com>
Date: 星期三, 18 五月 2022 12:05:08 +0800
Subject: [PATCH] 添加标签

---
 assets/service/drawService.js |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/assets/service/drawService.js b/assets/service/drawService.js
index d603cd7..e70a619 100644
--- a/assets/service/drawService.js
+++ b/assets/service/drawService.js
@@ -44,6 +44,21 @@
     CesiumDraw.drawLabel(options);
 }
 
+function drawText(text) {
+    var options = {
+        'viewer': viewer,
+        'label': {
+            'text': text,
+            'font': '30px SimSun',
+            'fillColor': Cesium.Color.RED,
+            'outlineColor': Cesium.Color.BLACK,
+            'outlineWidth': 2,
+            'style': Cesium.LabelStyle.FILL_AND_OUTLINE,
+            'scaleByDistance': new Cesium.NearFarScalar(100, 1.0, 200, 0.4)
+        },
+    }
+    CesiumDraw.drawText(options);
+}
 function clearDraw() {
     var options = {
         'viewer': viewer, //鍏ㄥ眬Cesium瀵硅薄
@@ -102,6 +117,23 @@
             "fontstyle":'SimSun',
         }
     }
+    else if(type=='text'){
+        var cartographic=Cesium.Cartographic.fromCartesian(drawEntity._position._value);
+        var lng=Cesium.Math.toDegrees(cartographic.longitude);
+        var lat=Cesium.Math.toDegrees(cartographic.latitude);
+        var alt=cartographic.height;
+        saveData= {
+            "id":id,
+            "type": type,
+            "longitude": lng,
+            "latitude": lat,
+            "height": alt,
+            "content":drawEntity.title,
+            "color":drawEntity._label._fillColor._value.toCssColorString(),
+            "fontsize":30,
+            "fontstyle":'SimSun',
+        }
+    }
 
     let token = window.localStorage.getItem("token");
     $.ajax({

--
Gitblit v1.9.1