| | |
| | | const outlineGJson = await getOutLine(jsonPathPre, hierarchy) |
| | | scalingJudgment.forEach(item => item.show && (item.outline = outlineGJson)) |
| | | const [longitude, latitude] = outlineGJson.features[0].properties.centroid |
| | | flyTo({ longitude, latitude }, 0, scalingJudgment[(hierarchy.length - 3) * (-1)].height) |
| | | const height = scalingJudgment[(hierarchy.length - 3) * (-1)].height |
| | | setCenterPosition({longitude, latitude,height}) |
| | | flyTo({ longitude, latitude }, 0, height) |
| | | } |
| | | |
| | | const userAreaPosition = computed(() => store.state.home.userAreaPosition); |
| | | |
| | | const setCenterPosition = (position) => { |
| | | store.commit('setCurrentAreaPosition', position) |
| | | if (!userAreaPosition.value.longitude){ |
| | | store.commit('setUserAreaPosition', position) |
| | | } |
| | | } |
| | | |
| | | |
| | | let needFly = true |
| | | |
| | | watch( |
| | | selectedAreaCode, |
| | | async (newValue, oldValue) => { |
| | | needFly = true |
| | | if (!viewer) return |
| | | viewer.scene.postRender.removeEventListener(determineScaling) |
| | | initMapData(newValue).then(() => { |
| | |
| | | // 渲染轮廓 |
| | | const renderOutline = item => { |
| | | item.outline && |
| | | Cesium.GeoJsonDataSource.load(item.outline).then(dataSource => { |
| | | viewer.dataSources.add(dataSource) |
| | | const entities = dataSource.entities.values |
| | | entities.forEach(entity => { |
| | | // 隐藏多边形填充 |
| | | entity.polygon.material = Cesium.Color.TRANSPARENT |
| | | entity.polygon.outline = false // 关闭原生轮廓 |
| | | // 创建独立折线作为轮廓 |
| | | const positions = entity.polygon.hierarchy.getValue().positions |
| | | viewer.entities.add({ |
| | | polyline: { |
| | | positions: positions, |
| | | width: 5, // 直接设置宽度 |
| | | material: new Cesium.PolylineGlowMaterialProperty({ |
| | | glowPower: 0.5, |
| | | color: Cesium.Color.AQUA, |
| | | }), |
| | | clampToGround: true, // 贴地显示 |
| | | }, |
| | | }) |
| | | Cesium.GeoJsonDataSource.load(item.outline).then(dataSource => { |
| | | viewer.dataSources.add(dataSource) |
| | | const entities = dataSource.entities.values |
| | | entities.forEach(entity => { |
| | | // 隐藏多边形填充 |
| | | entity.polygon.material = Cesium.Color.TRANSPARENT |
| | | entity.polygon.outline = false // 关闭原生轮廓 |
| | | // 创建独立折线作为轮廓 |
| | | const positions = entity.polygon.hierarchy.getValue().positions |
| | | viewer.entities.add({ |
| | | polyline: { |
| | | positions: positions, |
| | | width: 5, // 直接设置宽度 |
| | | material: new Cesium.PolylineGlowMaterialProperty({ |
| | | glowPower: 0.5, |
| | | color: Cesium.Color.AQUA, |
| | | }), |
| | | clampToGround: true, // 贴地显示 |
| | | }, |
| | | }) |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | // 聚合机巢 |
| | | const aggregation = (item, flyTo) => { |
| | | const aggregation = (item) => { |
| | | if (!item.gJson) return |
| | | const featuresList = item.gJson.features.map(item1 => { |
| | | // const {lng,lat} = getCenterPoint(item1.geometry.coordinates[0][0]) |
| | |
| | | entity.polygon.outline = false // 显示边框 |
| | | }) |
| | | |
| | | flyTo && viewer.flyTo(dataSource, { |
| | | needFly && viewer.flyTo(dataSource, { |
| | | offset: new Cesium.HeadingPitchRange( |
| | | 0, // heading: 0 (朝向不变) |
| | | Cesium.Math.toRadians(-60), // pitch: -90° (垂直向下) |
| | |
| | | ), |
| | | duration: 0.5, |
| | | }) |
| | | needFly = false |
| | | }) |
| | | } |
| | | |
| | |
| | | case 'deviceAggregation': |
| | | viewer.scene.postRender.addEventListener(labelBoxRender) |
| | | break |
| | | // todo 待对接 |
| | | case 'device': |
| | | store.commit('setSingleUavHome', { id: '123' }) |
| | | break |