ansel0926
2022-05-14 ecdaa37a673565e8e7419ac9062106b89e051c3e
assets/map/map3D.js
@@ -152,6 +152,9 @@
         if(labelLayer!=null){//关闭文字编辑弹窗
            layer.close(labelLayer);
         }
         $(".medium-item").children().filter(".bx-popup-ctn").each(function () {//隐藏pop
            this.style.display="none"
         })
         if (pick != undefined && pick instanceof Cesium.Cesium3DTileFeature) {
            var propertyNames = pick.getPropertyNames();
            var length = propertyNames.length;
@@ -231,6 +234,16 @@
                  });
               }
               else if(entity._name=='drawPointEntity'){
                  //console.log(pickPrimitive._position)
                  // let popup = new Popup({
                  //    viewer:viewer,
                  //    geometry:pickPrimitive._position,
                  //    entity:entity,
                  //    id: "pop_" + entity.id
                  // })
                  // 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;
                  // }
                  document.getElementById("pop_" +entity.id).style.display="block";
                  layer.config({
                     extend: 'myskin/style.css' //同样需要先加载新皮肤
@@ -831,17 +844,22 @@
   let signPointEntity = viewer.entities.getById(id);
   let popId="pop_"+id;
   let saveData;
   var cartographic=Cesium.Cartographic.fromCartesian(signPointEntity._position._value);
   var lng=Cesium.Math.toDegrees(cartographic.longitude);
   var lat=Cesium.Math.toDegrees(cartographic.latitude);
   var alt=cartographic.height;
   if(type==1){
      signPointEntity.title=val;
      signPointEntity._label._text._value = val;
      let treeLabelNode=getNodeById(signPointEntity.id,layerMenu[3].children)
      treeLabelNode.title=val;
      $("#" + popId).children(".bx-popup-header-ctn")[0].innerText=val;
      saveData= {
         "id":signPointEntity._id,
         "type": "point",
         "longitude": signPointEntity._position._value.x,
         "latitude": signPointEntity._position._value.y,
         "height": signPointEntity._position._value.z,
         "longitude": lng,
         "latitude": lat,
         "height": alt,
         "content":signPointEntity.title,
      }
   }
@@ -852,9 +870,10 @@
      saveData= {
         "id":signPointEntity._id,
         "type": "point",
         "longitude": signPointEntity._position._value.x,
         "latitude": signPointEntity._position._value.y,
         "height": signPointEntity._position._value.z,
         "longitude": lng,
         "latitude": lat,
         "height": alt,
         "content":signPointEntity.title,
         "imagePath":newUrl,
      }
   }
@@ -1244,10 +1263,7 @@
}
function drawAjaxPoint(drawEntity){//加载点
   //
   let cartesian3 = Cesium.Cartesian3.fromDegrees(drawEntity.longitude, drawEntity.latitude, drawEntity.height);
   console.log(drawEntity.content,cartesian3.x,cartesian3.y,cartesian3.z)
   let cartesian=new Cesium.Cartesian3(parseFloat(drawEntity.longitude),parseFloat(drawEntity.latitude),parseFloat(drawEntity.height))
   let cartesian = Cesium.Cartesian3.fromDegrees(drawEntity.longitude, drawEntity.latitude, drawEntity.height);
   var cartographic = Cesium.Cartographic.fromCartesian(cartesian);
   var entity=viewer.entities.add({
      id:drawEntity.id,
@@ -1259,21 +1275,23 @@
         horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
         font: 'bold 14px Helvetica',
         fillColor: Cesium.Color.WHITE,
         text: "",
         text: drawEntity.content,
         verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
         horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
         disableDepthTestDistance: Number.POSITIVE_INFINITY,
         heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
         distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 200000000.0)
         distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 10000000000000.0)
      },
      billboard: {
         image: "../assets/images/icon/icon1.png",
         width: 40,
         height: 40,
         rotation: 0,
         verticalOrigin: Cesium.VerticalOrigin.TOP,
         verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
         horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
         disableDepthTestDistance: Number.POSITIVE_INFINITY,//广告牌不进行深度检测
         disableDepthTestDistance: Number.POSITIVE_INFINITY,
         heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
         distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 200000000.0)
         distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 10000000000000.0)
      }
   });
   if(drawEntity.content!=null&&drawEntity.content!=""){
@@ -1286,10 +1304,15 @@
      viewer:viewer,
      geometry:cartesian,
      entity:entity,
      id: "pop_" + entity.id
      id: "pop_" + entity.id,
      type:drawEntity.popType?drawEntity.popType:'image',
      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;
   }
   if( drawEntity.popContent!=null&& drawEntity.popContent!=""){
      $("#pop_" + entity.id).children(".bx-popup-content-ctn").children(".bx-popup-content").children(".textarea")[0].innerText = drawEntity.popContent;
   }
   document.getElementById("pop_" +entity.id).style.display="none";
   addTreeNode({
@@ -1313,7 +1336,7 @@
   let heightList=drawEntity.height.split(",");
   //点坐标
   for(let i=0;i<longitudeList.length;i++){
      let cartesian=new Cesium.Cartesian3(parseFloat(longitudeList[i]),parseFloat(latitudeList[i]),parseFloat(heightList[i]))
      let cartesian = Cesium.Cartesian3.fromDegrees(longitudeList[i], latitudeList[i], heightList[i]);
      measureLinePositonsArray.push(cartesian);
   }
   var drawpointArr = []; 
@@ -1351,7 +1374,7 @@
   let heightList=drawEntity.height.split(",");
   //点坐标
   for(let i=0;i<longitudeList.length;i++){
      let cartesian=new Cesium.Cartesian3(parseFloat(longitudeList[i]),parseFloat(latitudeList[i]),parseFloat(heightList[i]))
      let cartesian = Cesium.Cartesian3.fromDegrees(longitudeList[i],latitudeList[i], heightList[i]);
      polyPositions.push(cartesian);
   }
   var polygon = new Cesium.PolygonHierarchy();
@@ -1388,7 +1411,7 @@
}
function drawAjaxLabel(drawEntity){//加载文字
   let cartesian=new Cesium.Cartesian3(parseFloat(drawEntity.longitude),parseFloat(drawEntity.latitude),parseFloat(drawEntity.height))
   let cartesian = Cesium.Cartesian3.fromDegrees(drawEntity.longitude, drawEntity.latitude, drawEntity.height);
   var cartographic = Cesium.Cartographic.fromCartesian(cartesian);
   cartographic = Cesium.Cartographic.fromCartesian(cartesian);
   var entity = viewer.entities.add({