| | |
| | | * @Author: shuishen 1109946754@qq.com |
| | | * @Date: 2022-08-18 17:00:30 |
| | | * @LastEditors: shuishen 1109946754@qq.com |
| | | * @LastEditTime: 2023-04-12 17:19:40 |
| | | * @LastEditTime: 2023-04-15 17:15:38 |
| | | * @FilePath: \srs-police-affairs\src\components\map\index.vue |
| | | * @Description: 公用地图组件 |
| | | * |
| | |
| | | |
| | | <script> |
| | | let tile3DUrl = '' |
| | | let floorEntitysLayers = null |
| | | let flootEntitysEntites = null |
| | | |
| | | if (process.env.NODE_ENV == 'development') { |
| | | // 开发 |
| | |
| | | sdTilesetLayer: null |
| | | } |
| | | |
| | | let curPolygon = null |
| | | |
| | | const ysLabels = [ |
| | | 'EPSG:4490_test:0', |
| | |
| | | // let curTilesetLayer = new global.DC.TilesetLayer('curTilesetLayer') |
| | | // global.viewer.addLayer(curTilesetLayer) |
| | | // let curTileset = new global.DC.Tileset( |
| | | // // '/mx/tileset.json' |
| | | // 'https://tuan-gis.sit.fengtu.com.cn/361102/wanda/tileset.json' |
| | | // '/mx/tileset.json' |
| | | // ) |
| | | // // curTileset.setHeight(20) |
| | | // curTileset.setHeight(0) |
| | |
| | | global.viewer.addLayer(layersObjcect.monitoringLayer) |
| | | layersObjcect.panoramaLayer = new global.DC.VectorLayer('panoramaLayer') |
| | | global.viewer.addLayer(layersObjcect.panoramaLayer) |
| | | |
| | | floorEntitysLayers = new global.DC.VectorLayer('floorEntitysLayers') |
| | | global.viewer.addLayer(floorEntitysLayers) |
| | | |
| | | // 模型图层添加 |
| | | tilesetLayer = new global.DC.TilesetLayer('tilesetLayer') |
| | |
| | | |
| | | this.$EventBus.$on('layerPolygonAdd', (params) => { |
| | | if ('polygonName' in params) { |
| | | that.layerPolygonAdd(params.layerName, params.positions, params.material, params.distanceDisplayCondition, params.polygonName, params.params, params.incident, params.setStyle) |
| | | that.layerPolygonAdd(params.layerName, params.positions, params.material, params.distanceDisplayCondition, params.polygonName, params.params, params.incident, params.mouseOverIncident, params.mouseOutIncident, params.setStyle) |
| | | } else { |
| | | that.layerPolygonAdd(params.layerName, params.positions, params.material, params.distanceDisplayCondition, 'polygon', params.params, params.incident, params.setStyle) |
| | | that.layerPolygonAdd(params.layerName, params.positions, params.material, params.distanceDisplayCondition, 'polygon', params.params, params.incident, params.mouseOverIncident, params.mouseOutIncident, params.setStyle) |
| | | } |
| | | }) |
| | | |
| | |
| | | |
| | | if (this.tilesetLayerType == type && status == '') { |
| | | this.tilesetLayerType = '' |
| | | |
| | | |
| | | } else { |
| | | this.tilesetLayerType = type |
| | |
| | | * @param {*} material 颜色 |
| | | * @param {*} distanceDisplayCondition 可见距离 |
| | | */ |
| | | layerPolygonAdd (layerName, positions, material, distanceDisplayCondition, polygonName, params, incident = (e) => { }, setStyle = {}) { |
| | | layerPolygonAdd (layerName, positions, material, distanceDisplayCondition, polygonName, params, incident = (e) => { }, mouseOverIncident = (e) => { }, |
| | | mouseOutIncident = (e) => { }, setStyle = {}) { |
| | | if (!layersObjcect[layerName] || layersObjcect[layerName] == null) { |
| | | this.mapAddLayer(layerName, 'VectorLayer') |
| | | |
| | |
| | | // layersObjcect[layerName].addOverlay(polygon) |
| | | polygonObj[polygonName].attrParams = params |
| | | polygonObj[polygonName].on(global.DC.MouseEventType.CLICK, incident) |
| | | polygonObj[polygonName].on(global.DC.MouseEventType.MOUSE_OVER, mouseOverIncident) |
| | | polygonObj[polygonName].on(global.DC.MouseEventType.MOUSE_OUT, mouseOutIncident) |
| | | layersObjcect[layerName].addOverlay(polygonObj[polygonName]) |
| | | }, |
| | | |
| | |
| | | * @param {*} |
| | | */ |
| | | showThreeDimensions (positions, minHeight, maxHeight) { |
| | | if (floorEntitysLayers != null) { |
| | | floorEntitysLayers.remove() |
| | | floorEntitysLayers = new global.DC.VectorLayer('floorEntitysLayers') |
| | | global.viewer.addLayer(floorEntitysLayers) |
| | | if (curPolygon != null) { |
| | | global.viewer.scene.primitives.remove(curPolygon) |
| | | curPolygon = null |
| | | } |
| | | |
| | | floorEntitysLayers.clear() |
| | | |
| | | let housePositions = JSON.parse(positions).coordinates[0] |
| | | |
| | | let floorPositions = housePositions.reduce((prev, curr) => { |
| | | prev.push([curr[0], curr[1]]) |
| | | prev.push(curr[0]) |
| | | prev.push(curr[1]) |
| | | |
| | | return prev |
| | | }, []) |
| | | |
| | | let polygonStr = floorPositions.join(';') |
| | | curPolygon = new global.DC.Namespace.Cesium.ClassificationPrimitive({ |
| | | geometryInstances: new global.DC.Namespace.Cesium.GeometryInstance({ |
| | | geometry: new global.DC.Namespace.Cesium.PolygonGeometry({ |
| | | polygonHierarchy: new global.DC.Namespace.Cesium.PolygonHierarchy( |
| | | global.DC.Namespace.Cesium.Cartesian3.fromDegreesArray(floorPositions), |
| | | ), |
| | | extrudedHeight: maxHeight,//分层顶部海拔 |
| | | height: minHeight,//分层底部海拔 |
| | | }), |
| | | |
| | | let polygon = new global.DC.Polygon(polygonStr) |
| | | attributes: { |
| | | color: global.DC.Namespace.Cesium.ColorGeometryInstanceAttribute.fromColor(global.DC.Namespace.Cesium.Color.RED.withAlpha(0.5)), |
| | | show: new global.DC.Namespace.Cesium.ShowGeometryInstanceAttribute(true) |
| | | }, |
| | | }), |
| | | |
| | | polygon.setStyle({ |
| | | material: global.DC.Namespace.Cesium.Color.RED.withAlpha(0.5), |
| | | extrudedHeight: maxHeight, |
| | | height: minHeight, |
| | | extrudedHeightReference: global.DC.Namespace.Cesium.HeightReference.RELATIVE_TO_GROUND, |
| | | heightReference: global.DC.Namespace.Cesium.HeightReference.RELATIVE_TO_GROUND |
| | | classificationType: global.DC.Namespace.Cesium.ClassificationType.CESIUM_3D_TILE |
| | | }) |
| | | |
| | | floorEntitysLayers.addOverlay(polygon) |
| | | |
| | | floorEntitysLayers.show = true |
| | | global.viewer.scene.primitives.add(curPolygon) |
| | | }, |
| | | |
| | | // 清除建筑3D |
| | | clearHouse3D () { |
| | | floorEntitysLayers.clear() |
| | | global.viewer.scene.primitives.remove(curPolygon) |
| | | |
| | | curPolygon = null |
| | | }, |
| | | |
| | | registerMxClick (event) { |