| | |
| | | </template> |
| | | |
| | | <script> |
| | | |
| | | import { transform } from 'ol/proj'; |
| | | import mapinfo from '../Tools/mapinfo.vue'; |
| | | import maplayer from '../Tools/maplayer.vue'; |
| | |
| | | FullScreen, |
| | | ScaleLine, |
| | | Rotate, |
| | | |
| | | } from "ol/control.js" |
| | | import * as turf from '@turf/turf'; |
| | | import { geometry } from '@turf/turf'; |
| | |
| | | css: 'twoMenu_imge86', |
| | | }, |
| | | |
| | | // { |
| | | // id: 'h9', |
| | | // label: 'synthesis.import1', |
| | | // name: '导入SHP', |
| | | // css: 'twoMenu_imge85', |
| | | // }, |
| | | // { |
| | | // id: 'h10', |
| | | // label: 'synthesis.export1', |
| | | // name: '导出SHP', |
| | | // css: 'twoMenu_imge86', |
| | | // }, |
| | | { |
| | | id: 'h9', |
| | | label: 'synthesis.import1', |
| | | name: '导入SHP', |
| | | css: 'twoMenu_imge85', |
| | | }, |
| | | { |
| | | id: 'h10', |
| | | label: 'synthesis.export1', |
| | | name: '导出SHP', |
| | | css: 'twoMenu_imge86', |
| | | }, |
| | | |
| | | |
| | | { |
| | |
| | | scaleLine: null, |
| | | Excavation: false, |
| | | entityaLayers: [], |
| | | isMenuFlag: null, |
| | | }; |
| | | }, |
| | | methods: { |
| | | //二級菜单点击切换 |
| | | setChangeTwoMenu(res) { |
| | | //清除绘制图形对象 |
| | | // sgworld.Creator.SimpleGraphic.clear(); |
| | | if (window.Viewer.scene.primitives.length != null) { |
| | | window.Viewer.scene.primitives.removeAll(); |
| | | } |
| | | if (this.$store.state.primitLayer != null) { |
| | | sgworld.Creator.DeleteObject(this.$store.state.primitLayer); |
| | | this.$store.state.primitLayer = null; |
| | | } |
| | | |
| | | //关闭打开的信息窗体 |
| | | |
| | | |
| | | |
| | | this.showTwoMenuFlag = res.id; |
| | | this.$store.state.mapMenuBoolean = false; |
| | | this.$store.state.mapMenuBoxFlag = null; |
| | | this.$store.state.mapPopBoolean = false; |
| | |
| | | window.model.deleteObject(); |
| | | window.model = null; |
| | | } |
| | | |
| | | |
| | | |
| | | sgworld.Analysis.clearCurtainContrast(); |
| | | if (this.isMenuFlag == "d") { |
| | | this.clearAllAnalsy(); |
| | | } |
| | | if (this.isMenuFlag !=val) { |
| | | sgworld.Creator.SimpleGraphic.clear(); |
| | | this.isMenuFlag = val; |
| | | if (this.entityaLayers.length != 0) { |
| | | for (var i in this.entityaLayers) { |
| | | sgworld.Viewer.entities.remove(this.entityaLayers[i]); |
| | | } |
| | | this.entityaLayers = []; |
| | | } |
| | | for (var i in this.$store.state.queryInfo) { |
| | | sgworld.Viewer.entities.remove(this.$store.state.queryInfo[i]); |
| | | } |
| | | this.$store.state.queryInfo = []; |
| | | if (this.$store.state.primitLayer != null) { |
| | | sgworld.Viewer.entities.remove(this.$store.state.primitLayer); |
| | | sgworld.Creator.DeleteObject(this.$store.state.primitLayer); |
| | | this.$store.state.primitLayer = null; |
| | | } |
| | | } |
| | | this.showTwoMenuFlag = res.id; |
| | | |
| | | switch (val) { |
| | | |
| | | |
| | | |
| | | case 'a': //图层管理 |
| | | |
| | | this.setCoverage(res.id); |
| | | break; |
| | | case 'b': |
| | |
| | | var north = Cesium.Math.toDegrees(entities[i].rectangle.coordinates.getValue().north); |
| | | var west = Cesium.Math.toDegrees(entities[i].rectangle.coordinates.getValue().west); |
| | | var south = Cesium.Math.toDegrees(entities[i].rectangle.coordinates.getValue().south); |
| | | var line = turf.lineString([[east, north], [west, south]]) |
| | | var line = turf.polygon([[[east, north], [west, north], [west, south], [east, south], [east, north]]]) |
| | | wkt = this.$wkt.convert(line.geometry) |
| | | var fill = entities[i].rectangle._material._color._value; |
| | | fillColor = fill.red + ',' + fill.green + ',' + fill.blue; |
| | |
| | | console.error(e); |
| | | } |
| | | }); |
| | | |
| | | document.getElementById("shpFile").value = "" |
| | | |
| | | }, |
| | | showShpEntity(res) { |
| | | |
| | | for (var i in res) { |
| | | |
| | | var wkt = this.$wkt.parse(res[i].wkt); |
| | | var fillColor = res[i].fillColor.split(","); |
| | | var color = new Cesium.Color(fillColor[0], fillColor[1], fillColor[2], res[i].opacity) |
| | | var color = new Cesium.Color(parseFloat(fillColor[0]), parseFloat(fillColor[1]), parseFloat(fillColor[2]), res[i].opacity); |
| | | var name = res[i].name |
| | | switch (res[i].type) { |
| | | case 'rectangle': |
| | | debugger |
| | | break; |
| | | case 'point': |
| | | debugger |
| | | break; |
| | | case 'polygon': |
| | | |
| | | var std = []; |
| | | var geo = wkt.coordinates[0]; |
| | | for (var i in geo) { |
| | | std.push(geo[i][0]) |
| | | std.push(geo[i][1]) |
| | | } |
| | | const entity = Viewer.entities.add({ |
| | | name: 'Wyoming', |
| | | var entity = Viewer.entities.add({ |
| | | name: name, |
| | | polygon: { |
| | | hierarchy: Cesium.Cartesian3.fromDegreesArray(std), |
| | | //height : 100000, |
| | | material:color, |
| | | material: color, |
| | | outline: true, |
| | | outlineColor: color, |
| | | } |
| | | }) |
| | | this.entityaLayers.push(entity) |
| | | break; |
| | | case 'point': |
| | | let point = Viewer.entities.add({ |
| | | name: name, |
| | | position: Cesium.Cartesian3.fromDegrees(wkt.coordinates[0], wkt.coordinates[1]), //经纬度转世界坐标 |
| | | point: { |
| | | show: true, |
| | | color: color, |
| | | pixelSize: 10, |
| | | outlineColor: color, |
| | | outlineWidth: 3, |
| | | heightReference: Cesium.HeightReference.CLAMP_TO_GROUND, |
| | | disableDepthTestDistance: Number.POSITIVE_INFINITY, |
| | | }, |
| | | }); |
| | | |
| | | this.entityaLayers.push(point) |
| | | break; |
| | | case 'polyline': |
| | | debugger |
| | | var std = []; |
| | | var geo = wkt.coordinates; |
| | | for (var i in geo) { |
| | | std.push(geo[i][0]) |
| | | std.push(geo[i][1]) |
| | | } |
| | | let line = Viewer.entities.add({ |
| | | name: name, |
| | | polyline: { |
| | | //经纬度数组转世界坐标,带高度的话是fromDegreesArrayHeights |
| | | positions: Cesium.Cartesian3.fromDegreesArray(std), |
| | | width: 10, |
| | | material: color, |
| | | clampToGround: true, |
| | | } |
| | | }) |
| | | |
| | | this.entityaLayers.push(line) |
| | | break; |
| | | case 'label': |
| | | debugger |
| | | const label = Viewer.entities.add({ |
| | | position: Cesium.Cartesian3.fromDegrees(wkt.coordinates[0], wkt.coordinates[1]), |
| | | label: { |
| | | text: name, |
| | | fillColor: color, |
| | | font: '28px', |
| | | horizontalOrigin: Cesium.HorizontalOrigin.CENTER, |
| | | verticalOrigin: Cesium.VerticalOrigin.TOP, |
| | | heightReference: Cesium.HeightReference.CLAMP_TO_GROUND, |
| | | disableDepthTestDistance: Number.POSITIVE_INFINITY, |
| | | }, |
| | | }) |
| | | this.entityaLayers.push(label) |
| | | break; |
| | | } |
| | | } |
| | |
| | | break; |
| | | } |
| | | }, |
| | | clearAllAnalsy() { |
| | | // switch (this.showTwoMenuFlag) { |
| | | // case 'd1': |
| | | // that.isolineFlag = false; |
| | | // elevationTool.tf = that.isolineFlag; |
| | | // elevationTool.render(); |
| | | // break; |
| | | // case 'd2': |
| | | // that.isslopeFlag = false; |
| | | // elevationTool.type = 'none'; |
| | | // elevationTool.render(); |
| | | // break; |
| | | // } |
| | | }, |
| | | |
| | | |
| | | |
| | | setAnalsy(res) { |
| | | //this.$refs && this.$refs.queryinfo && this.$refs.queryinfo.close("queryinfo"); |
| | | var that = this; |
| | |
| | | break; |
| | | case 'd2': |
| | | that.isslopeFlag = !that.isslopeFlag; |
| | | window.PDelevationTool= new SmartEarth.ElevationTool(sgworld);//全局变量 |
| | | if (that.isslopeFlag == true) { |
| | | elevationTool.type = 'slope'; |
| | | PDelevationTool.type = 'slope'; |
| | | PDelevationTool.tf = this.checked; |
| | | } else { |
| | | elevationTool.type = 'none'; |
| | | PDelevationTool.type = 'none'; |
| | | } |
| | | elevationTool.render(); |
| | | PDelevationTool.render(); |
| | | break; |
| | | case 'd3': |
| | | var value = { |
| | |
| | | } |
| | | break; |
| | | case 'd10': |
| | | if (window.TerrainFlattening) { |
| | | window.TerrainFlattening.remove(); |
| | | window.TerrainFlattening = null; |
| | | } else { |
| | | sgworld.Creator.createSimpleGraphic( |
| | | 'polygon', |
| | | { |
| | | clampToGround: true, |
| | | }, |
| | | function (entity) { |
| | | var positions = entity.polygon.hierarchy.getValue().positions; |
| | | sgworld.Creator.SimpleGraphic.remove(entity.id); |
| | | window.TerrainFlattening = |
| | | sgworld.Creator.createTerrainModifier( |
| | | '地形压平', |
| | | positions, |
| | | 10, |
| | | {} |
| | | ); |
| | | } |
| | | ); |
| | | |
| | | if(window.DXTerrainFlattening!=null){ |
| | | DXTerrainFlattening.remove(); |
| | | } |
| | | sgworld.Creator.createSimpleGraphic( |
| | | 'polygon', |
| | | { |
| | | clampToGround: true, |
| | | }, |
| | | function (entity) { |
| | | let positions = entity.polygon.hierarchy.getValue().positions; |
| | | console.log(positions); |
| | | sgworld.Creator.SimpleGraphic.remove(entity.id); |
| | | |
| | | window.DXTerrainFlattening = sgworld.Creator.createTerrainModifier("地形压平", positions, 10, {}); |
| | | } |
| | | ); |
| | | break; |
| | | |
| | | case 'd11': |
| | |
| | | break; |
| | | |
| | | case "d12": |
| | | if (window.Excavation) { |
| | | window.Excavation.deleteObject() |
| | | window.Excavation = null |
| | | if (window.TSExcavation!=null) { |
| | | window.TSExcavation.deleteObject() |
| | | window.TSExcavation = null |
| | | } else { |
| | | window.Excavation = sgworld.Analysis.createSightLine({ |
| | | window.TSExcavation = sgworld.Analysis.createSightLine({ |
| | | type: "default", |
| | | }) |
| | | } |
| | |
| | | font-size: 16px; |
| | | font-family: Microsoft YaHei; |
| | | font-weight: 400; |
| | | |
| | | border: 1px solid rgba(0, 0, 0, 0); |
| | | padding: 10px; |
| | | min-width: 100px; |
| | | margin-left: 10px; |