From b5919ce577d2106eb8294e74160cda5c61feb4a8 Mon Sep 17 00:00:00 2001
From: ansel0926 <ansel0926@gmail.com>
Date: 星期二, 17 五月 2022 18:43:53 +0800
Subject: [PATCH] Merge branch 'master' of ssh://117.78.1.188:29418/DDE-WEB
---
assets/service/drawService.js | 86 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 86 insertions(+), 0 deletions(-)
diff --git a/assets/service/drawService.js b/assets/service/drawService.js
index 7b8be03..6ac310c 100644
--- a/assets/service/drawService.js
+++ b/assets/service/drawService.js
@@ -44,9 +44,95 @@
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瀵硅薄
};
CesiumDraw.clearDraw(options);
+}
+
+function saveDrawEntity(type,drawEntity,id){//zzf:淇濆瓨缁樺埗鐨勫浘褰�
+ let saveData;
+ if(type=='point'){
+ 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,
+ }
+ }
+ else if(type=='polyline'||type=='polygon'){
+ let longitudeList=[],latitudeList=[],heightList=[]
+ for(let i=0;i<drawEntity.length;i++){
+ var cartographic=Cesium.Cartographic.fromCartesian(drawEntity[i]._position._value);
+ var lng=Cesium.Math.toDegrees(cartographic.longitude);
+ var lat=Cesium.Math.toDegrees(cartographic.latitude);
+ var alt=cartographic.height;
+ longitudeList.push(lng)
+ latitudeList.push(lat)
+ heightList.push(alt)
+ }
+ saveData= {
+ "id":id,
+ "type": type,
+ "longitude": longitudeList.toString(),
+ "latitude": latitudeList.toString(),
+ "height": heightList.toString(),
+ }
+ }
+ else if(type=='label'){
+ 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({
+ type: "get",
+ async: false,
+ url: parent.httpConfig.webApiUrl + "landstamp/front/addDrawEntity",
+ data: saveData,
+ contentType: "application/json;charset=utf-8",
+ beforeSend:function(request){
+ request.setRequestHeader("token",token);
+ },
+ success: function (data) {
+ console.log(data)
+ },
+ error: function (XMLHttpRequest, textStatus, errorThrown) {
+ console.log("ajax璇锋眰澶辫触锛�");
+ }
+ });
}
\ No newline at end of file
--
Gitblit v1.9.1