ansel0926
2022-05-14 cc021a0544a8c0b2a056cec3168da119515a8e38
assets/map/map3D.js
@@ -148,6 +148,7 @@
         viewer.clock.onTick.removeEventListener(onTickCallback);
         var pick = viewer.scene.pick(movement.position);
         CesiumPop.removeDiv();
         if(labelLayer!=null){//关闭文字编辑弹窗
            layer.close(labelLayer);
         }
@@ -210,7 +211,6 @@
                  layer.config({
                     extend: 'myskin/style.css' //同样需要先加载新皮肤
                  });
                  labelLayer=layer.open({
                     type: 2,
                     title: '<i class="iconfont icon-huitu i-item" style="font-size: 18px; color: white;"></i>  ' + "编辑文字",
@@ -227,6 +227,30 @@
                     success: function (layero, index) {
                        var iframe = window['layui-layer-iframe' + index];//拿到iframe元素
                            iframe.child(entity._id,pickPrimitive._text,pickPrimitive._fillColor.toCssHexString(),pickPrimitive._fontSize,pickPrimitive._fontFamily);//向此iframe层方法 传递参数   
                     }
                  });
               }
               else if(entity._name=='drawPointEntity'){
                  document.getElementById("pop_" +entity.id).style.display="block";
                  layer.config({
                     extend: 'myskin/style.css' //同样需要先加载新皮肤
                  });
                  labelLayer=layer.open({
                     type: 2,
                     title: '<i class="iconfont icon-huitu i-item" style="font-size: 18px; color: white;"></i>  ' + "编辑点",
                     maxmin: true,
                     skin: 'layer-ext-myskin',
                     shade: 0,
                     maxmin: false,
                     scrollbar: false,
                     shadeClose: true, //点击遮罩关闭层
                     area: ['320px', '300px'],
                     resize: false,
                     offset: ['50px',document.body.clientWidth-340],
                     content: 'project/editPoint.html',
                     success: function (layero, index) {
                        var iframe = window['layui-layer-iframe' + index];//拿到iframe元素
                            iframe.child(entity._id,entity.title);//向此iframe层方法 传递参数
                     }
                  });
               }
@@ -803,6 +827,57 @@
   });
}
function updatePoint(type,id,val){//修改点:zzf
   let signPointEntity = viewer.entities.getById(id);
   let popId="pop_"+id;
   let saveData;
   if(type==1){
      signPointEntity.title=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,
         "content":signPointEntity.title,
      }
   }
   else if(type==2){
      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;
      saveData= {
         "id":signPointEntity._id,
         "type": "point",
         "longitude": signPointEntity._position._value.x,
         "latitude": signPointEntity._position._value.y,
         "height": signPointEntity._position._value.z,
         "imagePath":newUrl,
      }
   }
   let token = window.localStorage.getItem("token");
   $.ajax({
      type: "post",
      async: false,
        url: parent.httpConfig.webApiUrl + "landstamp/front/updateDrawEntity",
        data: saveData,
      contentType: "application/x-www-form-urlencoded",
        beforeSend:function(request){
            request.setRequestHeader("token",token);
        },
      success: function (data) {
         console.log(data)
      },
      error: function (XMLHttpRequest, textStatus, errorThrown) {
         console.log("ajax请求失败!");
      }
   });
}
function addSeaFlow() {
   var waterFace = [121.52380572667727, 40.857604886322704, -30.580650037676627 + 400.0,
      121.29444660541178, 40.90418429460569, -54.60203546856298 + 400.0,
@@ -1134,6 +1209,7 @@
}
function initDrawEntity(){//zzf:初始化图形
   let token = window.localStorage.getItem("token");
    $.ajax({
      type: "get",
@@ -1168,21 +1244,54 @@
}
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))
   var cartographic = Cesium.Cartographic.fromCartesian(cartesian);
   var entity = viewer.entities.add({
      id:drawEntity.id,
      name: 'drawPointEntity',
      name:"drawPointEntity",
      position: cartesian,
      point: {
         color: Cesium.Color.RED,
         pixelSize: 10,
         outlineColor: Cesium.Color.WHITE,
         outlineWidth: 2,
         disableDepthTestDistance: Number.POSITIVE_INFINITY
      label: {
         show: true,
         verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
         horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
         font: 'bold 14px Helvetica',
         fillColor: Cesium.Color.WHITE,
         text: "",
         disableDepthTestDistance: Number.POSITIVE_INFINITY,
         heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
         distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 200000000.0)
      },
      billboard: {
         image: "../assets/images/icon/icon1.png",
         width: 40,
         height: 40,
         rotation: 0,
         verticalOrigin: Cesium.VerticalOrigin.TOP,
         horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
         disableDepthTestDistance: Number.POSITIVE_INFINITY,//广告牌不进行深度检测
         heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
         distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 200000000.0)
      }
   });
   if(drawEntity.content!=null&&drawEntity.content!=""){
      entity.title=drawEntity.content;
   }
   else{
   entity.title =  "点" + new Date(drawEntity.createTime).format("yyyyMMddhhmmss");
   }
   let popup = new Popup({
      viewer:viewer,
      geometry:cartesian,
      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="none";
   addTreeNode({
      "title": entity.title,
      "id": entity.id,