| | |
| | | } |
| | | }); |
| | | } |
| | | if(entity._name=='drawTextEtity'){//编辑标签 |
| | | 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-330], |
| | | content: 'project/editText.html', |
| | | success: function (layero, index) { |
| | | var iframe = window['layui-layer-iframe' + index]; |
| | | let id=entity._id; |
| | | let title=entity.title; |
| | | let fontColor=entity._label._fillColor._value.toCssHexString(); |
| | | let fontSize=entity._label._font._value.split(" ")[0].replace("px",""); |
| | | let fontFamily=entity._label._font._value.split(" ")[1]; |
| | | iframe.child(id,title,fontColor,fontSize,fontFamily); |
| | | } |
| | | }); |
| | | } |
| | | else if(entity._name=='drawPointEntity'){//编辑点 |
| | | document.getElementById("pop_" +entity.id).style.display="block"; |
| | | layer.config({ |
| | |
| | | "fontstyle":signPointEntity._label._font._value.split(" ")[1], |
| | | "popContent":popContent |
| | | } |
| | | } |
| | | 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 updateText(type,id,val){//修改标签:zzf |
| | | let signPointEntity = viewer.entities.getById(id) |
| | | if(type==1){//标签文字 |
| | | signPointEntity.title=val; |
| | | signPointEntity._label._text._value = val; |
| | | let treeLabelNode=getNodeById(signPointEntity.id,layerMenu[3].children) |
| | | treeLabelNode.title=val; |
| | | } |
| | | else if(type==2){//标签颜色 |
| | | if(val==''){ |
| | | val=signPointEntity._label._fillColor._value; |
| | | } |
| | | signPointEntity._label._fillColor._value = Cesium.Color.fromCssColorString(val); |
| | | } |
| | | else if(type==3){//标签字体大小 |
| | | let font=signPointEntity._label._font._value.split(" "); |
| | | signPointEntity._label._font._value = val+"px "+font[1]; |
| | | } |
| | | else if(type==4){//标签字体 |
| | | let font=signPointEntity._label._font._value.split(" "); |
| | | signPointEntity._label._font._value = font[0]+" "+val; |
| | | } |
| | | let saveData= { |
| | | "id":signPointEntity._id, |
| | | "type": "text", |
| | | "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], |
| | | } |
| | | let token = window.localStorage.getItem("token"); |
| | | $.ajax({ |
| | |
| | | outlineColor: Cesium.Color.BLACK, |
| | | outlineWidth: 2, |
| | | style: Cesium.LabelStyle.FILL_AND_OUTLINE, |
| | | //pixelOffset: new Cesium.Cartesian2(0.0, 5.0), |
| | | eyeOffset:new Cesium.Cartesian3(0,20,0), |
| | | verticalOrigin: Cesium.VerticalOrigin.BOTTOM, |
| | | horizontalOrigin: Cesium.HorizontalOrigin.CENTER, |
| | | disableDepthTestDistance: Number.POSITIVE_INFINITY, |
| | |
| | | distanceDisplayCondition: window.localStorage.getItem("visualDistance")?new Cesium.DistanceDisplayCondition(0, window.localStorage.getItem("visualDistance")):new Cesium.DistanceDisplayCondition(0, 100000.0) |
| | | }, |
| | | }); |
| | | let popup = new Popup({ |
| | | viewer:viewer, |
| | | geometry:cartesian, |
| | | entity:entity, |
| | | id: "pop_" + entity.id, |
| | | type:'label', |
| | | content:drawEntity.popContent?drawEntity.popContent:null, |
| | | }) |
| | | if( drawEntity.popContent!=null&& drawEntity.popContent!=""){ |
| | | $("#pop_" + entity.id).children(".bx-popup-content-ctn").children(".bx-popup-content").children(".textarea")[0].innerHTML = drawEntity.popContent; |
| | | if(drawEntity.content!=null&&drawEntity.content!=""){ |
| | | entity.title=drawEntity.content; |
| | | } |
| | | document.getElementById("pop_" +entity.id).style.display="none"; |
| | | else{ |
| | | entity.title = "标签" + new Date(drawEntity.createTime).format("yyyyMMddhhmmss"); |
| | | } |
| | | addTreeNode({ |
| | | "title": entity.title, |
| | | "id": entity.id, |