| | |
| | | import store from "../../../store"; |
| | | import mapInfo from "./mapInfo"; |
| | | import model from "./model"; |
| | | const mapViewer = { |
| | | leftClick: null, |
| | |
| | | addLeftClick() { |
| | | this.leftClick = new Cesium.ScreenSpaceEventHandler(window.Viewer.canvas); |
| | | this.leftClick.setInputAction(function (event) { |
| | | let cartesian = window.Viewer.camera.pickEllipsoid(event.position); |
| | | let nPickFeature = Viewer.scene.pick(event.position); |
| | | let cartesian = window.Viewer.camera.pickEllipsoid(event.position); |
| | | |
| | | let cartographic = Cesium.Cartographic.fromCartesian(cartesian); |
| | | let lng = Cesium.Math.toDegrees(cartographic.longitude); // 经度 |
| | | let lat = Cesium.Math.toDegrees(cartographic.latitude); // 纬度 |
| | |
| | | roll: 0, |
| | | scale: 1, |
| | | }; |
| | | |
| | | if(store.state.addModelFlag){ |
| | | store.state.coordinate = coordinate; |
| | | if (store.state.addModelFlag) { |
| | | model.setModelCoord(coordinate); |
| | | |
| | | } |
| | | if (store.state.isMeasureFlag) { |
| | | store.state.measureCoordObj = coordinate; |
| | | store.state.isShowMeasureCoord = true; |
| | | } |
| | | if (Cesium.defined(nPickFeature)) { |
| | | console.log(nPickFeature); |
| | | if (nPickFeature.id && nPickFeature.id.id == 'Rectangle') |
| | | return |
| | | if (nPickFeature.id && nPickFeature.id.properties) { |
| | | mapInfo.setGeoJsonInfo(nPickFeature.id.properties) |
| | | } else if (nPickFeature && nPickFeature.getProperty("name")) { |
| | | if (nPickFeature.getProperty("name") == "DLJQT0007") { |
| | | store.state.isShowVideo = true; |
| | | } |
| | | } |
| | | } |
| | | if (store.state.isQueryFalag) { |
| | | |
| | | store.state.isQyeryCoord = coordinate; |
| | | } |
| | | |
| | | }, Cesium.ScreenSpaceEventType.LEFT_CLICK) |
| | | }, |
| | | addRightClick() { |
| | | this.rightClick = new Cesium.ScreenSpaceEventHandler(window.Viewer.canvas); |
| | | this.rightClick.setInputAction(function (event) { |
| | | let pickedObject = window.Viewer.scene.pick(event.position); |
| | | |
| | | console.log(pickedObject) |
| | | store.state.isMeasureFlag = false; |
| | | }, Cesium.ScreenSpaceEventType.RIGHT_CLICK) |
| | | }, |
| | | } |