ansel0926
2022-05-17 3369585b980d1be2fd61a76d4cdccd3818604463
assets/map/map3D.js
@@ -9,6 +9,8 @@
var userId;
var userName;
var layerMap=new Map();//存储id和图层的index索引结构
var entityMouseClickListenerIsEnable = true;
var previousTime;//地球旋转的参数
@@ -224,9 +226,9 @@
                     maxmin: false,
                     scrollbar: false,
                     shadeClose: true, 
                     area: ['310px', '450px'],
                     area: ['320px', '480px'],
                     resize: false,
                     offset: ['50px',document.body.clientWidth-320],
                     offset: ['50px',document.body.clientWidth-330],
                     content: 'project/editLabel.html',
                     success: function (layero, index) {
                        var iframe = window['layui-layer-iframe' + index];
@@ -254,9 +256,9 @@
                     maxmin: false,
                     scrollbar: false,
                     shadeClose: true,
                     area: ['310px', '300px'],
                     area: ['320px', '335px'],
                     resize: false,
                     offset: ['50px',document.body.clientWidth-320],
                     offset: ['50px',document.body.clientWidth-330],
                     content: 'project/editPoint.html',
                     success: function (layero, index) {
                        var iframe = window['layui-layer-iframe' + index];
@@ -282,9 +284,9 @@
                     maxmin: false,
                     scrollbar: false,
                     shadeClose: true,
                     area: ['310px', '300px'],
                     area: ['320px', '300px'],
                     resize: false,
                     offset: ['50px',document.body.clientWidth-320],
                     offset: ['50px',document.body.clientWidth-330],
                     content: 'project/editLine.html',
                     success: function (layero, index) {
                        var iframe = window['layui-layer-iframe' + index];
@@ -309,9 +311,9 @@
                     maxmin: false,
                     scrollbar: false,
                     shadeClose: true,
                     area: ['310px', '300px'],
                     area: ['320px', '300px'],
                     resize: false,
                     offset: ['50px',document.body.clientWidth-320],
                     offset: ['50px',document.body.clientWidth-330],
                     content: 'project/editPolygon.html',
                     success: function (layero, index) {
                        var iframe = window['layui-layer-iframe' + index];
@@ -837,6 +839,7 @@
function updateLabel(type,id,val){//修改文字:zzf
   let signPointEntity = viewer.entities.getById(id)
   let popId="pop_"+id;
   let saveData;
   if(type==1){//标签文字
      signPointEntity.title=val;
      signPointEntity._label._text._value = val;
@@ -861,15 +864,28 @@
   else if(type==5){//文本内容
      $("#pop_" +signPointEntity.id).children(".bx-popup-content-ctn").children(".bx-popup-content").children(".textarea")[0].innerHTML=val;
   }
   else if(type==6){
      let urlArr = val.split("/");
      let newUrl=urlArr.splice(4).join("/")
      signPointEntity._billboard._image._value=parent.httpConfig.nginxUrl+newUrl;
      saveData= {
         "id":signPointEntity._id,
         "type": "label",
         "content":signPointEntity.title,
         "iconPath":newUrl,
      }
   }
   let popContent=$("#pop_" +signPointEntity.id).children(".bx-popup-content-ctn").children(".bx-popup-content").children(".textarea")[0].innerHTML;
   let saveData= {
      "id":signPointEntity._id,
      "type": "label",
      "content":signPointEntity.title,
      "color":signPointEntity._label._fillColor._value.toCssColorString(),
      "fontsize":signPointEntity._label._font._value.split(" ")[0].replace("px",""),
      "fontstyle":signPointEntity._label._font._value.split(" ")[1],
      "popContent":popContent
   if(type==1||type==2||type==3||type==4||type==5){
      saveData= {
         "id":signPointEntity._id,
         "type": "label",
         "content":signPointEntity.title,
         "color":signPointEntity._label._fillColor._value.toCssColorString(),
         "fontsize":signPointEntity._label._font._value.split(" ")[0].replace("px",""),
         "fontstyle":signPointEntity._label._font._value.split(" ")[1],
         "popContent":popContent
      }
   }
   let token = window.localStorage.getItem("token");
   $.ajax({
@@ -917,13 +933,24 @@
   }
   else if(type==5){
      let urlArr = val.split("/");
      let newUrl=urlArr.splice(3).join("/")
      $("#" + popId).children(".bx-popup-content-ctn").children(".bx-popup-content").children(".image")[0].src = val;
      let newUrl=urlArr.splice(4).join("/")
      $("#" + popId).children(".bx-popup-content-ctn").children(".bx-popup-content").children(".image")[0].src = parent.httpConfig.nginxUrl+newUrl;
      saveData= {
         "id":signPointEntity._id,
         "type": "point",
         "content":signPointEntity.title,
         "imagePath":newUrl,
      }
   }
   else if(type==6){
      let urlArr = val.split("/");
      let newUrl=urlArr.splice(4).join("/")
      signPointEntity._billboard._image._value=parent.httpConfig.nginxUrl+newUrl;
      saveData= {
         "id":signPointEntity._id,
         "type": "point",
         "content":signPointEntity.title,
         "iconPath":newUrl,
      }
   }
   if(type==1||type==2||type==3||type==4){
@@ -1383,7 +1410,6 @@
}
function initDrawEntity(){//zzf:初始化图形
   let token = window.localStorage.getItem("token");
    $.ajax({
      type: "get",
@@ -1420,6 +1446,7 @@
function drawAjaxPoint(drawEntity){//加载点
   let cartesian = Cesium.Cartesian3.fromDegrees(drawEntity.longitude, drawEntity.latitude, drawEntity.height);
   var cartographic = Cesium.Cartographic.fromCartesian(cartesian);
   let iconPath=drawEntity.iconPath?parent.httpConfig.nginxUrl+drawEntity.iconPath:"../assets/images/icon/icon1.png";
   var entity=viewer.entities.add({
      id:drawEntity.id,
      name:"drawPointEntity",
@@ -1435,10 +1462,10 @@
         horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
         disableDepthTestDistance: Number.POSITIVE_INFINITY,
         heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
         distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 10000000000000.0)
         distanceDisplayCondition: window.localStorage.getItem("visualDistance")?new Cesium.DistanceDisplayCondition(0, window.localStorage.getItem("visualDistance")):new Cesium.DistanceDisplayCondition(0, 100000.0)
      },
      billboard: {
         image: "../assets/images/icon/icon1.png",
         image: iconPath,
         width: 40,
         height: 40,
         rotation: 0,
@@ -1446,7 +1473,7 @@
         horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
         disableDepthTestDistance: Number.POSITIVE_INFINITY,
         heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
         distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 10000000000000.0)
         distanceDisplayCondition: window.localStorage.getItem("visualDistance")?new Cesium.DistanceDisplayCondition(0, window.localStorage.getItem("visualDistance")):new Cesium.DistanceDisplayCondition(0, 100000.0)
      }
   });
   if(drawEntity.content!=null&&drawEntity.content!=""){
@@ -1464,7 +1491,7 @@
      content:drawEntity.popContent?drawEntity.popContent:null,
   })
   if( drawEntity.imagePath!=null&& drawEntity.imagePath!=""){
      $("#pop_" + entity.id).children(".bx-popup-content-ctn").children(".bx-popup-content").children(".image")[0].src = parent.httpConfig.webApiUrl+drawEntity.imagePath;
      $("#pop_" + entity.id).children(".bx-popup-content-ctn").children(".bx-popup-content").children(".image")[0].src = parent.httpConfig.nginxUrl+drawEntity.imagePath;
   }
   document.getElementById("pop_" +entity.id).style.display="none";
   addTreeNode({
@@ -1499,7 +1526,8 @@
         clampToGround: true,
         width: drawEntity.fontsize?drawEntity.fontsize:1,
         material: drawEntity.color?Cesium.Color.fromCssColorString(drawEntity.color):new Cesium.Color.fromBytes(255,124,0,255),
         positions:measureLinePositonsArray
         positions:measureLinePositonsArray,
         distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 10000000.0)
      },
      drawpointArr: drawpointArr,
      measureLinePositonsArray: measureLinePositonsArray
@@ -1549,7 +1577,8 @@
         outlineColor: Cesium.Color.WHITE,
         hierarchy: new Cesium.CallbackProperty(function () {
            return polygon;
         }, false)
         }, false),
         distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 10000000.0)
      }
   });
   if(drawEntity.content!=null&&drawEntity.content!=""){
@@ -1575,6 +1604,7 @@
function drawAjaxLabel(drawEntity){//加载文字
   let cartesian = Cesium.Cartesian3.fromDegrees(drawEntity.longitude, drawEntity.latitude, drawEntity.height);
   var cartographic = Cesium.Cartographic.fromCartesian(cartesian);
   let iconPath=drawEntity.iconPath?parent.httpConfig.nginxUrl+drawEntity.iconPath:"../assets/images/icon/icon1.png";
   var entity=viewer.entities.add({
      id:drawEntity.id,
      name:"drawLabelEntity",
@@ -1590,10 +1620,10 @@
         horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
         disableDepthTestDistance: Number.POSITIVE_INFINITY,
         heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
         distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 10000000000000.0)
         distanceDisplayCondition: window.localStorage.getItem("visualDistance")?new Cesium.DistanceDisplayCondition(0, window.localStorage.getItem("visualDistance")):new Cesium.DistanceDisplayCondition(0, 100000.0)
      },
      billboard: {
         image: "../assets/images/icon/icon1.png",
         image: iconPath,
         width: 40,
         height: 40,
         rotation: 0,
@@ -1601,7 +1631,7 @@
         horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
         disableDepthTestDistance: Number.POSITIVE_INFINITY,
         heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
         distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 10000000000000.0)
         distanceDisplayCondition: window.localStorage.getItem("visualDistance")?new Cesium.DistanceDisplayCondition(0, window.localStorage.getItem("visualDistance")):new Cesium.DistanceDisplayCondition(0, 100000.0)
      }
   });
   if(drawEntity.content!=null&&drawEntity.content!=""){