From 82c0e01ab038fa3119208b8bf1fba2e46404c262 Mon Sep 17 00:00:00 2001 From: ansel0926 <ansel0926@gmail.com> Date: 星期六, 14 五月 2022 21:48:06 +0800 Subject: [PATCH] Merge branch 'master' of ssh://117.78.1.188:29418/DDE-WEB --- assets/map/map3D.js | 162 +++++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 147 insertions(+), 15 deletions(-) diff --git a/assets/map/map3D.js b/assets/map/map3D.js index fa6c49b..65e3602 100644 --- a/assets/map/map3D.js +++ b/assets/map/map3D.js @@ -148,9 +148,13 @@ viewer.clock.onTick.removeEventListener(onTickCallback); var pick = viewer.scene.pick(movement.position); CesiumPop.removeDiv(); + 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; @@ -210,7 +214,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 +230,40 @@ 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'){ + //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' //鍚屾牱闇�瑕佸厛鍔犺浇鏂扮毊鑲� + }); + 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 +840,63 @@ }); } +function updatePoint(type,id,val){//淇敼鐐癸細zzf + 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": lng, + "latitude": lat, + "height": alt, + "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": lng, + "latitude": lat, + "height": alt, + "content":signPointEntity.title, + "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 +1228,7 @@ } function initDrawEntity(){//zzf:鍒濆鍖栧浘褰� + let token = window.localStorage.getItem("token"); $.ajax({ type: "get", @@ -1168,21 +1263,58 @@ } function drawAjaxPoint(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); - var entity = viewer.entities.add({ + var entity=viewer.entities.add({ id:drawEntity.id, - name: 'drawPointEntity', - position: cartesian, - point: { - color: Cesium.Color.RED, - pixelSize: 10, - outlineColor: Cesium.Color.WHITE, - outlineWidth: 2, - disableDepthTestDistance: Number.POSITIVE_INFINITY + name:"drawPointEntity", + position:cartesian, + label: { + show: true, + verticalOrigin: Cesium.VerticalOrigin.BOTTOM, + horizontalOrigin: Cesium.HorizontalOrigin.CENTER, + font: 'bold 14px Helvetica', + fillColor: Cesium.Color.WHITE, + 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, 10000000000000.0) + }, + billboard: { + image: "../assets/images/icon/icon1.png", + width: 40, + height: 40, + rotation: 0, + verticalOrigin: Cesium.VerticalOrigin.BOTTOM, + horizontalOrigin: Cesium.HorizontalOrigin.CENTER, + disableDepthTestDistance: Number.POSITIVE_INFINITY, + heightReference: Cesium.HeightReference.CLAMP_TO_GROUND, + distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 10000000000000.0) } }); - entity.title = "鐐�" + new Date(drawEntity.createTime).format("yyyyMMddhhmmss"); + 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, + 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({ "title": entity.title, "id": entity.id, @@ -1204,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 = []; @@ -1242,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(); @@ -1279,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({ -- Gitblit v1.9.1