| | |
| | | <div class="m-l-inbut zoom-in" @click="zoomIn"> |
| | | <i class="el-icon-refresh"></i> |
| | | </div> |
| | | <div |
| | | class="m-l-inbut zoom-in m-l-inbut-2d" |
| | | :class="{ active: dimension == '2D' }" |
| | | @click="zoomIn('2D')" |
| | | > |
| | | 2D |
| | | </div> |
| | | <div |
| | | class="m-l-inbut zoom-in m-l-inbut-3d" |
| | | :class="{ active: dimension == '2.5D' }" |
| | | @click="zoomIn('2.5D')" |
| | | > |
| | | 2.5 |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | }; |
| | | }, |
| | | computed: { |
| | | ...mapGetters(["mviewer"]), |
| | | ...mapGetters(["mviewer", "startPointFn", "dimension"]), |
| | | }, |
| | | created() { |
| | | this.DC = global.DC; |
| | | }, |
| | | methods: { |
| | | zoomIn(val) { |
| | | this.$store.dispatch("mapFlyTo", { |
| | | //飞入 |
| | | lntLat: [115.87988885, 28.72502592, 2100], |
| | | // lntLat: [115.87186406, 28.74449337, 1200], |
| | | // lntLat: [121.50492752204283, 31.21567802276832, 2530], |
| | | heading: 0, |
| | | pitch: -45, |
| | | roll: 0, |
| | | noOpen: true, |
| | | }); |
| | | // this.$store.dispatch("mapFlyTo", { |
| | | // //飞入 |
| | | // lntLat: [115.87988885, 28.72502592, 2100], |
| | | // // lntLat: [115.87186406, 28.74449337, 1200], |
| | | // // lntLat: [121.50492752204283, 31.21567802276832, 2530], |
| | | // heading: 0, |
| | | // pitch: -45, |
| | | // roll: 0, |
| | | // noOpen: true, |
| | | // }); |
| | | if (val) { |
| | | this.$store.dispatch("MSET_DIMENSIONS", val); |
| | | return; |
| | | } |
| | | this.startPointFn(); |
| | | }, |
| | | }, |
| | | }; |
| | |
| | | width: 35px; |
| | | height: 35px; |
| | | background-color: rgb(33, 150, 243); |
| | | // stroke-width: 10; |
| | | // stroke: #fff; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | |
| | | margin-bottom: 12px; |
| | | border-radius: 5px; |
| | | } |
| | | .m-l-inbut-2d { |
| | | position: relative; |
| | | top: 60px; |
| | | font-size: 16px; |
| | | &:hover { |
| | | background-color: rgb(21, 136, 230); |
| | | box-shadow: -2px -2px 3px rgb(3, 74, 136) inset; |
| | | } |
| | | } |
| | | .m-l-inbut-3d { |
| | | @extend .m-l-inbut-2d; |
| | | top: 55px; |
| | | } |
| | | .active { |
| | | background-color: rgb(72, 157, 226); |
| | | box-shadow: -2px -2px 3px rgb(16, 93, 161) inset; |
| | | } |
| | | } |
| | | </style> |
| | |
| | | tabTable: [], |
| | | ccData: [ |
| | | { |
| | | lnt: 115.87071885, |
| | | lnt: 115.86471885, |
| | | lat: 28.74382592, |
| | | }, |
| | | { |
| | | lnt: 115.86711312, |
| | | lat: 28.74615701, |
| | | lat: 28.74315701, |
| | | }, |
| | | { |
| | | lnt: 115.86972136, |
| | | lat: 28.74609846, |
| | | lnt: 115.86872136, |
| | | lat: 28.74009846, |
| | | }, |
| | | { |
| | | lnt: 115.86983129, |
| | | lat: 28.741337, |
| | | lnt: 115.87413129, |
| | | lat: 28.743337, |
| | | }, |
| | | ], |
| | | }; |
| | |
| | | ><el-button |
| | | slot="append" |
| | | class="iconSearch" |
| | | icon="el-icon-search" |
| | | icon="el-icon-search icon" |
| | | @click="search" |
| | | ></el-button> |
| | | </el-input> |
| | |
| | | height: 30px; |
| | | padding-top: 0; |
| | | padding-bottom: 0; |
| | | background-color: rgb(33, 150, 243); |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | font-size: 24px; |
| | | color: #fff; |
| | | } |
| | | } |
| | | } |
| | |
| | | "iconHide", |
| | | "popupsDom", |
| | | "MobileWindowsHideFixed", |
| | | "dimension", |
| | | ]), |
| | | }, |
| | | watch: { |
| | |
| | | if (!that.MobileWindowsHide) { |
| | | // that.$store.dispatch("closeMobileWindowsDom"); //关闭随地图弹窗 |
| | | } |
| | | // let height = Math.ceil(viewer.camera.positionCartographic.height); |
| | | // console.log(height); |
| | | }); |
| | | |
| | | //自带白模型↓ |
| | | viewer.on(that.DC.SceneEventType.CAMERA_CHANGED, (e) => { |
| | | //控制高度 |
| | | const height = Math.ceil(viewer.camera.positionCartographic.height); |
| | | let orientation = { |
| | | heading: that.DC.Namespace.Cesium.Math.toRadians(0), // 方向 |
| | | pitch: that.DC.Namespace.Cesium.Math.toRadians( |
| | | that.dimension == "2D" ? -90 : that.dimension == "2.5D" ? -45 : -45 |
| | | ), // 倾斜角度 |
| | | roll: 0, |
| | | }; |
| | | if (height < 300) { |
| | | viewer.camera.setView({ |
| | | destination: that.DC.Namespace.Cesium.Cartesian3.fromRadians( |
| | | viewer.camera.positionCartographic.longitude, |
| | | viewer.camera.positionCartographic.latitude, |
| | | 300 |
| | | ), |
| | | orientation: orientation, |
| | | }); |
| | | } |
| | | if (height > 2000) { |
| | | viewer.camera.setView({ |
| | | destination: that.DC.Namespace.Cesium.Cartesian3.fromRadians( |
| | | viewer.camera.positionCartographic.longitude, |
| | | viewer.camera.positionCartographic.latitude, |
| | | 2000 |
| | | ), |
| | | orientation: orientation, |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | // 地图点击事件 |
| | | viewer.on(DC.MouseEventType.CLICK, (e) => { |
| | | // console.log(e); |
| | | // 定制化窗体 |
| | | that.openPopupS( |
| | | e.position, |
| | | [e.wgs84SurfacePosition.lng, e.wgs84SurfacePosition.lat], |
| | | { |
| | | name: "地图点击", |
| | | address: [e.wgs84SurfacePosition.lng, e.wgs84SurfacePosition.lat], |
| | | introduce: [e.windowPosition.x, e.windowPosition.y], |
| | | from: "地图点击", |
| | | } |
| | | ); |
| | | }); |
| | | |
| | | //白模型↓ |
| | | // const layer = new DC.TilesetLayer("layer"); |
| | | // viewer.addLayer(layer); |
| | | // const tileset = new DC.Tileset( |
| | |
| | | // tileset.setStyle(style); |
| | | // layer.addOverlay(tileset); |
| | | // viewer.flyTo(tileset); |
| | | //自带白模型↑ |
| | | //白模型↑ |
| | | |
| | | //精细模型↓ |
| | | const tilesetLayer = new that.DC.TilesetLayer("tilesetLayer"); |
| | | viewer.addLayer(tilesetLayer); |
| | | const tileset = new that.DC.Tileset( |
| | | "http://data.mars3d.cn/3dtiles/max-shihua/tileset.json", |
| | | { |
| | | luminanceAtZenith: 0.5, |
| | | } |
| | | ); |
| | | tilesetLayer.addOverlay(tileset); |
| | | // const tilesetLayer = new that.DC.TilesetLayer("tilesetLayer"); |
| | | // viewer.addLayer(tilesetLayer); |
| | | // const tileset = new that.DC.Tileset( |
| | | // "http://data.mars3d.cn/3dtiles/max-shihua/tileset.json", |
| | | // { |
| | | // luminanceAtZenith: 0.5, |
| | | // } |
| | | // ); |
| | | // tilesetLayer.addOverlay(tileset); |
| | | //精细模型↑ |
| | | |
| | | setTimeout((res) => { |
| | | //转圈 |
| | | that.$store.dispatch("mapFlyTo", { |
| | | lntLat: [111.25036579, 34.83767277, 11443175.85], |
| | | heading: 0, |
| | | pitch: -90, |
| | | roll: 0, |
| | | noOpen: true, |
| | | fn: function () { |
| | | viewer.flyTo(tileset); |
| | | }, |
| | | // 2.5D贴图↓ |
| | | var provider = |
| | | new that.DC.Namespace.Cesium.WebMapTileServiceImageryProvider({ |
| | | url: "http://www.tdtfz.com/OneMapServer/rest/services/fzsw2019/MapServer/WMTS/tile/1.0.0/fzsw2019/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}", |
| | | layer: "fzsw2019", |
| | | style: "default", |
| | | tileMatrixSetID: "default028mm", |
| | | format: "image/jpgpng", |
| | | tilingScheme: new that.DC.Namespace.Cesium.GeographicTilingScheme(), |
| | | maximumLevel: 19, |
| | | tileMatrixLabels: [ |
| | | "0", |
| | | "1", |
| | | "2", |
| | | "3", |
| | | "4", |
| | | "5", |
| | | "6", |
| | | "7", |
| | | "8", |
| | | "9", |
| | | "10", |
| | | "11", |
| | | "12", |
| | | "13", |
| | | "14", |
| | | "15", |
| | | "16", |
| | | "17", |
| | | "18", |
| | | "19", |
| | | ], |
| | | }); |
| | | |
| | | // viewer.flyTo(tileset); |
| | | }, 2500); |
| | | viewer.imageryLayers.addImageryProvider(provider); |
| | | // 2.5D贴图↑ |
| | | let startPoint; |
| | | if (false) { |
| | | setTimeout((res) => { |
| | | //转圈 |
| | | that.$store.dispatch("mapFlyTo", { |
| | | lntLat: [111.25036579, 34.83767277, 11443175.85], |
| | | heading: 0, |
| | | pitch: -90, |
| | | roll: 0, |
| | | noOpen: true, |
| | | fn: function () { |
| | | // viewer.flyTo(tileset); |
| | | // viewer.flyTo(provider); |
| | | //飞入起始点 |
| | | // that.$store.dispatch("mapFlyTo", { |
| | | // lntLat: [115.87186406, 28.74449337, 1200], |
| | | // heading: 0, |
| | | // pitch: -45, |
| | | // roll: 0, |
| | | // noOpen: true, |
| | | // }); |
| | | startPoint = () => { |
| | | that.$store.dispatch("mapFlyTo", { |
| | | //飞入 |
| | | lntLat: [115.87988885, 28.72502592, 2100], |
| | | // lntLat: [115.87186406, 28.74449337, 1200], |
| | | // lntLat: [121.50492752204283, 31.21567802276832, 2530], |
| | | heading: 0, |
| | | pitch: -45, |
| | | roll: 0, |
| | | noOpen: true, |
| | | }); |
| | | }; |
| | | startPoint(); |
| | | }, |
| | | }); |
| | | // viewer.flyTo(tileset); |
| | | }, 2500); |
| | | } else { |
| | | startPoint = (val) => { |
| | | console.log(val); |
| | | // viewer.zoomToPosition( |
| | | // new DC.Position(115.86798885, 28.72502592, 2100, 0, -45) |
| | | // ); |
| | | viewer.camera.setView({ |
| | | // Cesium的坐标是以地心为原点,一向指向南美洲,一向指向亚洲,一向指向北极州 |
| | | // fromDegrees()方法,将经纬度和高程转换为世界坐标 |
| | | destination: that.DC.Namespace.Cesium.Cartesian3.fromDegrees( |
| | | 116.390060025, |
| | | 27.95649473, |
| | | 2000.0 |
| | | ), |
| | | orientation: { |
| | | // 指向 |
| | | heading: that.DC.Namespace.Cesium.Math.toRadians(0, 0), |
| | | // 视角 |
| | | pitch: that.DC.Namespace.Cesium.Math.toRadians( |
| | | val == "2D" ? -90 : val == "2.5D" ? -45 : -45 |
| | | ), |
| | | roll: 0.0, |
| | | }, |
| | | }); |
| | | }; |
| | | startPoint(that.dimension); |
| | | } |
| | | //传递默认位置 |
| | | that.$store.commit("MSET_MORENWEIZHI", startPoint); |
| | | // let position = Cesium.Cartesian3.fromDegrees(108, 25, 0); //中心点位置 |
| | | // let cameraLimit = new xt3d.CameraDominate.CameraLimit( |
| | | // viewer, |
| | |
| | | const wall = new that.DC.Wall(arr); |
| | | wall.setStyle({ |
| | | material: new that.DC.WallTrailMaterialProperty({ |
| | | color: that.DC.Color.DEEPSKYBLUE, |
| | | color: that.DC.Namespace.Cesium.Color.fromBytes(0, 142, 255, 150), |
| | | // color: that.DC.Color.DEEPSKYBLUE, |
| | | speed: 4, |
| | | }), |
| | | }); |
| | |
| | | //地图渲染完成执行srore中MSET_CREADE |
| | | // that.$store.dispatch("MSET_CREADE"); |
| | | |
| | | tileset.on(DC.MouseEventType.CLICK, (e) => { |
| | | viewer.scene.globe.depthTestAgainstTerrain = false; |
| | | // console.log(e); |
| | | // tileset.on(DC.MouseEventType.CLICK, (e) => { |
| | | // viewer.scene.globe.depthTestAgainstTerrain = false; |
| | | // // console.log(e); |
| | | |
| | | // 定制化窗体 |
| | | that.openPopupS( |
| | | e.position, |
| | | [e.wgs84Position.lng, e.wgs84Position.lat], |
| | | { |
| | | name: e.layer._bid, |
| | | address: e.layer.type, |
| | | introduce: e.layer._id, |
| | | } |
| | | ); |
| | | }); |
| | | // viewer.flyToPosition( |
| | | // new that.DC.Position(115.87186406, 28.74449337, 1800, 0, 45, 0) |
| | | // ); |
| | | |
| | | // // 定制化窗体 |
| | | // that.openPopupS( |
| | | // e.position, |
| | | // [e.wgs84Position.lng, e.wgs84Position.lat], |
| | | // { |
| | | // name: e.layer._bid, |
| | | // address: e.layer.type, |
| | | // introduce: e.layer._id, |
| | | // } |
| | | // ); |
| | | // }); |
| | | |
| | | viewer.compass.enable = false; |
| | | viewer.zoomController.enable = true; |
| | | viewer.locationBar.enable = false; |
| | | viewer.distanceLegend.enable = false; |
| | | if (true) { |
| | | // viewer.scene.screenSpaceCameraController.enableZoom = false; //控制视角缩放 |
| | | viewer.scene.screenSpaceCameraController.enableTilt = false; //控制视角旋转 |
| | | // viewer.scene.screenSpaceCameraController.minimumZoomDistance = 200; //最小缩放 |
| | | // viewer.scene.screenSpaceCameraController.maximumZoomDistance = 1900; //最大缩放 |
| | | // 2D和哥伦布视图 |
| | | // 控制视角平移:scene.screenSpaceCameraController.enableTranslate = true; |
| | | } |
| | | } |
| | | |
| | | DC.ready(initViewer); |
| | |
| | | ccDataState: state => state.mobile.ccDataState, // 测试 |
| | | openmobilePanorama: state => state.mobile.openmobilePanorama, |
| | | MobileWindowsHideFixed: state => state.mobile.MobileWindowsHideFixed, // 固定窗口 |
| | | MobileWindowChangeDataFixed: state => state.mobile.MobileWindowChangeDataFixed // 固定窗口 |
| | | MobileWindowChangeDataFixed: state => state.mobile.MobileWindowChangeDataFixed, // 固定窗口 |
| | | startPointFn: state => state.mobile.startPointFn,// 默认起始点位置 |
| | | dimension: state => state.mobile.dimension,// 维度 |
| | | perspectiveControl: state => state.mobile.perspectiveControl,///视角控制:高度、角度 ()=>{} |
| | | } |
| | | |
| | | const navigation = { |
| | |
| | | checked: "/img/leftnav/way-checked.png", |
| | | layer: "pointLayer", |
| | | }, |
| | | //默认起始点函数 |
| | | startPointFn: '', |
| | | dimension: "2D",// 维度 |
| | | perspectiveControl: '',//视角控制:高度、角度 ()=>{} |
| | | }, |
| | | mutations: { |
| | | MSET_VIEWER(state, viewer) { |
| | |
| | | state.MobileWindowsHideFixed = viewer |
| | | console.log(state.MobileWindowChangeDataFixed); |
| | | }, |
| | | //默认位置 |
| | | MSET_MORENWEIZHI(state, data) { |
| | | state.startPointFn = data; |
| | | }, |
| | | //开关飞入点图标 |
| | | MSET_OPENPOINTEL(state, val) { |
| | | if (val) { |
| | |
| | | state.pointLayerData.img = state.pointLayerData.normal; |
| | | state[state.pointLayerData.layer].show = false; |
| | | } |
| | | }, |
| | | //切换2D和2.5D |
| | | MSET_DIMENSION(state, data) { |
| | | state.dimension = data; |
| | | }, |
| | | //切换控制 |
| | | MSET_PERSPECTIVECONTROL(state, data) { |
| | | state.perspectiveControl = data; |
| | | } |
| | | }, |
| | | actions: { |
| | |
| | | setMobileWindows({ state, commit, dispatch }, data) {//打开随地图移动窗口 |
| | | // 关闭前一个弹窗? |
| | | dispatch("closeMobileWindowsDom"); |
| | | let clnt = data.from == "PopupOurOnce" ? +data.lntLat[0] : +data.lntLat[0], |
| | | clat = data.from == "PopupOurOnce" ? +data.lntLat[1] - 0.00008 : +data.lntLat[1] - 0.00048, |
| | | calt = data.from == "PopupOurOnce" ? 0 : 90.648862227; |
| | | let clas, Flys; |
| | | |
| | | if (state.dimension == "2D") { |
| | | Flys = [ |
| | | +data.lntLat[0] + 0.01197, |
| | | +data.lntLat[1] - 0.0001, |
| | | 330, |
| | | ] |
| | | clas = [ |
| | | data.from == "PopupOurOnce" ? +data.lntLat[0] : +data.lntLat[0], |
| | | data.from == "PopupOurOnce" ? +data.lntLat[1] - 0.00108 : +data.lntLat[1], |
| | | data.from == "PopupOurOnce" ? 0 : 0, |
| | | ] |
| | | |
| | | } else if (state.dimension == "2.5D") { |
| | | Flys = [ |
| | | +data.lntLat[0] + 0.01197, |
| | | +data.lntLat[1] - 0.0022, |
| | | 330, |
| | | ] |
| | | clas = [ |
| | | data.from == "PopupOurOnce" ? +data.lntLat[0] : +data.lntLat[0], |
| | | data.from == "PopupOurOnce" ? +data.lntLat[1] - 0.00108 : +data.lntLat[1] - 0.00048, |
| | | data.from == "PopupOurOnce" ? 0 : 90.648862227, |
| | | ] |
| | | } |
| | | |
| | | |
| | | if (data.useJWD) { |
| | | var ellipsoid = state.mviewer.scene.globe.ellipsoid; |
| | | var cartographic = global.DC.Namespace.Cesium.Cartographic.fromDegrees( |
| | | // data.lntLat[0], |
| | | // data.lntLat[1] - 0.00048,//数值增大是下 |
| | | // "90.648862227" |
| | | clnt, clat, calt |
| | | // clnt, clat, calt |
| | | ...clas |
| | | ); |
| | | data.position = ellipsoid.cartographicToCartesian(cartographic); |
| | | } |
| | |
| | | // h:330 |
| | | // lnt: + 0.01197 x轴 |
| | | // Lat: - 0.0021 y轴 |
| | | let Flys = [ |
| | | data.from == "PopupOurOnce" ? +data.lntLat[0] + 0.01197 : +data.lntLat[0] + 0.01197, |
| | | data.from == "PopupOurOnce" ? +data.lntLat[1] - 0.0021 : +data.lntLat[1] - 0.0021, |
| | | data.from == "PopupOurOnce" ? 330 : 330, |
| | | ] |
| | | // console.log(data.query.from, 78) |
| | | // let Flys = [ |
| | | // data.query.from == "地图点击" ? +data.lntLat[0] + 0.01197 : +data.lntLat[0] + 0.01197, |
| | | // data.query.from == "地图点击" ? +data.lntLat[1] - 0.0021 : +data.lntLat[1] - 0.0021, |
| | | // data.query.from == "地图点击" ? 330 : 330, |
| | | // ] |
| | | |
| | | |
| | | let Position = new global.DC.Position(//转坐标 |
| | | // +data.lntLat[0] + 0.01197, |
| | | // +data.lntLat[1] - 0.0021, |
| | | // 330, |
| | | ...Flys, |
| | | 0, |
| | | -45 |
| | | state.dimension == "2D" ? -90 : state.dimension == "2.5D" ? -45 : -45 |
| | | ); |
| | | dispatch("mapFlyTo", {//飞入 |
| | | lntLat: [Position.lng, Position.lat, Position.alt], |
| | |
| | | //锁定 |
| | | state.mviewer.camera.lookAtTransform(global.DC.Namespace.Cesium.Matrix4.IDENTITY) |
| | | // console.log(global.DC.Namespace.Cesium.Matrix4.IDENTITY) |
| | | }, |
| | | MSET_DIMENSIONS({ state, commit, dispatch }, val) { |
| | | commit("MSET_DIMENSION", val); |
| | | } |
| | | } |
| | | } |