| | |
| | | <template> |
| | | <div class="dimension-cut"> |
| | | <el-button |
| | | v-show="btnGroupShow" |
| | | size="mini" |
| | | class="three-stm" |
| | | type="primary" |
| | | @click="locationSTM" |
| | | >s3m</el-button> |
| | | |
| | | <el-button |
| | | v-show="btnGroupShow" |
| | | size="mini" |
| | | class="sat-stm" |
| | | type="primary" |
| | | @click="locationSAT" |
| | | >科技</el-button> |
| | | |
| | | <el-radio-group v-model="dimensionValue" size="medium" @change="dimensionChange"> |
| | | <el-radio-button label="三 维"></el-radio-button> |
| | | <el-radio-button label="真三维"></el-radio-button> |
| | |
| | | |
| | | let select = null |
| | | |
| | | let streenMlayer = null |
| | | |
| | | let layerSat = null |
| | | let layerSATtwo = null |
| | | |
| | | const wallLayer = null |
| | | |
| | | export default { |
| | | name: 'dimension', |
| | | data () { |
| | | return { |
| | | btnGroupShow: false, |
| | | dimensionValue: '三 维', |
| | | // 建筑2.5D地图 |
| | | // 建筑2.5D面数据 |
| | |
| | | } |
| | | }, |
| | | methods: { |
| | | locationSTM () { |
| | | global.viewer.flyToPosition('116.45793269658417,39.92711385557482,617.5967826044838,181.95219395269424,-21.286437065473546') |
| | | }, |
| | | |
| | | mouseMoveEvent (e) { |
| | | var that = this |
| | | |
| | |
| | | } |
| | | }, |
| | | |
| | | locationSAT () { |
| | | global.viewer.flyToPosition('121.4941629,31.2091462,1859.56,0,-28.71') |
| | | }, |
| | | |
| | | // 科技感删除 |
| | | removeSAT () { |
| | | global.viewer.remove(layerSat) |
| | | global.viewer.remove(layerSATtwo) |
| | | }, |
| | | |
| | | // 科技感添加 |
| | | createSAT () { |
| | | function generatePosition (num, isAdd) { |
| | | const list = [] |
| | | for (let i = 0; i < num; i++) { |
| | | const lng = 121.49536592256028 + Math.random() * 0.04 * (isAdd ? 1 : -1) |
| | | const lat = 31.241616722278213 + Math.random() * 0.04 * (isAdd ? 1 : -1) |
| | | list.push({ lng, lat }) |
| | | } |
| | | return list |
| | | } |
| | | |
| | | layerSat = new global.DC.TilesetLayer('layerSat').addTo(global.viewer) |
| | | |
| | | const build = new global.DC.Tileset( |
| | | 'http://resource.dvgis.cn/data/3dtiles/ljz/tileset.json', |
| | | { skipLevels: true } |
| | | ) |
| | | |
| | | const fs = ` |
| | | varying vec3 v_positionEC; |
| | | void main(void){ |
| | | vec4 position = czm_inverseModelView * vec4(v_positionEC,1); // 位置 |
| | | float glowRange = 100.0; // 光环的移动范围(高度) |
| | | gl_FragColor = vec4(0.2, 0.5, 1.0, 1.0); // 颜色 |
| | | gl_FragColor *= vec4(vec3(position.z / 100.0), 1.0); // 渐变 |
| | | // 动态光环 |
| | | float time = fract(czm_frameNumber / 360.0); |
| | | time = abs(time - 0.5) * 2.0; |
| | | float diff = step(0.005, abs( clamp(position.z / glowRange, 0.0, 1.0) - time)); |
| | | gl_FragColor.rgb += gl_FragColor.rgb * (1.0 - diff); |
| | | } |
| | | ` |
| | | build.setCustomShader(fs) |
| | | |
| | | layerSat.addOverlay(build) |
| | | |
| | | layerSATtwo = new global.DC.PrimitiveLayer('layer').addTo(global.viewer) |
| | | |
| | | let positions = generatePosition(50, true) |
| | | |
| | | positions = positions.concat(generatePosition(50)) |
| | | |
| | | positions.forEach(item => { |
| | | const position = global.DC.Position.fromObject(item) |
| | | const end = position.copy() |
| | | end.alt = 5000 * Math.random() |
| | | const line = new global.DC.FlowLinePrimitive([position, end], 0.5) |
| | | line.setStyle({ |
| | | speed: 6 * Math.random(), |
| | | color: global.DC.Color.fromCssColorString('rgb(141,172,172)'), |
| | | percent: 0.1, |
| | | gradient: 0.01 |
| | | }) |
| | | layerSATtwo.addOverlay(line) |
| | | }) |
| | | }, |
| | | |
| | | dimensionChange () { |
| | | var that = this |
| | | |
| | | that.$store.commit('SET_TWOORTHREE', that.dimensionValue) |
| | | |
| | | if (that.dimensionValue == '真三维') { |
| | | that.btnGroupShow = true |
| | | that.createSAT() |
| | | global.viewer.off(global.DC.MouseEventType.MOUSE_MOVE, that.mouseMoveEvent) |
| | | global.viewer.off(global.DC.SceneEventType.CAMERA_CHANGED, that.mapCameraEvent) |
| | | that.removeLayers() |
| | |
| | | tilesetLayer.addOverlay(tileset) |
| | | tileset.on(global.DC.MouseEventType.CLICK, that.tilesetClick) |
| | | tilesetLayer.show = true |
| | | |
| | | streenMlayer = new global.DC.S3MLayer('streenMlayer', 'http://resource.dvgis.cn/data/3dtiles/CBD/cbd.scp') |
| | | global.viewer.addLayer(streenMlayer) |
| | | // 最小 |
| | | global.viewer.scene.screenSpaceCameraController.minimumZoomDistance = 1.0 |
| | | // 最大 |
| | |
| | | } |
| | | }) |
| | | } else { |
| | | that.btnGroupShow = false |
| | | that.removeSAT() |
| | | global.viewer.on(global.DC.MouseEventType.MOUSE_MOVE, that.mouseMoveEvent) |
| | | global.viewer.on(global.DC.SceneEventType.CAMERA_CHANGED, that.mapCameraEvent) |
| | | tileset.off(global.DC.MouseEventType.CLICK, that.tilesetClick) |
| | |
| | | global.viewer.removeLayer(tilesetLayer) |
| | | tileset = null |
| | | tilesetLayer = null |
| | | global.viewer.removeLayer(streenMlayer) |
| | | streenMlayer = null |
| | | that.createdLayers() |
| | | |
| | | baseMapLayer = global.viewer.imageryLayers.addImageryProvider(new global.DC.Namespace.Cesium.UrlTemplateImageryProvider({ |
| | |
| | | // height: 40px; |
| | | z-index: 1; |
| | | } |
| | | |
| | | .three-stm { |
| | | position: fixed; |
| | | top: 66px; |
| | | right: 10px; |
| | | z-index: 99; |
| | | } |
| | | |
| | | .sat-stm { |
| | | position: fixed; |
| | | top: 66px; |
| | | right: 75px; |
| | | z-index: 99; |
| | | } |
| | | </style> |