function drawPoint() { var options = { 'viewer': viewer, //全局Cesium对象 'pointcolor': Cesium.Color.RED, //点的颜色 // 'printId':textid, //用来存放返回坐标的文本框的id 'text': '新', //要印在PIN标签上的文字 'size': 36 //PIN标签的大小(以像素为单位) }; CesiumDraw.drawPoint(options); } function drawPolyline() { var options = { 'viewer': viewer, //全局Cesium对象 'polylinecolor': new Cesium.Color.fromBytes(255,124,0,255), //线的颜色) 'pointcolor': Cesium.Color.WHITE, //画线时次点的颜色 // 'printId':textid, //用来存放返回坐标的文本框的id 'text': "线" //次点时生成的PIN标签上的文字 }; CesiumDraw.drawPolyline(options); } function drawPolygon(type) { var options = { 'viewer': viewer, //全局Cesium对象 'polygoncolor': Cesium.Color.SALMON.withAlpha(0.5), //面的颜色(可设置透明度) 'pointcolor': Cesium.Color.RED, //画面时圈点的颜色 // 'printId':textid, //用来存放返回坐标的文本框的id 'type': type }; CesiumDraw.drawPolygon(options); } function drawLabel(text) { var options = { 'viewer': viewer, 'label': { 'text': text, 'font': '30px SimSun', 'fillColor': Cesium.Color.RED, 'outlineColor': Cesium.Color.BLACK, 'outlineWidth': 2, 'style': Cesium.LabelStyle.FILL_AND_OUTLINE, 'scaleByDistance': new Cesium.NearFarScalar(100, 1.0, 200, 0.4) }, } CesiumDraw.drawLabel(options); } function drawText(text) { var options = { 'viewer': viewer, 'label': { 'text': text, 'font': '30px SimSun', 'fillColor': Cesium.Color.RED, 'outlineColor': Cesium.Color.BLACK, 'outlineWidth': 2, 'style': Cesium.LabelStyle.FILL_AND_OUTLINE, 'scaleByDistance': new Cesium.NearFarScalar(100, 1.0, 200, 0.4) }, } CesiumDraw.drawText(options); } function clearDraw() { var options = { 'viewer': viewer, //全局Cesium对象 }; CesiumDraw.clearDraw(options); } function saveDrawEntity(type,drawEntity,id){//zzf:保存绘制的图形 let saveData; if(type=='point'){ var cartographic=Cesium.Cartographic.fromCartesian(drawEntity._position._value); var lng=Cesium.Math.toDegrees(cartographic.longitude); var lat=Cesium.Math.toDegrees(cartographic.latitude); var alt=cartographic.height; saveData= { "id":id, "type": type, "longitude": lng, "latitude": lat, "height": alt, } } else if(type=='polyline'||type=='polygon'){ let longitudeList=[],latitudeList=[],heightList=[] for(let i=0;i