From 9f9ae3e0253f2d657b6b337d62d269394d04ee09 Mon Sep 17 00:00:00 2001 From: surprise <15810472099@163.com> Date: 星期五, 17 十一月 2023 14:29:08 +0800 Subject: [PATCH] 版本更新 --- src/assets/js/Map/temporaryTools.js | 42 +++++++++++++++++++++++++++++++++++------- 1 files changed, 35 insertions(+), 7 deletions(-) diff --git a/src/assets/js/Map/temporaryTools.js b/src/assets/js/Map/temporaryTools.js index 77aaa7f..007dc31 100644 --- a/src/assets/js/Map/temporaryTools.js +++ b/src/assets/js/Map/temporaryTools.js @@ -10,6 +10,29 @@ } } }, + removeTemporaryLayerAll() { + var entities = window.Viewer.entities._entities._array; + for (var i = 0; i < entities.length; i++) { + if (entities[i]._shpType && entities[i]._shpType == "temporaryLayer") { + window.Viewer.entities.remove(entities[i]) + i--; + } + } + }, + locationTemporaryLayer(res) { + var entities = window.Viewer.entities._entities._array; + for (var i in entities) { + if (entities[i].id == res.id && entities[i]._shpType == res.shpType) { + window.Viewer.flyTo(entities[i], { + offset: { + heading: Cesium.Math.toRadians(0.0), + pitch: Cesium.Math.toRadians(-90), + range: 400 + } + }); + } + } + }, addTemporaryTool(res) { switch (res.type) { case "point": @@ -37,7 +60,7 @@ heightReference = Number.POSITIVE_INFINITY; } var style; - if (res.style) { + if (res.outline) { style = Cesium.LabelStyle.FILL_AND_OUTLINE } else { style = Cesium.LabelStyle.FILL @@ -70,7 +93,7 @@ res.outlineColor ).withAlpha(res.outlineAlpha), - outlineWidth: res.outlineWidth, + outlineWidth: res.width, scale: res.scale, style: style, horizontalOrigin: Cesium.HorizontalOrigin.CENTER,//瀵归綈鏂瑰紡 @@ -129,31 +152,36 @@ res.near, res.far ), - outline: true, + outline: false, outlineWidth: res.width, + outlineColor: Cesium.Color.fromCssColorString( res.outlineColor ).withAlpha(res.outlineAlpha), + heightReference: Cesium.HeightReference.CLAMP_TO_GROUND, }, }); }, addTemporaryPolylineLayer(res) { var outlinewidth = 0 if (res.outline) { - outlinewidth = res.outlineWidth + outlinewidth = res.width } window.Viewer.entities.add({ name: res.cnName, id: res.id, shpType: res.shpType, + outline: res.outline, polyline: { + outline: res.outline, positions: Cesium.Cartesian3.fromDegreesArray(res.geometry), width: res.width, distanceDisplayCondition: new Cesium.DistanceDisplayCondition( res.near, res.far ), + material: new Cesium.PolylineOutlineMaterialProperty({ color: Cesium.Color.fromCssColorString(res.material).withAlpha( res.materialAlpha @@ -260,6 +288,7 @@ var coord = this.setCartesianToEightFour(val[i]) geom.push(coord.lng, coord.lat) } + return { id: this.isedit ? res.id : (new Date()).getTime(), cnName: res.name, @@ -273,7 +302,7 @@ type: 'polygon', shpType: 'temporaryLayer', layerType: '澶氳竟褰�', - outline: res.outline != null ? res.outline : false, + outline: res.polygon.outline != null ? res.polygon.outline._value : false, width: res.polygon.outlineWidth ? res.polygon.outlineWidth._value : 1, } }, @@ -358,7 +387,6 @@ if (res.label.outlineWidth && res.label.outlineWidth._value) { width = res.label.outlineWidth._value } - return { id: this.isedit ? res.id : (new Date()).getTime(), cnName: res.name, @@ -383,7 +411,6 @@ layerType: '鏂囨湰鐐�', } }, - getPointEntityObj(res) { var mataColor = res.point.color._value; var outlineColor = res.point.outlineColor._value; @@ -405,6 +432,7 @@ layerType: '鍩烘湰鐐�', heightReference: res.point.disableDepthTestDistance != null ? false : true, size: res.point.pixelSize._value, + } }, -- Gitblit v1.9.3