| | |
| | | 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; |
| | | } |
| | | |
| | | |
| | | |
| | | //关闭打开的信息窗体 |
| | | |
| | |
| | | window.model = null; |
| | | } |
| | | |
| | | |
| | | 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.Creator.DeleteObject(this.$store.state.primitLayer); |
| | | this.$store.state.primitLayer = null; |
| | | } |
| | | } |
| | | |
| | | |
| | | 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; |
| | | } |
| | | } |
| | |
| | | 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; |