import store from "../../../store"; import mapInfo from "./mapInfo"; import model from "./model"; const mapViewer = { leftClick: null, rightClick: null, addClick() { this.addLeftClick(); this.addRightClick(); }, addLeftClick() { this.leftClick = new Cesium.ScreenSpaceEventHandler(window.Viewer.canvas); this.leftClick.setInputAction(function (event) { 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); // 纬度 let alt = cartographic.height; // 高度,椭球面height永远等于 let coordinate = { longitude: Number(lng), latitude: Number(lat), altitude: Number(alt.toFixed(2)), heading: 0, pitch: 0, roll: 0, scale: 1, }; store.state.coordinate = coordinate; if(store.state.isBatchGridArr){ }else if (store.state.addModelFlag) { model.setModelCoord(coordinate); }else if (store.state.isMeasureFlag) { store.state.measureCoordObj = coordinate; store.state.isShowMeasureCoord = true; }else if (store.state.isQueryFalag) { store.state.isQyeryCoord = coordinate; }else if (Cesium.defined(nPickFeature)) { mapInfo.setRestLayer(); 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")) { var name = nPickFeature.getProperty("name"); if (name == "DLJQT0007") { store.state.isShowVideo = true; } else if (name == "sensor001") { } else if (name == "DLLMJ0001") { store.state.isireamUrl = "/Data/html/hd3dmap.html?id=3493&type=8"; store.state.isShowMenuCount = true; } else if (name == "DLBZP0023") { store.state.isireamUrl = "/Data/html/hd3dmap.html?id=3494&type=5"; store.state.isShowMenuCount = true; } else if (name == "DLBZP0024") { store.state.isireamUrl = "/Data/html/hd3dmap.html?id=3491&type=8"; store.state.isShowMenuCount = true; }else if(name === "DLBZP0026"){ store.state.isireamUrl = "/Data/html/hd3dmap.html?id=3505&type=8"; store.state.isShowMenuCount = true; }else if(name === "DLBZP0029"){ store.state.isireamUrl = "/Data/html/hd3dmap.html?id=3646&type=5"; store.state.isShowMenuCount = true; }else if(name === "DLBZP0027"){ store.state.isireamUrl = "/Data/html/hd3dmap.html?id=3685&type=99"; store.state.isShowMenuCount = true; } else if(name === "DLBZP0027"){ store.state.isireamUrl = "/Data/html/hd3dmap.html?id=3685&type=99"; store.state.isShowMenuCount = true; }else if(name === "DLBZP0072"){ store.state.isireamUrl = "/Data/html/hd3dmap.html?id=3719&type=5"; store.state.isShowMenuCount = true; }else{ mapInfo.setTileSetInfo(nPickFeature) } }else{ } } }, 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); store.state.isMeasureFlag = false; }, Cesium.ScreenSpaceEventType.RIGHT_CLICK) }, } export default mapViewer;