| | |
| | | var userId; |
| | | var userName; |
| | | |
| | | var layerMap=new Map();//存储id和图层的index索引结构 |
| | | |
| | | var entityMouseClickListenerIsEnable = true; |
| | | |
| | | var previousTime;//地球旋转的参数 |
| | |
| | | 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; |
| | |
| | | var cartesian = viewer.scene.pickPosition(movement.position); |
| | | //添加文字标签事件:zzf |
| | | if(entity!=undefined && entity instanceof Object &&entity.title!=undefined){ |
| | | if(entity._name=='drawLabelEtity'){ |
| | | if(entity._name=='drawLabelEntity'){//编辑文字 |
| | | document.getElementById("pop_" +entity.id).style.display="block"; |
| | | layer.config({ |
| | | extend: 'myskin/style.css' //同样需要先加载新皮肤 |
| | | extend: 'myskin/style.css' |
| | | }); |
| | | labelLayer=layer.open({ |
| | | type: 2, |
| | |
| | | shade: 0, |
| | | maxmin: false, |
| | | scrollbar: false, |
| | | shadeClose: true, //点击遮罩关闭层 |
| | | area: ['320px', '300px'], |
| | | shadeClose: true, |
| | | area: ['320px', '480px'], |
| | | resize: false, |
| | | offset: ['50px',document.body.clientWidth-340], |
| | | offset: ['50px',document.body.clientWidth-330], |
| | | content: 'project/editLabel.html', |
| | | 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层方法 传递参数 |
| | | 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]; |
| | | let content=$("#pop_" +entity.id).children(".bx-popup-content-ctn").children(".bx-popup-content").children(".textarea")[0].innerHTML; |
| | | iframe.child(id,title,fontColor,fontSize,fontFamily,content); |
| | | } |
| | | }); |
| | | } |
| | | else if(entity._name=='drawPointEntity'){ |
| | | else if(entity._name=='drawPointEntity'){//编辑点 |
| | | document.getElementById("pop_" +entity.id).style.display="block"; |
| | | layer.config({ |
| | | extend: 'myskin/style.css' //同样需要先加载新皮肤 |
| | | extend: 'myskin/style.css' |
| | | }); |
| | | labelLayer=layer.open({ |
| | | type: 2, |
| | |
| | | shade: 0, |
| | | maxmin: false, |
| | | scrollbar: false, |
| | | shadeClose: true, //点击遮罩关闭层 |
| | | area: ['320px', '300px'], |
| | | shadeClose: true, |
| | | area: ['320px', '335px'], |
| | | resize: false, |
| | | offset: ['50px',document.body.clientWidth-340], |
| | | offset: ['50px',document.body.clientWidth-330], |
| | | content: 'project/editPoint.html', |
| | | success: function (layero, index) { |
| | | var iframe = window['layui-layer-iframe' + index];//拿到iframe元素 |
| | | iframe.child(entity._id,entity.title);//向此iframe层方法 传递参数 |
| | | 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=='measureLineGroundEntity'){//编辑线 |
| | | 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/editLine.html', |
| | | success: function (layero, index) { |
| | | var iframe = window['layui-layer-iframe' + index]; |
| | | let id=entity._id; |
| | | let title=entity.title; |
| | | let lineColor=entity._polyline._material._color._value.toCssHexString(); |
| | | let lineSize=entity._polyline._width._value; |
| | | let attributes = pick.primitive.getGeometryInstanceAttributes(pick.id); |
| | | iframe.child(id,title,lineColor,lineSize,attributes); |
| | | } |
| | | }); |
| | | } |
| | | else if(entity._name=='measurePolyGonGroundEntity'){//编辑面 |
| | | 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/editPolygon.html', |
| | | success: function (layero, index) { |
| | | var iframe = window['layui-layer-iframe' + index]; |
| | | let id=entity._id; |
| | | let title=entity.title; |
| | | let polygonColor=entity._polygon._material._color._value.toCssHexString(); |
| | | iframe.child(id,title,polygonColor); |
| | | } |
| | | }); |
| | | } |
| | |
| | | |
| | | function updateLabel(type,id,val){//修改文字:zzf |
| | | let signPointEntity = viewer.entities.getById(id) |
| | | if(type==1){ |
| | | let popId="pop_"+id; |
| | | let saveData; |
| | | 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; |
| | | } |
| | | else if(type==2){ |
| | | else if(type==2){//标签颜色 |
| | | if(val==''){ |
| | | val=signPointEntity._label._fillColor._value; |
| | | } |
| | | signPointEntity._label._fillColor._value = Cesium.Color.fromCssColorString(val); |
| | | } |
| | | else if(type==3){ |
| | | else if(type==3){//标签字体大小 |
| | | let font=signPointEntity._label._font._value.split(" "); |
| | | signPointEntity._label._font._value = val+"px "+font[1]; |
| | | } |
| | | else if(type==4){ |
| | | else if(type==4){//标签字体 |
| | | let font=signPointEntity._label._font._value.split(" "); |
| | | signPointEntity._label._font._value = font[0]+" "+val; |
| | | } |
| | | // let mydata = "{id:'" + signPointEntity._id + "',"; |
| | | // mydata = mydata + "type:label,"; |
| | | // mydata = mydata + "longitude:" + signPointEntity._position._value.x + ","; |
| | | // mydata = mydata + "latitude:" + signPointEntity._position._value.y + ","; |
| | | // mydata = mydata + "height:" + signPointEntity._position._value.z + ","; |
| | | // mydata = mydata + "content:" + signPointEntity.title + ","; |
| | | // mydata = mydata + "color:'" + signPointEntity._label._fillColor._value.toCssColorString() + "',"; |
| | | // mydata = mydata + "fontsize:'" + signPointEntity._label._font._value[0].replace("px","") + "',"; |
| | | // mydata = mydata + "fontstyle:'" + signPointEntity._label._font._value[1] + "'}"; |
| | | let saveData= { |
| | | "id":signPointEntity._id, |
| | | "type": "label", |
| | | "longitude": signPointEntity._position._value.x, |
| | | "latitude": signPointEntity._position._value.y, |
| | | "height": signPointEntity._position._value.z, |
| | | "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], |
| | | 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; |
| | | 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({ |
| | |
| | | let signPointEntity = viewer.entities.getById(id); |
| | | let popId="pop_"+id; |
| | | let saveData; |
| | | if(type==1){ |
| | | 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, |
| | | "content":signPointEntity.title, |
| | | } |
| | | } |
| | | else if(type==2){ |
| | | 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; |
| | | } |
| | | 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", |
| | | "longitude": signPointEntity._position._value.x, |
| | | "latitude": signPointEntity._position._value.y, |
| | | "height": signPointEntity._position._value.z, |
| | | "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){ |
| | | saveData= { |
| | | "id":signPointEntity._id, |
| | | "type": "point", |
| | | "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({ |
| | | 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 updateLine(type,id,val,attributes){//修改线:zzf |
| | | let signPointEntity = viewer.entities.getById(id); |
| | | let saveData; |
| | | if(type==1){//线名称 |
| | | signPointEntity.title=val; |
| | | let treeLabelNode=getNodeById(signPointEntity.id,layerMenu[3].children) |
| | | treeLabelNode.title=val; |
| | | saveData= { |
| | | "id":signPointEntity._id, |
| | | "type": "polyline", |
| | | "content":val, |
| | | } |
| | | } |
| | | else if(type==2){//线颜色 |
| | | if(val==''){ |
| | | val=signPointEntity._polyline._material._color._value; |
| | | } |
| | | signPointEntity._polyline._material._color._value = Cesium.Color.fromCssColorString(val); |
| | | attributes.color= Cesium.ColorGeometryInstanceAttribute.toValue(Cesium.Color.fromCssColorString(val)); |
| | | saveData= { |
| | | "id":signPointEntity._id, |
| | | "type": "polyline", |
| | | "color":val, |
| | | } |
| | | } |
| | | else if(type==3){//线粗细 |
| | | signPointEntity._polyline._width._value = val; |
| | | attributes.width=val |
| | | saveData= { |
| | | "id":signPointEntity._id, |
| | | "type": "polyline", |
| | | "fontsize":val, |
| | | } |
| | | } |
| | | 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 updatePolygon(type,id,val){//修改面:zzf |
| | | let signPointEntity = viewer.entities.getById(id); |
| | | let saveData; |
| | | if(type==1){//面名称 |
| | | signPointEntity.title=val; |
| | | let treeLabelNode=getNodeById(signPointEntity.id,layerMenu[3].children) |
| | | treeLabelNode.title=val; |
| | | saveData= { |
| | | "id":signPointEntity._id, |
| | | "type": "polygon", |
| | | "content":val, |
| | | } |
| | | } |
| | | else if(type==2){//面颜色 |
| | | if(val==''){ |
| | | val=signPointEntity._polygon._material._color._value; |
| | | } |
| | | signPointEntity._polygon._material._color._value = Cesium.Color.fromCssColorString(val); |
| | | saveData= { |
| | | "id":signPointEntity._id, |
| | | "type": "polygon", |
| | | "color":val, |
| | | } |
| | | } |
| | | let token = window.localStorage.getItem("token"); |
| | | $.ajax({ |
| | | type: "post", |
| | |
| | | } |
| | | |
| | | function initDrawEntity(){//zzf:初始化图形 |
| | | |
| | | let token = window.localStorage.getItem("token"); |
| | | $.ajax({ |
| | | type: "get", |
| | |
| | | else if(data.rows[i].type=="label"){ |
| | | drawAjaxLabel(data.rows[i]) |
| | | } |
| | | else if(data.rows[i].type=="text"){ |
| | | drawAjaxText(data.rows[i]) |
| | | } |
| | | } |
| | | } |
| | | }, |
| | |
| | | } |
| | | |
| | | 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); |
| | | let iconPath=drawEntity.iconPath?parent.httpConfig.nginxUrl+drawEntity.iconPath:"../assets/images/icon/icon1.png"; |
| | | var entity=viewer.entities.add({ |
| | | id:drawEntity.id, |
| | | name:"drawPointEntity", |
| | | position:cartesian, |
| | | label: { |
| | | show: true, |
| | | text: drawEntity.content, |
| | | font: drawEntity.fontsize+'px '+drawEntity.fontstyle, |
| | | fillColor: drawEntity.color?Cesium.Color.fromCssColorString(drawEntity.color):Cesium.Color.WHITE, |
| | | outlineColor: Cesium.Color.BLACK, |
| | | outlineWidth: 2, |
| | | style: Cesium.LabelStyle.FILL_AND_OUTLINE, |
| | | eyeOffset:new Cesium.Cartesian3(0,20,0), |
| | | 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) |
| | | 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, |
| | | 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: window.localStorage.getItem("visualDistance")?new Cesium.DistanceDisplayCondition(0, window.localStorage.getItem("visualDistance")):new Cesium.DistanceDisplayCondition(0, 100000.0) |
| | | } |
| | | }); |
| | | if(drawEntity.content!=null&&drawEntity.content!=""){ |
| | |
| | | viewer:viewer, |
| | | geometry:cartesian, |
| | | entity:entity, |
| | | id: "pop_" + entity.id |
| | | id: "pop_" + entity.id, |
| | | type:'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; |
| | | $("#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({ |
| | |
| | | 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 = []; |
| | |
| | | name: 'measureLineGroundEntity', |
| | | polyline: { |
| | | clampToGround: true, |
| | | width: 1, |
| | | material: new Cesium.Color.fromBytes(255,124,0,255), |
| | | positions:measureLinePositonsArray |
| | | width: drawEntity.fontsize?drawEntity.fontsize:1, |
| | | material: drawEntity.color?Cesium.Color.fromCssColorString(drawEntity.color):new Cesium.Color.fromBytes(255,124,0,255), |
| | | positions:measureLinePositonsArray, |
| | | distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 10000000.0) |
| | | }, |
| | | drawpointArr: drawpointArr, |
| | | measureLinePositonsArray: measureLinePositonsArray |
| | | }); |
| | | measureLineGroundEntity.title = "折线" + new Date(drawEntity.createTime).format("yyyyMMddhhmmss"); |
| | | if(drawEntity.content!=null&&drawEntity.content!=""){ |
| | | measureLineGroundEntity.title=drawEntity.content; |
| | | } |
| | | else{ |
| | | measureLineGroundEntity.title = "折线" + new Date(drawEntity.createTime).format("yyyyMMddhhmmss"); |
| | | } |
| | | addTreeNode({ |
| | | "title": measureLineGroundEntity.title, |
| | | "id": measureLineGroundEntity.id, |
| | |
| | | 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(); |
| | |
| | | id:drawEntity.id, |
| | | name: 'measurePolyGonGroundEntity', |
| | | polygon: { |
| | | material: new Cesium.ColorMaterialProperty(Cesium.Color.RED.withAlpha(0.3)), |
| | | material: drawEntity.color?Cesium.Color.fromCssColorString(drawEntity.color):new Cesium.ColorMaterialProperty(Cesium.Color.RED.withAlpha(0.3)), |
| | | classificationType: Cesium.ClassificationType.BOTH, |
| | | outline: true, |
| | | outlineColor: Cesium.Color.WHITE, |
| | | hierarchy: new Cesium.CallbackProperty(function () { |
| | | return polygon; |
| | | }, false) |
| | | }, false), |
| | | distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 10000000.0) |
| | | } |
| | | }); |
| | | measurePolyGonGroundEntity.title = "面" + new Date(drawEntity.createTime).format("yyyyMMddhhmmss"); |
| | | if(drawEntity.content!=null&&drawEntity.content!=""){ |
| | | measurePolyGonGroundEntity.title=drawEntity.content; |
| | | } |
| | | else{ |
| | | measurePolyGonGroundEntity.title = "面" + new Date(drawEntity.createTime).format("yyyyMMddhhmmss"); |
| | | } |
| | | addTreeNode({ |
| | | "title": measurePolyGonGroundEntity.title, |
| | | "id": measurePolyGonGroundEntity.id, |
| | |
| | | } |
| | | |
| | | 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({ |
| | | let iconPath=drawEntity.iconPath?parent.httpConfig.nginxUrl+drawEntity.iconPath:"../assets/images/icon/icon1.png"; |
| | | var entity=viewer.entities.add({ |
| | | id:drawEntity.id, |
| | | name: 'drawLabelEtity', |
| | | position: cartesian.clone(), |
| | | name:"drawLabelEntity", |
| | | position:cartesian, |
| | | label: { |
| | | text: drawEntity.content, |
| | | font: drawEntity.fontsize+'px '+drawEntity.fontstyle, |
| | | fillColor: Cesium.Color.fromCssColorString(drawEntity.color), |
| | | fillColor: drawEntity.color?Cesium.Color.fromCssColorString(drawEntity.color):Cesium.Color.WHITE, |
| | | 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, |
| | | 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: iconPath, |
| | | 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: window.localStorage.getItem("visualDistance")?new Cesium.DistanceDisplayCondition(0, window.localStorage.getItem("visualDistance")):new Cesium.DistanceDisplayCondition(0, 100000.0) |
| | | } |
| | | }); |
| | | entity.title=drawEntity.content, |
| | | 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:'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; |
| | | } |
| | | document.getElementById("pop_" +entity.id).style.display="none"; |
| | | addTreeNode({ |
| | | "title": entity.title, |
| | | "id": entity.id, |
| | | "field": "Entity", |
| | | "checked": true, |
| | | "spread": true, |
| | | "children": [], |
| | | "ext": { |
| | | "lng": Cesium.Math.toDegrees(cartographic.longitude), |
| | | "lat": Cesium.Math.toDegrees(cartographic.latitude) |
| | | } |
| | | }, "4"); |
| | | } |
| | | |
| | | function drawAjaxText(drawEntity){//加载标签 |
| | | 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, |
| | | name:"drawTextEtity", |
| | | position:cartesian, |
| | | label: { |
| | | text: drawEntity.content?drawEntity.content:new Date(drawEntity.createTime).format("yyyyMMddhhmmss"), |
| | | font: drawEntity.fontsize+'px '+drawEntity.fontstyle, |
| | | fillColor: drawEntity.color?Cesium.Color.fromCssColorString(drawEntity.color):Cesium.Color.WHITE, |
| | | 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, |
| | | heightReference: Cesium.HeightReference.CLAMP_TO_GROUND, |
| | | 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; |
| | | } |
| | | document.getElementById("pop_" +entity.id).style.display="none"; |
| | | addTreeNode({ |
| | | "title": entity.title, |
| | | "id": entity.id, |