var viewer;//全局cesium对象
|
var imageryLayers;//全局图层
|
var base3dtilesPrimitives = [];//3dtiles实景三维数据底图数据
|
var tilesUrl;//多质量等级三维地图数据集
|
var modelMatrixData;//多质量等级三维地图数据集的位置移动矩阵
|
var initView;//初始位置数据集
|
var isTerrainLoad = true;
|
var currentProjectId;
|
var userId;
|
var userName;
|
|
var layerMap=new Map();//存储id和图层的index索引结构
|
|
var entityMouseClickListenerIsEnable = true;
|
|
var previousTime;//地球旋转的参数
|
function initmap3D(mapOptions) {
|
//cesium全球30米分辨率地形资源token
|
Cesium.Ion.defaultAccessToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJlOGVhNWJlNy1lOWUxLTQ4NmYtODdiMy0xZjgxNmQ3YzFiOTMiLCJpZCI6NDY4NzQsImlhdCI6MTYxNjY1OTY2N30.XHxcm12F6imkniS7I7b0DHnbu7-oWypLm0VCrfp9iyI';
|
//初始化三维场景
|
viewer = new Cesium.Viewer('medium', {
|
infoBox: false,//取消的点击自带的弹窗
|
animation: false,//控制左下角的动画器件
|
geocoder: false,//控制右上角第一个位置的查找工具
|
homeButton: false,//控制右上角第二个位置的home图标
|
sceneModePicker: false,//控制右上角第三个位置的选择视角模式,2d,3d
|
baseLayerPicker: false,//控制右上角第四个位置的图层选择器
|
navigationHelpButton: false,//控制右上角第五个位置的导航帮助按钮
|
animation: false,//控制左下角的动画器件
|
timeline: false,//控制下方时间线
|
fullscreenButton: false,//右下角全屏按钮
|
terrainProvider: Cesium.createWorldTerrain(),//地表的起伏山脉,
|
//skyAtmosphere:new Cesium.SkyAtmosphere ()
|
});
|
imageryLayers = viewer.scene.imageryLayers;
|
setupLayers();
|
updateLayerList();
|
changeBaseLayer(0);
|
//取消版权信息
|
viewer._cesiumWidget._creditContainer.style.display = "none";
|
//提高清晰度
|
viewer.scene.globe.depthTestAgainstTerrain = true;
|
viewer.scene._hdr = true;
|
viewer.scene.fxaa = true;
|
viewer.scene.globe.maximumScreenSpaceError = 6 / 3;
|
viewer.scene.postProcessStages.fxaa.enabled = false;
|
//viewer.scene.debugShowFramesPerSecond = true;//FPS 显示器
|
//罗盘
|
var options = {};
|
// 用于在使用重置导航重置地图视图时设置默认视图控制。接受的值是Cesium.Cartographic 和 Cesium.Rectangle.
|
options.defaultResetView = Cesium.Rectangle.fromDegrees(80, 22, 130, 50);
|
// 用于启用或禁用罗盘。true是启用罗盘,false是禁用罗盘。默认值为true。如果将选项设置为false,则罗盘将不会添加到地图中。
|
options.enableCompass = true;
|
// 用于启用或禁用缩放控件。true是启用,false是禁用。默认值为true。如果将选项设置为false,则缩放控件将不会添加到地图中。
|
options.enableZoomControls = true;
|
// 用于启用或禁用距离图例。true是启用,false是禁用。默认值为true。如果将选项设置为false,距离图例将不会添加到地图中。
|
options.enableDistanceLegend = true;
|
// 用于启用或禁用指南针外环。true是启用,false是禁用。默认值为true。如果将选项设置为false,则该环将可见但无效。
|
options.enableCompassOuterRing = true;
|
|
CesiumNavigation.umd(viewer, options);
|
|
//禁止摄像机和地形的碰撞检测 则能看到地下场景
|
viewer.scene.screenSpaceCameraController.enableCollisionDetection = false;
|
viewer.scene.globe.translucency.enabled = true;//开始透明
|
|
// viewer.scene.globe.translucency.frontFaceAlphaByDistance = new Cesium.NearFarScalar(1.5e2, 0.5, 8.0e6, 1.0);
|
// alpha = Cesium.Math.clamp(0.5, 0.0, 1.0);
|
// globe.translucency.frontFaceAlphaByDistance.nearValue = alpha;
|
// globe.translucency.frontFaceAlphaByDistance.farValue = alpha;
|
|
//viewer.extend(Cesium.viewerDragDropMixin);
|
|
// //地图灰度系数
|
var layer0 = viewer.scene.imageryLayers.get(0);
|
layer0.gamma = 1;
|
viewer.scene.globe.enableLighting = true//必须开启光照效果
|
viewer.scene.globe.baseColor = new Cesium.Color(0, 0, 0, 1);//设置默认透明度
|
|
//地球旋转
|
// viewer.clock.multiplier = 100; //速度
|
// viewer.clock.shouldAnimate = true;
|
// previousTime = viewer.clock.currentTime.secondsOfDay;
|
// viewer.clock.onTick.addEventListener(onTickCallback);
|
|
|
//取消 init 的点击事件,否则会出现bug : 点击 entity 左键 拖拽地球有问题
|
viewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
|
|
//地球的初始化位置
|
initView = mapOptions.initView;
|
|
|
//承载shp的 vector
|
VectorTileImageryProvider = Cesium.VectorTileImageryProvider;
|
|
wholeView();
|
|
//双击事件
|
var handlerDoubleClick = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
|
handlerDoubleClick.setInputAction(function (movement) {
|
var pick = viewer.scene.pick(movement.position);
|
|
}, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
|
//监听鼠标事件
|
addMouseMoveListener();
|
addMouseClickListener();
|
|
// 亮度设置
|
var stages = viewer.scene.postProcessStages;
|
viewer.scene.brightness = viewer.scene.brightness || stages.add(Cesium.PostProcessStageLibrary.createBrightnessStage());
|
viewer.scene.brightness.enabled = true;
|
viewer.scene.brightness.uniforms.brightness = Number(1);
|
|
//添加海洋流动效果
|
// addSeaFlow();
|
|
//初始化绘制图形
|
initDrawEntity();
|
}
|
|
var mouseMoveHandler
|
var mouseClickHandler;
|
var labelLayer;//文字layer,防止重复出现
|
|
function addMouseClickListener() {
|
|
mouseClickHandler = mouseClickHandler && mouseClickHandler.destroy();
|
//监听点击事件,当点击地图时停止旋转
|
mouseClickHandler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
|
|
if (Cesium.PostProcessStageLibrary.isSilhouetteSupported(viewer.scene)) {
|
// var silhouetteGreen = Cesium.PostProcessStageLibrary.createEdgeDetectionStage();
|
// silhouetteGreen.uniforms.color = Cesium.Color.WHITE;
|
// silhouetteGreen.uniforms.length = 0.01;
|
// silhouetteGreen.selected = [];
|
// viewer.scene.postProcessStages.add(
|
// Cesium.PostProcessStageLibrary.createSilhouetteStage([
|
// silhouetteGreen,
|
// ])
|
// );
|
var previousPicked = {
|
feature: undefined,
|
originalColor: undefined
|
};
|
mouseClickHandler.setInputAction(function (movement) {
|
if (entityMouseClickListenerIsEnable == false) {
|
return;
|
}
|
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;
|
var content = "";
|
for (var i = 0; i < length; ++i) {
|
var propertyName = propertyNames[i];
|
if(pick.getProperty(propertyName)!=null&&pick.getProperty(propertyName)!=''&&pick.getProperty(propertyName)!=0
|
&&propertyName!='cx'&&propertyName!='cy'&&propertyName!='cz'){
|
content += propertyName + ': ' + pick.getProperty(propertyName) + '<br>'
|
}
|
}
|
|
var cartesian = viewer.scene.pickPosition(movement.position);
|
var cartographic = Cesium.Cartographic.fromCartesian(cartesian);
|
var lat = Cesium.Math.toDegrees(cartographic.latitude);
|
var lng = Cesium.Math.toDegrees(cartographic.longitude);
|
var alt1 = cartographic.height;
|
|
var alpha = pick.primitive.style == undefined ? 1.0 : pick.primitive.style.color.evaluateColor().alpha;
|
var content2 = '<div class="mapPop font2">'
|
+ '<div style="margin-top:10px;margin-left:15px;">'
|
+ content
|
+ '</div>'
|
+ '<div style="margin-left:15px;">'
|
+ '<div style="color: white;width: 40px;float: left;font-size: 12px;">透明度</div>'
|
+ '<input id="popAlpha" type="range" value = "' + alpha + '" max = "1.0" min="0.0" step="0.01" style="height:5px;margin-bottom:10px" />'
|
+ '</div>'
|
+ '</div>'
|
CesiumPop.bindPopGlobeEventHandler(viewer);
|
var options = {
|
"viewer": viewer,
|
"id": 1,
|
"popupWidth": 200,
|
"popupHeight": 100,
|
"pos": { "lon": Number(lng), "lat": Number(lat), "alt": Number(alt1) },
|
"extentHeight": 0,
|
"extentColor": Cesium.Color.RED,
|
"content": content2,
|
"feature": pick,
|
"primitive": pick.primitive
|
}
|
// console.log(options);
|
// pick.primitive.style = new Cesium.Cesium3DTileStyle({
|
// color: "color('rgba(255,255,255,0.2)')",
|
// });
|
|
CesiumPop.addDivPop(options);
|
// }
|
}
|
else if (pick != undefined && pick instanceof Object) {
|
var pickPrimitive = pick.primitive;
|
var entity = pick.id;
|
var cartesian = viewer.scene.pickPosition(movement.position);
|
//添加文字标签事件:zzf
|
if(entity!=undefined && entity instanceof Object &&entity.title!=undefined){
|
if(entity._name=='drawLabelEntity'){//编辑文字
|
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', '480px'],
|
resize: false,
|
offset: ['50px',document.body.clientWidth-330],
|
content: 'project/editLabel.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];
|
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'){//编辑点
|
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', '335px'],
|
resize: false,
|
offset: ['50px',document.body.clientWidth-330],
|
content: 'project/editPoint.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=='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;
|
iframe.child(id,title,lineColor,lineSize,pick);
|
}
|
});
|
}
|
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);
|
}
|
});
|
}
|
}
|
// var cartesian = viewer.scene.pickPosition(movement.position);
|
// var cartographic = Cesium.Cartographic.fromCartesian(cartesian);
|
// var lat = Cesium.Math.toDegrees(cartographic.latitude);
|
// var lng = Cesium.Math.toDegrees(cartographic.longitude);
|
// var alt1 = cartographic.height;
|
// if (pickPrimitive instanceof Cesium.PointPrimitive || pickPrimitive instanceof Cesium.GroundPolylinePrimitive || pickPrimitive instanceof Cesium.GroundPrimitive) {
|
// CesiumPop.bindPopGlobeEventHandler(viewer);
|
// var content = '<div class="mapPop font2">'
|
// + '<div style="margin-top:10px;margin-left:15px;">'
|
// + "名称:"
|
// + entity.title
|
// + '<br>'
|
// + "id:"
|
// + entity.id
|
// + '</div>'
|
// + '<div style="margin-left:15px;">'
|
// + '<button id="popExport" type="button">导出</button>'
|
// + '</div>'
|
// var options = {
|
// "viewer": viewer,
|
// "id": 1,
|
// "popupWidth": 200,
|
// "popupHeight": 100,
|
// "pos": { "lon": Number(lng), "lat": Number(lat), "alt": Number(alt1) },
|
// "extentHeight": 0,
|
// "extentColor": Cesium.Color.RED,
|
// "content": content,
|
// "feature": pick,
|
// "primitive": pick.primitive
|
// }
|
// CesiumPop.addDivPop(options);
|
// }
|
}
|
|
|
//判断以前是否选择要素
|
if (pick instanceof Cesium.Cesium3DTileFeature && pick.primitive._tilesType != "building") {
|
if (pick != previousPicked.feature) {
|
if (previousPicked.feature != undefined) {
|
previousPicked.feature.color = previousPicked.originalColor;
|
}
|
previousPicked.feature = pick;
|
previousPicked.originalColor = pick.color;
|
// pick.color = new Cesium.Color(1,1,1,0.5);
|
pick.color = pick.color.brighten(1, new Cesium.Color());
|
// silhouetteGreen.selected = [pick];
|
}
|
} else {
|
// silhouetteGreen.selected = [];
|
if (previousPicked.feature != undefined) {
|
previousPicked.feature.color = previousPicked.originalColor;
|
previousPicked.feature = undefined;
|
previousPicked.originalColor = undefined;
|
}
|
}
|
}, Cesium.ScreenSpaceEventType.LEFT_DOWN);
|
} else {
|
var previousPickedEntity = {
|
feature: undefined,
|
originalColor: undefined
|
};
|
|
mouseClickHandler.setInputAction(function (movement) {
|
viewer.clock.onTick.removeEventListener(onTickCallback);
|
var pick = viewer.scene.pick(movement.position);
|
if (pick instanceof Cesium.Cesium3DTileFeature) {
|
var propertyNames = pick.getPropertyNames();
|
var length = propertyNames.length;
|
var content = "";
|
for (var i = 0; i < length; ++i) {
|
var propertyName = propertyNames[i];
|
if(pick.getProperty(propertyName)!=null&&pick.getProperty(propertyName)!=''&&pick.getProperty(propertyName)!=0){
|
content += propertyName + ': ' + pick.getProperty(propertyName) + '<br>'
|
}
|
}
|
|
var cartesian = viewer.scene.pickPosition(movement.position);
|
var cartographic = Cesium.Cartographic.fromCartesian(cartesian);
|
var lat = Cesium.Math.toDegrees(cartographic.latitude);
|
var lng = Cesium.Math.toDegrees(cartographic.longitude);
|
var alt1 = cartographic.height;
|
|
|
var content2 = '<div class="mapPop font2">'
|
+ '<div style="margin-top:10px;margin-bottom:10px;margin-left:15px;">'
|
+ content
|
+ '</div>'
|
+ '</div>';
|
|
//layer.msg(content);
|
CesiumPop.bindPopGlobeEventHandler(viewer);
|
var options = {
|
"viewer": viewer,
|
"id": 1,
|
"popupWidth": 200,
|
"popupHeight": 100,
|
"pos": { "lon": Number(lng), "lat": Number(lat), "alt": Number(alt1) },
|
"extentHeight": 0,
|
"extentColor": Cesium.Color.RED,
|
"content": content2
|
|
}
|
CesiumPop.removeDiv();
|
CesiumPop.addDivPop(options);
|
|
//判断以前是否选择要素
|
if (pick != previousPickedEntity.feature) {
|
if (previousPickedEntity.feature != undefined) {
|
//还原前选择要素的本颜色
|
previousPickedEntity.feature.color = previousPickedEntity.originalColor;
|
//将当前选择要素及其颜色添加到previousPickedEntity
|
previousPickedEntity.feature = pick;
|
previousPickedEntity.originalColor = pick.color;
|
}
|
//将当前选择要素及其颜色添加到previousPickedEntity
|
previousPickedEntity.feature = pick;
|
previousPickedEntity.originalColor = pick.color;
|
}
|
//将模型变为黄色高亮
|
pick.color = Cesium.Color.BLUE;
|
} else {
|
CesiumPop.removeDiv();
|
}
|
}, Cesium.ScreenSpaceEventType.LEFT_DOWN);
|
}
|
}
|
|
function addMouseMoveListener() {
|
|
mouseMoveHandler = mouseMoveHandler && mouseMoveHandler.destroy();
|
//鼠标小手状态
|
mouseMoveHandler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
|
mouseMoveHandler.setInputAction(function (movement) {
|
var pick = viewer.scene.pick(movement.endPosition);
|
if (Cesium.defined(pick)) {
|
viewer._container.style.cursor = "pointer";
|
} else {
|
viewer._container.style.cursor = "default";
|
}
|
var ellipsoid = viewer.scene.globe.ellipsoid;
|
// var cartesian = viewer.camera.pickEllipsoid(movement.endPosition, ellipsoid);
|
var cartesian = viewer.scene.pickPosition(movement.endPosition);
|
if (cartesian) {
|
//将笛卡尔坐标转换为地理坐标
|
var cartographic = ellipsoid.cartesianToCartographic(cartesian);
|
//将弧度转为度的十进制度表示
|
lngStr = Cesium.Math.toDegrees(cartographic.longitude).toFixed(4);
|
latStr = Cesium.Math.toDegrees(cartographic.latitude).toFixed(4);
|
//获取相机高度
|
height = Math.ceil(viewer.camera.positionCartographic.height / 1000).toFixed(2);//视角高度
|
oheight = Math.ceil(viewer.scene.globe.getHeight(cartographic)).toFixed(2)//海拔
|
pitch = Number(viewer.scene.camera.pitch).toFixed(2);//俯仰角
|
heading = Number(viewer.scene.camera.heading).toFixed(2); //方向
|
|
$("#footer-lng").html("");
|
$("#footer-lng").html('经度:' + lngStr);
|
|
$("#footer-lat").html("");
|
$("#footer-lat").html('维度:' + latStr);
|
|
$("#footer-vheight").html("");
|
$("#footer-vheight").html('视高:' + height + "米");
|
|
$("#footer-oheight").html("");
|
$("#footer-oheight").html('海拔:' + oheight + "米");
|
|
$("#footer-pitch").html("");
|
$("#footer-pitch").html('俯视角:' + pitch + "度");
|
|
$("#footer-head").html("");
|
$("#footer-head").html('方向:' + heading + "度");
|
|
}
|
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
|
|
}
|
|
|
//图层控制
|
var viewModel = {
|
layers: [],
|
baseLayers: [],
|
terrain: {
|
layers: [],
|
show: true,
|
selectedIndex: 0
|
},
|
plotting: {
|
layers: [],
|
selectedIndex: 0
|
},
|
upLayer: null,
|
downLayer: null,
|
selectedLayer: null,
|
isSelectableLayer: function (layer) {
|
return this.baseLayers.indexOf(layer) >= 0;
|
},
|
raise: function (layer, index) {
|
imageryLayers.raise(layer);
|
viewModel.upLayer = layer;
|
viewModel.downLayer = viewModel.layers[Math.max(0, index - 1)];
|
updateLayerList();
|
window.setTimeout(function () {
|
viewModel.upLayer = viewModel.downLayer = null;
|
}, 10);
|
},
|
lower: function (layer, index) {
|
imageryLayers.lower(layer);
|
viewModel.upLayer =
|
viewModel.layers[
|
Math.min(viewModel.layers.length - 1, index + 1)
|
];
|
viewModel.downLayer = layer;
|
updateLayerList();
|
window.setTimeout(function () {
|
viewModel.upLayer = viewModel.downLayer = null;
|
}, 10);
|
},
|
canRaise: function (layerIndex) {
|
return layerIndex > 0;
|
},
|
canLower: function (layerIndex) {
|
return layerIndex >= 0 && layerIndex < imageryLayers.length - 1;
|
},
|
};
|
var baseLayers = viewModel.baseLayers;
|
Cesium.knockout.track(viewModel); // 跟踪此Model
|
function setupLayers() {
|
|
//天地图影像服务(经纬度)
|
// var tdtimgurl = "http://t0.tianditu.gov.cn/img_c/wmts?service=wmts&request=GetTile"
|
// + "&version=1.0.0&LAYER=img&style=default&tileMatrixSet=c&format=tiles"
|
// + "&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&"
|
// + "tk={s}"
|
var tdtimgurl = "http://t{s}.tianditu.gov.cn/img_c/wmts?service=wmts&request=GetTile&version=1.0.0" +
|
"&LAYER=img&tileMatrixSet=c&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}" +
|
"&style=default&format=tiles&tk=885787334a7909531065aa70d91dc7aa";
|
addBaseLayerOption(
|
"tianditu_img_c (via WMTS)",
|
new Cesium.WebMapTileServiceImageryProvider({
|
url: tdtimgurl,
|
layer: "tdtImg_c",
|
style: "default",
|
format: "tiles",
|
tileMatrixSetID: "c",
|
tilingScheme: new Cesium.GeographicTilingScheme(),
|
// subdomains: ["6362bdd307661a127766fd953f6acb39", "f9aac4a93c9a8e2caf3af01a3fe043cd", "b57ae52ac923c3a7c97b5d307616cd8c", "b4c00ecdda3b76ca9762c5112c59f97b", "045c1c4953bdfd53cf916328b9c30dbf"],
|
subdomains: ["0", "1", "2", "3", "4", "5", "6", "7"],
|
tileMatrixLabels: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18"],
|
maximumLevel: 17,
|
show: false
|
})
|
);
|
//bing影像底图 cesium默认地图
|
addBaseLayerOption("Bing Maps Aerial", undefined); // the current base layer
|
|
//天地图矢量底图
|
var tdtvecurl = "http://t0.tianditu.gov.cn/vec_w/wmts?service=wmts&request=GetTile"
|
+ "&version=1.0.0&LAYER=vec&tileMatrixSet=w&TileMatrix={TileMatrix}"
|
+ "&TileRow={TileRow}&TileCol={TileCol}&style=default&format=tiles"
|
+ "&tk={s}";
|
addBaseLayerOption(
|
"tianditu_vec_w (via WMTS)",
|
new Cesium.WebMapTileServiceImageryProvider({
|
url: tdtvecurl,
|
layer: "tdtvecLayer",
|
style: "default",
|
format: "image/jpeg",
|
tileMatrixSetID: "GoogleMaps",
|
subdomains: ["6362bdd307661a127766fd953f6acb39", "f9aac4a93c9a8e2caf3af01a3fe043cd", "b57ae52ac923c3a7c97b5d307616cd8c", "b4c00ecdda3b76ca9762c5112c59f97b", "045c1c4953bdfd53cf916328b9c30dbf"],
|
minimumLevel: 0,
|
maximumLevel: 18
|
})
|
);
|
//ArcGIS影像底图
|
addBaseLayerOption(
|
"ArcGIS World Street Maps",
|
new Cesium.ArcGisMapServerImageryProvider({
|
url:
|
"https://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer",
|
minimumLevel: 0,
|
maximumLevel: 18
|
})
|
);
|
//百度影像底图
|
addBaseLayerOption(
|
"BMap Img Maps",
|
new Cesium.BaiduImageryProvider({
|
style: 'img'
|
})
|
);
|
//百度矢量底图
|
addBaseLayerOption(
|
"BMap Vec Maps",
|
new Cesium.BaiduImageryProvider({
|
style: 'normal'
|
})
|
);
|
//高德影像底图
|
addBaseLayerOption(
|
"AMap Img Maps",
|
new Cesium.UrlTemplateImageryProvider({
|
url: "https://webst02.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}",
|
minimumLevel: 0,
|
maximumLevel: 18
|
})
|
);
|
//高德矢量底图
|
addBaseLayerOption(
|
"AMap Vec Maps",
|
new Cesium.UrlTemplateImageryProvider({
|
url: "http://webrd02.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}",
|
minimumLevel: 0,
|
maximumLevel: 18
|
})
|
);
|
//腾讯影像底图
|
addBaseLayerOption(
|
"Tencent Img Maps",
|
new Cesium.UrlTemplateImageryProvider({
|
url: 'https://p{s}.map.gtimg.com/sateTiles/{z}/{sx}/{sy}/{x}_{reverseY}.jpg?version=400',
|
subdomains: ["0", "1", "2"],
|
customTags: {
|
sx: function (imageryProvider, x, y, level) {
|
return x >> 4;
|
},
|
sy: function (imageryProvider, x, y, level) {
|
return ((1 << level) - y) >> 4;
|
}
|
}
|
})
|
);
|
//腾讯矢量底图
|
addBaseLayerOption(
|
"Tencent Vec Maps",
|
new Cesium.UrlTemplateImageryProvider({
|
url: 'https://rt{s}.map.gtimg.com/tile?z={z}&x={x}&y={reverseY}&styleid=1&scene=2&version=347',
|
subdomains: ["0", "1", "2"]
|
})
|
);
|
//OSM矢量底图
|
addBaseLayerOption(
|
"OpenStreetMaps",
|
new Cesium.OpenStreetMapImageryProvider()
|
);
|
//百度午夜蓝底图
|
addBaseLayerOption(
|
"BMap Img Maps",
|
new Cesium.BaiduImageryProvider({
|
style: 'midnight',
|
})
|
);
|
|
//天地图影像注记
|
// var tdtimganourl = "http://{s}.tianditu.gov.cn/cia_w/wmts?service=wmts&request=GetTile"
|
// + "&version=1.0.0&LAYER=cia&tileMatrixSet=w&TileMatrix={TileMatrix}"
|
// + "&TileRow={TileRow}&TileCol={TileCol}&style=default.jpg"
|
// + "&tk=3fd07756862125febfd7b53271a90dbd";
|
// addBaseLayerOption(
|
// "tianditu_cia_w (via WMTS)",
|
// new Cesium.WebMapTileServiceImageryProvider({
|
// url: tdtimganourl,
|
// layer: "tdtimganoLayer",
|
// style: "default",
|
// format: "image/jpeg",
|
// tileMatrixSetID: "GoogleMapsCompatible",
|
// subdomains: ["t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7"],
|
// minimumLevel: 0,
|
// maximumLevel: 18,
|
// show: false
|
// })
|
// );
|
|
//天地图矢量注记
|
var tdtvecanourl = "http://t2.tianditu.gov.cn/cva_w/wmts?service=wmts&request=GetTile"
|
+ "&version=1.0.0&LAYER=cva&tileMatrixSet=w&TileMatrix={TileMatrix}"
|
+ "&TileRow={TileRow}&TileCol={TileCol}&style=default&format=tiles"
|
+ "&tk={s}";
|
addAdditionalLayerOption(
|
"tianditu_cva_w (via WMTS)",
|
new Cesium.WebMapTileServiceImageryProvider({
|
url: tdtvecanourl,
|
layer: "tdtvecLayer",
|
style: "default",
|
format: "image/jpeg",
|
tileMatrixSetID: "GoogleMapsCompatible",
|
subdomains: ["6362bdd307661a127766fd953f6acb39", "f9aac4a93c9a8e2caf3af01a3fe043cd", "b57ae52ac923c3a7c97b5d307616cd8c", "b4c00ecdda3b76ca9762c5112c59f97b", "045c1c4953bdfd53cf916328b9c30dbf"],
|
minimumLevel: 0,
|
maximumLevel: 18
|
})
|
);
|
//无地形
|
viewModel.terrain.layers.push(new Cesium.EllipsoidTerrainProvider);
|
//cesium地形
|
viewModel.terrain.layers.push(new Cesium.createWorldTerrain);
|
|
|
}
|
|
function addBaseLayerOption(name, imageryProvider) {
|
var layer;
|
if (typeof imageryProvider === "undefined") {
|
layer = imageryLayers.get(0);
|
viewModel.selectedLayer = layer;
|
} else {
|
layer = new Cesium.ImageryLayer(imageryProvider);
|
}
|
|
layer.name = name;
|
baseLayers.push(layer);
|
}
|
|
function addAdditionalLayerOption(name, imageryProvider, alpha, show) {
|
var layer = imageryLayers.addImageryProvider(imageryProvider);
|
layer.alpha = Cesium.defaultValue(alpha, 0.5);
|
layer.show = Cesium.defaultValue(show, true);
|
layer.name = name;
|
Cesium.knockout.track(layer, ["alpha", "show", "name"]);
|
}
|
|
function updateLayerList() {
|
var numLayers = imageryLayers.length;
|
viewModel.layers.splice(0, viewModel.layers.length);
|
for (var i = numLayers - 1; i >= 0; --i) {
|
viewModel.layers.push(imageryLayers.get(i));
|
}
|
}
|
|
function changeBaseLayer(layerIndex) {
|
let baseLayer = viewModel.baseLayers[layerIndex];
|
var activeLayerIndex = 0;
|
var numLayers = viewModel.layers.length;
|
for (var i = 0; i < numLayers; ++i) {
|
if (viewModel.isSelectableLayer(viewModel.layers[i])) {
|
activeLayerIndex = i;
|
break;
|
}
|
}
|
var activeLayer = viewModel.layers[activeLayerIndex];
|
var show = activeLayer.show;
|
var alpha = activeLayer.alpha;
|
imageryLayers.remove(activeLayer, false);
|
imageryLayers.add(baseLayer, numLayers - activeLayerIndex - 1);
|
baseLayer.show = show;
|
baseLayer.alpha = alpha;
|
updateLayerList();
|
}
|
function changeBaseLayerAlpha(alpha) {
|
var activeLayerIndex = 0;
|
var numLayers = viewModel.layers.length;
|
for (var i = 0; i < numLayers; ++i) {
|
if (viewModel.isSelectableLayer(viewModel.layers[i])) {
|
activeLayerIndex = i;
|
break;
|
}
|
}
|
var activeLayer = viewModel.layers[activeLayerIndex];
|
activeLayer.alpha = alpha;
|
viewer.scene.globe.baseColor = new Cesium.Color(0, 0, 0, alpha);
|
if (viewModel.layers[0].show == true) {
|
viewModel.layers[0].alpha = alpha;
|
}
|
}
|
function changeTerrainLayer(terrainIndex) {
|
viewModel.terrain.selectedIndex = terrainIndex;
|
viewer.scene.terrainProvider = viewModel.terrain.layers[terrainIndex];
|
if (terrainIndex == 0) {
|
viewModel.terrain.show = false;
|
} else {
|
viewModel.terrain.show = true;
|
}
|
}
|
function changePlottingLayer(plottingIndex) {
|
if (plottingIndex == 0) {
|
viewModel.layers[0].show = false;
|
} else {
|
viewModel.layers[0].show = true;
|
}
|
|
}
|
//地球旋转 监听函数
|
function onTickCallback() {
|
var spinRate = 0.2;
|
var currentTime = viewer.clock.currentTime.secondsOfDay
|
var delta = (currentTime - previousTime) / 1000;
|
previousTime = currentTime;
|
viewer.scene.camera.rotate(Cesium.Cartesian3.UNIT_Z, -spinRate * delta);
|
}
|
|
|
//恢复初始位置
|
function wholeView() {
|
viewer.camera.setView({
|
destination: Cesium.Cartesian3.fromDegrees(initView.lon, initView.lat, initView.height),
|
orientation: {
|
heading: Cesium.Math.toRadians(initView.heading),
|
pitch: Cesium.Math.toRadians(initView.pitch),
|
roll: 0
|
}
|
});
|
}
|
|
function terrainshow(isload) {
|
isTerrainLoad = isload;
|
if (isload) {
|
viewer.scene.terrainProvider = new Cesium.createWorldTerrain();
|
} else {
|
viewer.scene.terrainProvider = new Cesium.EllipsoidTerrainProvider({});
|
}
|
}
|
|
function updateLabel(type,id,val){//修改文字:zzf
|
let signPointEntity = viewer.entities.getById(id)
|
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){//标签颜色
|
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){//文本内容
|
$("#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({
|
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 updatePoint(type,id,val){//修改点:zzf
|
let signPointEntity = viewer.entities.getById(id);
|
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){//标签颜色
|
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(4).join("/")
|
$("#" + popId).children(".bx-popup-content-ctn").children(".bx-popup-content").children(".image")[0].src = val;
|
saveData= {
|
"id":signPointEntity._id,
|
"type": "point",
|
"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,pick){//修改线:zzf
|
let attributes = pick.primitive.getGeometryInstanceAttributes( pick.id );
|
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",
|
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,
|
121.13358417325531, 40.87778995893177, -43.62271465916177 + 400.0,
|
121.07262600602428, 40.820901367044485, -33.2513254760909 + 400.0,
|
120.97271178718265, 40.76169810463469, -14.395497853994634 + 400.0,
|
121.03142813213663, 40.71351565275744, -63.12622197395102 + 400.0,
|
120.84618006737277, 40.67749108025032, 137.53714138386272 + 400.0,
|
120.75102060328265, 40.55001108545872, 168.52407476810413 + 400.0,
|
120.60691546827609, 40.461688492649856, 200.57798306418616 + 400.0,
|
120.58320856901436, 40.35590345652999, -12.160469833380958 + 400.0,
|
120.45398313736855, 40.20023794602732, 17.76488958570256 + 400.0,
|
120.30114125651484, 40.176402651026486, 15.234755101165417 + 400.0,
|
119.93023992906951, 40.04194209685554, -2.377500845836984 + 400.0,
|
119.58018063311704, 39.89646930060474, 100.36099978686795 + 400.0,
|
119.52575966661367, 39.837617378502244, -23.83295377408386 + 400.0,
|
119.5262420626757, 39.81040599032113, -33.848050420042405 + 400.0,
|
119.46358886808939, 39.80878082090084, 3.2947575467422356 + 400.0,
|
119.362071071831, 39.74024652693663, 139.8278897389387 + 400.0,
|
119.24773278185785, 39.482595803684255, -63.3445262547887 + 400.0,
|
119.29611517925443, 39.45033549564561, -61.1315973525283 + 400.0,
|
119.29857074510376, 39.418701618078636, -61.78959205257211 + 400.0,
|
119.27713293477858, 39.38956843897516, -63.531769402973126 + 400.0,
|
119.19727154170285, 39.366501853682024, -73.46975833606064 + 400.0,
|
118.92765436109067, 39.127786726945565, -141.26777959567522 + 400.0,
|
118.75721907837412, 39.1310487920426, -130.88112289576299 + 400.0,
|
118.6571783294847, 39.15527951850693, -152.27383605263032 + 400.0,
|
118.60493516553055, 39.1487872393577, -163.63476068747303 + 400.0,
|
118.50728075198982, 39.105030429835644, -182.8863944594101 + 400.0,
|
118.49926490954978, 39.07667014542786, -186.99392562913243 + 400.0,
|
118.48268393245597, 39.05975328177398, -188.91192108404266 + 400.0,
|
118.5560238937051, 38.96557618834858, -183.82442483493358 + 400.0,
|
118.53591272549431, 38.91563958484413, -178.37113592098743 + 400.0,
|
118.48356209549956, 38.92166921615294, -181.5275027833132 + 400.0,
|
118.4223512304676, 38.96631078916191, -186.49858828762808 + 400.0,
|
118.39822053949102, 39.04716251085236, -187.17802439137597 + 400.0,
|
118.33666477850629, 39.01862198784462, -180.90212304312902 + 400.0,
|
118.22570103138332, 39.041608782419594, -156.30532893485878 + 400.0,
|
118.15168931588518, 39.150262463145964, -116.7375416640365 + 400.0,
|
118.08501672188467, 39.19747091843397, -107.17145028693368 + 400.0,
|
118.00281463419033, 39.2192234092923, -124.92889556726077 + 400.0,
|
117.91234172944425, 39.210450980003614, -147.44759822363557 + 400.0,
|
117.8325324414431, 39.1857868101259, -165.2377556597161 + 400.0,
|
117.77829240799862, 39.122705534136344, -183.18460381162626 + 400.0,
|
117.73830471517876, 39.078966685053864, -189.12441446917921 + 400.0,
|
117.78708775940625, 39.05063872435911, -192.21079541958906 + 400.0,
|
117.8120025106994, 39.03954745876307, -191.57835125629768 + 400.0,
|
117.8214698705995, 38.97161259663837, -189.19669133435232 + 400.0,
|
117.89304950269093, 38.93658013317339, -177.8952359760245 + 400.0,
|
117.81349699518368, 38.92650371229712, -183.31621465661055 + 400.0,
|
117.804227863435, 38.90452530831098, -178.78230185789582 + 400.0,
|
117.74634594194339, 38.91083523161353, -180.4831168992914 + 400.0,
|
117.70447518120729, 38.88612200083761, -171.8962374935154 + 400.0,
|
117.68383270323142, 38.84447713832546, -157.16513272100966 + 400.0,
|
117.63384872664142, 38.84986892018357, -152.37797169820783 + 400.0,
|
117.59972230553755, 38.807566377744614, -129.7697971108455 + 400.0,
|
117.59177292679658, 38.777079717472, -114.7581662743791 + 400.0,
|
117.60975231408018, 38.74172883761469, -100.66711620140248 + 400.0,
|
117.6042243227447, 38.69428381688201, -71.67475196895452 + 400.0,
|
117.56549314879838, 38.67127666058021, -49.82212453911727 + 400.0,
|
117.53980396585962, 38.64685943920227, -58.738333278130455 + 400.0,
|
117.55346818279318, 38.61824384481488, -79.55507260375434 + 400.0,
|
117.59469285141213, 38.60966325001374, -94.71995754770613 + 400.0,
|
117.66246678409277, 38.449854687644375, -170.83687633915326 + 400.0,
|
117.75434936784944, 38.337530465051785, -193.79025899193564 + 400.0,
|
117.78487919532618, 38.34467954821293, -193.77400970555112 + 400.0,
|
117.83599428641016, 38.318225833175376, -192.67821716511128 + 400.0,
|
117.86573956114502, 38.33588977941331, -189.43275477735162 + 400.0,
|
117.89745416456539, 38.30525362904442, -185.5444849372529 + 400.0,
|
117.85093477655703, 38.28314353858037, -190.03311716656754 + 400.0,
|
117.88091895835335, 38.25152490947085, -183.82718003898626 + 400.0,
|
117.95721812542116, 38.21809905699221, -165.40546591914975 + 400.0,
|
117.98175764847362, 38.19240342500614, -154.1075986886799 + 400.0,
|
118.05531284810124, 38.173853376251515, -127.85680271143421 + 400.0,
|
118.03825054818681, 38.1380970314995, -121.72110716413403 + 400.0,
|
118.12508666526155, 38.149402993284795, -95.12468668824549 + 400.0,
|
118.49894379339118, 38.09635376168091, -147.52771387316088 + 400.0,
|
118.53829545597445, 38.052051971642626, -124.57305353350222 + 400.0,
|
118.59818054004101, 38.047183171872355, -114.83109828641902 + 400.0,
|
118.6021006328821, 38.08229020180686, -131.94037270808866 + 400.0,
|
118.62529679228133, 38.12142150907569, -144.48182921537938 + 400.0,
|
118.68053365859399, 38.13378891953011, -137.06415462149533 + 400.0,
|
118.69953535747207, 38.15038375095916, -138.04063584499647 + 400.0,
|
118.723925300308, 38.097316364948576, -111.01020622372774 + 400.0,
|
118.74825270573241, 38.0860855852777, -98.34144598782392 + 400.0,
|
118.77579210515361, 38.10585095435047, -97.2870893682754 + 400.0,
|
118.77461380870194, 38.14155167015766, -111.67616200148322 + 400.0,
|
118.84721972127984, 38.14758231167187, -101.3884553996771 + 400.0,
|
118.84914537721271, 38.11597172438371, -90.10053599986942 + 400.0,
|
118.88332251354937, 38.12860829582405, -108.07471339346787 + 400.0,
|
118.95964628385892, 38.098486465723994, -119.41703786839093 + 400.0,
|
118.94961419137817, 38.0599311028121, -98.51482386019393 + 400.0,
|
119.00397882465987, 37.95699539682019, -67.01788125197326 + 400.0,
|
119.09075067898243, 37.912766067861526, -107.6448312910317 + 400.0,
|
119.09495333029453, 37.83670845062415, -146.042079293607 + 400.0,
|
119.1651272279513, 37.802801478303614, -163.21396647937414 + 400.0,
|
119.18039204641883, 37.81353340289815, -159.38518238622805 + 400.0,
|
119.2200816340367, 37.827542603361174, -152.6106658896516 + 400.0,
|
119.28446743852487, 37.80479502448712, -155.43230629822727 + 400.0,
|
119.32520679371768, 37.78286015168845, -156.70980086035496 + 400.0,
|
119.28546068482184, 37.756281316815844, -167.77343385557697 + 400.0,
|
119.25450967685433, 37.74527693257305, -174.4013241592212 + 400.0,
|
119.26505136816847, 37.71690552428673, -179.4764576635973 + 400.0,
|
119.28433965227303, 37.666955916378136, -184.3494002610062 + 400.0,
|
119.26071273055267, 37.63840699331063, -189.4631441918002 + 400.0,
|
119.23072738281834, 37.675295758259786, -188.73306360785367 + 400.0,
|
119.18452200937789, 37.70988625797333, -185.38857006580014 + 400.0,
|
119.14886817020664, 37.716102933466814, -184.0479464941645 + 400.0,
|
119.11723919700765, 37.71558180485348, -182.22711847911393 + 400.0,
|
119.09001455137302, 37.71037080399641, -181.04394041281589 + 400.0,
|
119.05545401391517, 37.722693827111804, -174.40378492126194 + 400.0,
|
119.03371855727737, 37.67509665546245, -178.32089024460245 + 400.0,
|
118.97492050474746, 37.62548117835273, -169.22082034451617 + 400.0,
|
118.95546485495845, 37.59014194980782, -163.7107364763738 + 400.0,
|
118.9125695895925, 37.52617613788984, -143.2628989781653 + 400.0,
|
118.924712811743, 37.491418971717735, -140.09088009597903 + 400.0,
|
118.91634622563001, 37.429796018465574, -118.74162014028953 + 400.0,
|
118.93288162663065, 37.375776630435254, -101.01211117348667 + 400.0,
|
118.95852241218164, 37.31446457206669, -75.81664767063823 + 400.0,
|
118.93621665395317, 37.306581999809275, -65.0768370907181 + 400.0,
|
118.90988481136529, 37.305408333638454, -55.96429752210675 + 400.0,
|
118.92308012367624, 37.27680330039841, -42.32670115999732 + 400.0,
|
119.03895051691552, 37.26772813882383, -63.99181939977219 + 400.0,
|
119.1417232930183, 37.18702080084513, -105.7974657226554 + 400.0,
|
119.17481591184024, 37.15396527408179, -116.03812150156492 + 400.0,
|
119.2335903844454, 37.16173365892664, -111.9147381078104 + 400.0,
|
119.26677321596739, 37.157858598128364, -109.76340143280179 + 400.0,
|
119.27203377098358, 37.13218373732648, -115.20677478835316 + 400.0,
|
119.46154900619513, 37.1141362110754, -86.9962423656456 + 400.0,
|
119.52689806178383, 37.12935941089349, -65.74640871653996 + 400.0,
|
119.73924534885448, 37.122830938614015, 159.44659546638536 + 400.0,
|
119.74346894201096, 37.14526722665387, 154.41148021473842 + 400.0,
|
119.87792283916646, 37.235331108850666, 95.14095160710163 + 400.0,
|
119.8948044856286, 37.29585869183408, -48.03809930945527 + 400.0,
|
119.86607162115625, 37.33692772181289, -80.94771312425952 + 400.0,
|
119.82401633804332, 37.33576765771906, -84.03703052734434 + 400.0,
|
119.83418281970953, 37.36167137294214, -100.19998411997288 + 400.0,
|
119.8296246794181, 37.378923545060886, -111.15672269887699 + 400.0,
|
119.93031291131001, 37.38547821148024, -101.4600113482893 + 400.0,
|
119.93874026271409, 37.41577305735728, -116.8269112999344 + 400.0,
|
120.0073359570385, 37.421526867502, -103.15571268506977 + 400.0,
|
120.08396247727887, 37.45180228298951, -92.09119987030522 + 400.0,
|
120.18435924952115, 37.49581990053549, -66.02481839087248 + 400.0,
|
120.25095547379883, 37.554414796634376, -4.756199271761516 + 400.0,
|
120.30733531722936, 37.60162883010204, 156.0386805467206 + 400.0,
|
120.31002899722235, 37.62846476936245, 160.61016170943813 + 400.0,
|
120.2973809057535, 37.657250834206856, 119.73247121991459 + 400.0,
|
120.24599366334225, 37.663995963841884, -35.83350495970069 + 400.0,
|
120.21685333176488, 37.67600889278608, -83.26143006715694 + 400.0,
|
120.23507673574292, 37.68838847680541, -68.80490239721671 + 400.0,
|
120.35717922660479, 37.694040324082245, 72.63081922767326 + 400.0,
|
120.44855555791338, 37.7480593138441, 35.97777616942618 + 400.0,
|
120.60051303530868, 37.75955142584298, 77.82535744794028 + 400.0,
|
120.63054555053832, 37.793629516138076, 129.86531687454223 + 400.0,
|
120.73710897749278, 37.82927096890569, 244.7979638847179 + 400.0,
|
120.89382121573293, 37.822989789837536, 161.4097824553205 + 400.0,
|
120.94420808216208, 37.808435944085986, 88.09132966761398 + 400.0,
|
120.94694202631482, 37.77469147924223, 109.59191497200683 + 400.0,
|
121.00802182904928, 37.73582540561781, 21.77498270151893 + 400.0,
|
121.04270459338714, 37.71063979249828, -10.80261275141071 + 400.0,
|
121.13632404197865, 37.717913806135854, -35.551418893927305 + 400.0,
|
121.13193981971114, 37.66826300833963, -16.664912356388452 + 400.0,
|
121.19418291530307, 37.59567290225652, 3.0257983546169727 + 400.0,
|
121.26970093798654, 37.57785220333365, 1.0064297049652426 + 400.0,
|
121.35205855218096, 37.59470559918749, -10.61145784325734 + 400.0,
|
121.34265777802335, 37.62729772845283, -24.17201895883058 + 400.0,
|
121.39588888188024, 37.61639393822708, -18.532013977517014 + 400.0,
|
121.4382558270451, 37.59231749334859, 125.45750523883571 + 400.0,
|
121.3954315376103, 37.5871355098691, -5.81993276947452 + 400.0,
|
121.41735668295968, 37.54061622073384, 216.8024987666903 + 400.0,
|
121.48587263676663, 37.47079844894649, 25.444293548613736 + 400.0,
|
121.59348246832207, 37.45983756324493, 57.79128025131115 + 400.0,
|
121.61990776042167, 37.48786015916363, 49.13870003233284 + 400.0,
|
121.65082656331249, 37.47049397767047, 56.322910930347156 + 400.0,
|
121.7519583680262, 37.45346379967689, 31.5696558832817 + 400.0,
|
121.8792198111753, 37.46426217044691, 40.09628152692961 + 400.0,
|
121.97409122496411, 37.48093633138826, 211.78031765414045 + 400.0,
|
121.99277046604982, 37.491216103696864, 249.04136947718615 + 400.0,
|
122.02216442415872, 37.52051080494466, 312.1582382073677 + 400.0,
|
122.04014206816689, 37.53930003231843, 232.51006187482827 + 400.0,
|
122.09141233612532, 37.56057128772083, 6.598959592779854 + 400.0,
|
122.15183184565556, 37.550957897915076, 10.18561733058678 + 400.0,
|
122.17711354925758, 37.51888848203871, 11.55045710289997 + 400.0,
|
122.14710106385444, 37.47496006699769, 38.16266136838794 + 400.0,
|
122.16426402458131, 37.442353538057745, 46.769557718215786 + 400.0,
|
122.18479551025482, 37.44453532616741, 39.07054357642158 + 400.0,
|
122.20329465551428, 37.46130882293593, 26.013436364253828 + 400.0,
|
122.24499778610594, 37.45614353044535, 18.00732888371023 + 400.0,
|
122.28821459196378, 37.433253228624885, 20.03863516648536 + 400.0,
|
122.34918834025419, 37.41169026047726, 22.273923845968806 + 400.0,
|
122.45340470730136, 37.41864790625754, 88.36138156449495 + 400.0,
|
122.4817023765648, 37.43360210734035, 113.38988750891248 + 400.0,
|
122.51264639514847, 37.39931750056698, 164.34094733309843 + 400.0,
|
122.58844431549608, 37.41256603782498, 250.1630987882699 + 400.0,
|
122.68010332826299, 37.41903662467961, 210.8307668379143 + 400.0,
|
122.68781243329906, 37.37589012949744, 202.77280100219733 + 400.0,
|
122.6394291688878, 37.383265615329776, 228.07353901214626 + 400.0,
|
122.58839051759159, 37.352628455401515, 193.91251907467608 + 400.0,
|
122.57574865956424, 37.30927020496591, 129.7129179946389 + 400.0,
|
122.57271496309797, 37.25407786737189, 63.701532315500195 + 400.0,
|
122.62220965988283, 37.19631549655751, 28.437768390480905 + 400.0,
|
122.57037660545764, 37.18233742456559, 33.00928248294979 + 400.0,
|
122.5063945125697, 37.15578395280424, 39.71676126832991 + 400.0,
|
122.46726950996842, 37.11599938073374, 38.77971413477708 + 400.0,
|
122.45906411867459, 37.061289561248266, 27.569926999378985 + 400.0,
|
122.47394099541059, 37.03114068767336, 16.323730226567715 + 400.0,
|
122.54884351046573, 37.04182781901952, -5.3543605236843606 + 400.0,
|
122.5146294722355, 36.912945615116904, 150.96914826204963 + 400.0,
|
125.05018552149532, 37.89522044246678, 28.801101798890816 + 400.0,
|
124.96153447377395, 37.96538968581498, 91.28003310598615 + 400.0,
|
125.1143392447733, 38.00039473960644, 84.64807212347958 + 400.0,
|
125.13722485233009, 38.076194718299945, 133.21080533159218 + 400.0,
|
124.93599973724153, 38.10971447706802, 194.6569715535294 + 400.0,
|
124.63672925109022, 38.127932080132716, 106.00838572315102 + 400.0,
|
124.84191841181077, 38.209023307532284, 219.74515257847898 + 400.0,
|
124.84436022399106, 38.340109599141385, 193.28613887428529 + 400.0,
|
125.00179424016495, 38.53084753931604, 248.19772145931955 + 400.0,
|
124.96947875820054, 38.08753079725462, 61.969802973951374 + 400.0,
|
124.71032413629429, 38.107342044773894, -36.1476464930114 + 400.0,
|
124.84331587234574, 38.23078228026078, 193.44198667854045 + 400.0,
|
124.98584264095358, 38.536822120831765, 527.5491876915618 + 400.0,
|
125.177950209313, 38.67447632982194, 637.2818221040856 + 400.0,
|
125.20923848802391, 38.76513058879748, 539.8061436224988 + 400.0,
|
125.12052789725348, 38.80534771856987, 415.25337265308553 + 400.0,
|
125.37081755686216, 39.26539843237271, 192.8841655428996 + 400.0,
|
125.33927529185125, 39.47532384961518, 216.81219898455421 + 400.0,
|
125.14160121389784, 39.5775998292618, 232.00857730463449 + 400.0,
|
124.8742494671013, 39.67425583268487, 183.66438151387317 + 400.0,
|
124.74617148470223, 39.743315039499684, 223.7624130855891 + 400.0,
|
124.63777193583437, 39.60024218587562, 8.608969980819674 + 400.0,
|
124.49514967316519, 39.79502691029884, 250.58541332360227 + 400.0,
|
124.25453583393329, 39.88866426556459, 247.54879037213166 + 400.0,
|
123.92528269302129, 39.81056629928931, 127.58089187045226 + 400.0,
|
123.62093251310343, 39.81317355510083, 179.0362821824385 + 400.0,
|
123.27476770360094, 39.71388780306293, 319.1939099786307 + 400.0,
|
122.82141070871076, 39.58495106153884, 101.96159392213575 + 400.0,
|
122.51672068274277, 39.415944376351355, -9.75528089104557 + 400.0,
|
122.3559505680604, 39.387826909076935, 69.25537122040873 + 400.0,
|
122.13092363382918, 39.196990221931976, 169.53889447399783 + 400.0,
|
121.99068765165028, 39.04882837197782, 280.98114779938345 + 400.0,
|
121.85198461433693, 38.91601756553401, 410.1136018031389 + 400.0,
|
121.59564402518203, 38.86601071807152, 165.57414581668618 + 400.0,
|
121.38987551934373, 38.79982600901461, -177.0300012075179 + 400.0,
|
121.24787447303156, 38.76958956280892, -369.39015941838585 + 400.0,
|
121.22266581996763, 38.72016896773491, -426.0794128981166 + 400.0,
|
121.10168762541362, 38.712460361435724, -555.3350317997924 + 400.0,
|
121.08807936149122, 38.910336386938205, -429.6722989440857 + 400.0,
|
121.1601334881703, 38.95736213435766, -314.57271833294425 + 400.0,
|
121.2934160731399, 38.96420762660936, -159.28780089141395 + 400.0,
|
121.35572533036468, 39.05444490167481, 14.121010367328314 + 400.0,
|
121.42235149016408, 39.02509393819919, 67.47123248796159 + 400.0,
|
121.65163894138001, 39.071912975012374, 459.4500592391002 + 400.0,
|
121.64533127073709, 39.154041267360306, 503.29012638929885 + 400.0,
|
121.58239975488166, 39.17568471828466, 430.69651666661593 + 400.0,
|
121.58801194066397, 39.234659723571134, 234.8952280705066 + 400.0,
|
121.61476578092173, 39.286639986260454, 66.9109959610493 + 400.0,
|
121.70011183707871, 39.29137482634892, 54.21050820342146 + 400.0,
|
121.69804114618888, 39.36741907578201, -179.8837836451365 + 400.0,
|
121.62755405720586, 39.343681098300834, -109.93824975385957 + 400.0,
|
121.49071428330808, 39.31542792238775, -10.81761926263547 + 400.0,
|
121.45089787261406, 39.417541033164916, -247.7965027172474 + 400.0,
|
121.35511252112813, 39.34126229267119, -57.40494527820382 + 400.0,
|
121.24498819354814, 39.38540218510854, -137.63764854451 + 400.0,
|
121.27635771422955, 39.44938096694836, -232.32780585046805 + 400.0,
|
121.30635452243621, 39.50669817898565, 40.957667391854415 + 400.0,
|
121.20988049334024, 39.529469297128216, -4.743605759939077 + 400.0,
|
121.2782368689786, 39.60942760094416, -4.293674294761471 + 400.0,
|
121.43729244427433, 39.62278892705241, 70.68793694905112 + 400.0,
|
121.49665875758211, 39.66705392204636, 99.96832993477658 + 400.0,
|
121.4857223026958, 39.72300541521384, 89.76069975473806 + 400.0,
|
121.4623547542943, 39.74127521595411, 75.51457770557853 + 400.0,
|
121.47959393112282, 39.81519799910108, 21.22851488073437 + 400.0,
|
121.54690490864115, 39.86597354219506, -20.317053428576212 + 400.0,
|
121.63658961509992, 39.90269788316491, -39.45954186888656 + 400.0,
|
121.70294214878894, 39.933579740935606, -48.366188888979416 + 400.0,
|
121.79015151097872, 39.93964884804353, -27.901728005827962 + 400.0,
|
121.8421601350922, 40.005059565872834, -47.43099782008147 + 400.0,
|
121.8113032119517, 40.026554375327066, -69.37077538419247 + 400.0,
|
121.94181205894233, 40.11047546588103, -70.01559128050057 + 400.0,
|
122.01415216533157, 40.15359046944995, -71.53467089996346 + 400.0,
|
121.99525254963969, 40.19777248927075, -110.04913328542152 + 400.0,
|
122.08184900030787, 40.22856270609023, -90.18942285195881 + 400.0,
|
122.08803140272755, 40.318304257468974, -133.25152839269748 + 400.0,
|
122.15398925306758, 40.33411837970585, -103.81020534532645 + 400.0,
|
122.26478454511137, 40.467828403237824, -58.615883581432406 + 400.0,
|
122.21235207610904, 40.55753454703981, -107.9360757677535 + 400.0,
|
122.1445320535742, 40.60492230185775, -144.89533407595303 + 400.0,
|
122.1591679852362, 40.6641320695014, -125.61432649126844 + 400.0,
|
122.06894961469816, 40.646965639799845, -177.11277316839747 + 400.0,
|
122.00793856381004, 40.7000376937851, -190.17540253786936 + 400.0,
|
122.0280274974156, 40.737506953889906, -168.0587434269832 + 400.0,
|
121.9206045960016, 40.814998422830406, -197.63351675508724 + 400.0,
|
121.86402627231718, 40.80994383919572, -211.54006447931735 + 400.0,
|
121.83186740276552, 40.93992393375571, -238.9740840351451 + 400.0,
|
121.71584571854669, 40.84436096342466, -244.68680465185238 + 400.0,
|
121.6690071993432, 40.84004335312588, -246.32952891260715 + 400.0];
|
new PrimitiveWaterFace({ 'viewer': viewer, 'normalMapUrl': '../assets/images/ocean/waterNormals.png', 'DegreesArrayHeights': waterFace });
|
/*var waterPrimitive = new Cesium.Primitive({
|
show:true,// 默认隐藏
|
allowPicking:false,
|
geometryInstances : new Cesium.GeometryInstance({
|
geometry : new Cesium.PolygonGeometry({
|
polygonHierarchy : new Cesium.PolygonHierarchy(Cesium.Cartesian3.fromDegreesArrayHeights(waterFace)),
|
//extrudedHeight: 0,//注释掉此属性可以只显示水面
|
perPositionHeight : true//注释掉此属性水面就贴地了
|
})
|
}),
|
// 可以设置内置的水面shader
|
appearance : new Cesium.EllipsoidSurfaceAppearance({
|
material : new Cesium.Material({
|
fabric : {
|
type : 'Water',
|
uniforms : {
|
//baseWaterColor:new Cesium.Color(0.0, 0.0, 1.0, 0.5),
|
//blendColor: new Cesium.Color(0.0, 0.0, 1.0, 0.5),
|
//specularMap: 'gray.jpg',
|
normalMap: '../assets/images/ocean/waterNormals.png',
|
frequency: 1000.0,
|
animationSpeed: 0.01,
|
amplitude: 10.0
|
}
|
}
|
}),
|
fragmentShaderSource:'varying vec3 v_positionMC;\nvarying vec3 v_positionEC;\nvarying vec2 v_st;\nvoid main()\n{\nczm_materialInput materialInput;\nvec3 normalEC = normalize(czm_normal3D * czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0)));\n#ifdef FACE_FORWARD\nnormalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n#endif\nmaterialInput.s = v_st.s;\nmaterialInput.st = v_st;\nmaterialInput.str = vec3(v_st, 0.0);\nmaterialInput.normalEC = normalEC;\nmaterialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(v_positionMC, materialInput.normalEC);\nvec3 positionToEyeEC = -v_positionEC;\nmaterialInput.positionToEyeEC = positionToEyeEC;\nczm_material material = czm_getMaterial(materialInput);\n#ifdef FLAT\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#else\ngl_FragColor = czm_phong(normalize(positionToEyeEC), material);\
|
gl_FragColor.a=0.5;\n#endif\n}\n'//重写shader,修改水面的透明度
|
})
|
});
|
viewer.scene.primitives.add(waterPrimitive);*/
|
}
|
|
function initDrawEntity(){//zzf:初始化图形
|
|
let token = window.localStorage.getItem("token");
|
$.ajax({
|
type: "get",
|
async: false,
|
url: parent.httpConfig.webApiUrl + "landstamp/front/getDrawEntity",
|
contentType: "application/json;charset=utf-8",
|
beforeSend:function(request){
|
request.setRequestHeader("token",token);
|
},
|
success: function (data) {
|
if(data.rows!=null){
|
for(let i=0;i<data.rows.length;i++){
|
if(data.rows[i].type=="point"){
|
drawAjaxPoint(data.rows[i])
|
}
|
else if(data.rows[i].type=="polyline"){
|
drawAjaxPolyline(data.rows[i])
|
}
|
else if(data.rows[i].type=="polygon"){
|
drawAjaxPolygon(data.rows[i])
|
}
|
else if(data.rows[i].type=="label"){
|
drawAjaxLabel(data.rows[i])
|
}
|
}
|
}
|
},
|
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
console.log("ajax请求失败!");
|
}
|
});
|
}
|
|
function drawAjaxPoint(drawEntity){//加载点
|
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: {
|
text: drawEntity.content,
|
font: drawEntity.fontsize+'px '+drawEntity.fontstyle,
|
fillColor: Cesium.Color.fromCssColorString(drawEntity.color),
|
outlineColor: Cesium.Color.BLACK,
|
outlineWidth: 2,
|
style: Cesium.LabelStyle.FILL_AND_OUTLINE,
|
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: 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: new Cesium.DistanceDisplayCondition(0, 10000000000000.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,
|
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;
|
}
|
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 drawAjaxPolyline(drawEntity){//加载线
|
var measureLinePositonsArray = [];//存储已量测的线段的折点
|
let longitudeList=drawEntity.longitude.split(",");
|
let latitudeList=drawEntity.latitude.split(",");
|
let heightList=drawEntity.height.split(",");
|
//点坐标
|
for(let i=0;i<longitudeList.length;i++){
|
let cartesian = Cesium.Cartesian3.fromDegrees(longitudeList[i], latitudeList[i], heightList[i]);
|
measureLinePositonsArray.push(cartesian);
|
}
|
var drawpointArr = [];
|
var measureLineGroundEntity = viewer.entities.add({
|
id:drawEntity.id,
|
name: 'measureLineGroundEntity',
|
polyline: {
|
clampToGround: true,
|
width: drawEntity.fontsize?drawEntity.fontsize:1,
|
material: drawEntity.color?Cesium.Color.fromCssColorString(drawEntity.color):new Cesium.Color.fromBytes(255,124,0,255),
|
positions:measureLinePositonsArray
|
},
|
drawpointArr: drawpointArr,
|
measureLinePositonsArray: measureLinePositonsArray
|
});
|
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,
|
"field": "Entity",
|
"checked": true,
|
"spread": true,
|
"children": [],
|
"ext": {
|
// "lng": Cesium.Math.toDegrees(cartographic.longitude),
|
// "lat": Cesium.Math.toDegrees(cartographic.latitude)
|
}
|
}, "4");
|
}
|
|
function drawAjaxPolygon(drawEntity){//加载面
|
var polyPositions = [];//存储多边形的点
|
let longitudeList=drawEntity.longitude.split(",");
|
let latitudeList=drawEntity.latitude.split(",");
|
let heightList=drawEntity.height.split(",");
|
//点坐标
|
for(let i=0;i<longitudeList.length;i++){
|
let cartesian = Cesium.Cartesian3.fromDegrees(longitudeList[i],latitudeList[i], heightList[i]);
|
polyPositions.push(cartesian);
|
}
|
var polygon = new Cesium.PolygonHierarchy();
|
polygon.positions=polyPositions;
|
var polyCenter = Cesium.BoundingSphere.fromPoints(polyPositions).center;
|
polyCenter = Cesium.Ellipsoid.WGS84.scaleToGeodeticSurface(polyCenter);
|
let cartographic = Cesium.Cartographic.fromCartesian(polyCenter, viewer.scene.globe.ellipsoid, new Cesium.Cartographic());
|
var measurePolyGonGroundEntity = viewer.entities.add({
|
id:drawEntity.id,
|
name: 'measurePolyGonGroundEntity',
|
polygon: {
|
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)
|
}
|
});
|
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,
|
"field": "Entity",
|
"checked": true,
|
"spread": true,
|
"children": [],
|
"ext": {
|
"lng": Cesium.Math.toDegrees(cartographic.longitude),
|
"lat": Cesium.Math.toDegrees(cartographic.latitude)
|
}
|
}, "4");
|
}
|
|
function drawAjaxLabel(drawEntity){//加载文字
|
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:"drawLabelEntity",
|
position:cartesian,
|
label: {
|
text: drawEntity.content,
|
font: drawEntity.fontsize+'px '+drawEntity.fontstyle,
|
fillColor: Cesium.Color.fromCssColorString(drawEntity.color),
|
outlineColor: Cesium.Color.BLACK,
|
outlineWidth: 2,
|
style: Cesium.LabelStyle.FILL_AND_OUTLINE,
|
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: 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: new Cesium.DistanceDisplayCondition(0, 10000000000000.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,
|
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");
|
}
|