| | |
| | | mptLayer: [], |
| | | optionts: [], |
| | | proValue: null, |
| | | setCheeckedLayer: [] |
| | | }; |
| | | }, |
| | | methods: { |
| | |
| | | this.currentNode = Node; |
| | | |
| | | this.$store.state.propertiesName = this.currentData; |
| | | if (this.currentData.serveType == "Tileset") { |
| | | this.showModelAttach = false; |
| | | this.shwoTitle = false; |
| | | this.menuVisible = true; |
| | | |
| | | if (this.currentData.serveType == 'TMS') { |
| | | this.shwoTitle = true |
| | | } else if (this.currentData.serveType == "Tileset" || this.currentData.serveType == "3DML") { |
| | | this.showModelAttach = true; |
| | | } else { |
| | | this.showModelAttach = false; |
| | | } else if (this.currentData.serveType == "DEM" || this.currentData.serveType == "DOM" || this.currentData.serveType == "MPT") { |
| | | this.menuVisible = false; |
| | | } |
| | | if (this.currentData.enName == "s_explorationpoint") { |
| | | this.shwoHistogram = true; |
| | |
| | | } else { |
| | | this.firstLevel = true; |
| | | } |
| | | if (Node.data.children == null && Node.data.serveType == "Tileset") { |
| | | if (Node.data.children == null && Node.data.serveType == "Tileset" || Node.data.serveType == "3DML") { |
| | | this.showlocal = true; |
| | | this.showopaque = true; |
| | | } else if (Node.data.children == null && Node.data.serveType == "TMS") { |
| | |
| | | this.showlocal = false; |
| | | this.showopaque = false; |
| | | } |
| | | this.menuVisible = true; |
| | | |
| | | |
| | | this.$refs.card.$el.style.left = event.pageX + 20 + "px"; |
| | | this.$refs.card.$el.style.top = event.pageY + "px"; |
| | |
| | | //模型定位 |
| | | async positioning() { |
| | | this.menuVisible = false |
| | | |
| | | if (this.currentData.serveType == 'Tileset') { |
| | | if (this.currentData.serveType == 'Tileset' || this.currentData.serveType == '3DML') { |
| | | for (var i in Viewer.scene.primitives._primitives) { |
| | | if ( |
| | | Viewer.scene.primitives._primitives[i].id == this.currentData.cnName |
| | |
| | | }); |
| | | } |
| | | } |
| | | |
| | | }, |
| | | // 编辑节点 |
| | | editNode(data) { |
| | |
| | | case 'WFS': |
| | | listWFS.push(this.childOption[i]) |
| | | break; |
| | | case '3DML': |
| | | listTileset.push(this.childOption[i]) |
| | | break; |
| | | case 'Tileset': |
| | | listTileset.push(this.childOption[i]) |
| | | break; |
| | |
| | | case 'TMS': |
| | | listTMS.push(this.childOption[i]) |
| | | break; |
| | | |
| | | } |
| | | } |
| | | this.setChangeWMS(listWMS, checked); |
| | |
| | | } else if (data.type == 2) { |
| | | if (data.serveType == "WMS") { |
| | | this.setChangeWMS([data], checked); |
| | | } else if (data.serveType == "Tileset") { |
| | | } else if (data.serveType == "Tileset" || data.serveType == "3DML") { |
| | | this.setChangeTileset([data], checked); |
| | | } else if (data.serveType == "TMS") { |
| | | this.setChangeTMS([data], checked); |
| | |
| | | }), |
| | | }); |
| | | window.map.addLayer(vectorLayer); |
| | | } else if (res.serveType == "Tileset") { |
| | | } else if (res.serveType == "Tileset" || res.serveType == "3DML") { |
| | | var url; |
| | | if (res.url.indexOf("{host}") != -1) { |
| | | url = res.url.replace("{host}", iisHost); |
| | |
| | | ); |
| | | |
| | | tileset.readyPromise.then((tileset) => { |
| | | |
| | | tileset.id = res.cnName; |
| | | tileset.layerId = res.id; |
| | | tileset.pubid = res.pubid; |
| | | // Cesium.Matrix4.equals(a,b)判断两个四维矩阵是否相等 |
| | | // 整个根节点模型矩阵,该tileSet=>世界坐标系 |
| | | // 单位矩阵,对角线值为1.0的4*4矩阵 |
| | | if (!Cesium.Matrix4.equals(tileset.root.transform, Cesium.Matrix4.IDENTITY)) { |
| | | // 获取模型的世界坐标(笛卡尔) |
| | | // Cesium.Matrix4.getTranslation 通过仿射变换矩阵获取该tileSet的世界坐标 |
| | | const transformCenter = Cesium.Matrix4.getTranslation( |
| | | tileset.root.transform, |
| | | new Cesium.Cartesian3() |
| | | ); |
| | | // 将笛卡尔坐标转换为WGS84经纬度坐标(模型的) |
| | | const transformCartographic = Cesium.Cartographic.fromCartesian( |
| | | transformCenter |
| | | ); |
| | | // 将笛卡尔坐标转换为WGS84经纬度坐标(截面的) |
| | | const boundingSphereCartographic = Cesium.Cartographic.fromCartesian( |
| | | tileset.boundingSphere.center |
| | | ); |
| | | const height = boundingSphereCartographic.height - transformCartographic.height; |
| | | // 从一个Cartesian3对象生成Matrix4变换矩阵(裁切面的) |
| | | window.modelHeight = height; |
| | | } else window.modelHeight = 0; |
| | | this.getTilesetArgs(tileset, res); |
| | | if (res.serveType != '3DML') { |
| | | |
| | | // Cesium.Matrix4.equals(a,b)判断两个四维矩阵是否相等 |
| | | // 整个根节点模型矩阵,该tileSet=>世界坐标系 |
| | | // 单位矩阵,对角线值为1.0的4*4矩阵 |
| | | if (!Cesium.Matrix4.equals(tileset.root.transform, Cesium.Matrix4.IDENTITY)) { |
| | | // 获取模型的世界坐标(笛卡尔) |
| | | // Cesium.Matrix4.getTranslation 通过仿射变换矩阵获取该tileSet的世界坐标 |
| | | const transformCenter = Cesium.Matrix4.getTranslation( |
| | | tileset.root.transform, |
| | | new Cesium.Cartesian3() |
| | | ); |
| | | // 将笛卡尔坐标转换为WGS84经纬度坐标(模型的) |
| | | const transformCartographic = Cesium.Cartographic.fromCartesian( |
| | | transformCenter |
| | | ); |
| | | // 将笛卡尔坐标转换为WGS84经纬度坐标(截面的) |
| | | const boundingSphereCartographic = Cesium.Cartographic.fromCartesian( |
| | | tileset.boundingSphere.center |
| | | ); |
| | | const height = boundingSphereCartographic.height - transformCartographic.height; |
| | | // 从一个Cartesian3对象生成Matrix4变换矩阵(裁切面的) |
| | | window.modelHeight = height; |
| | | } else window.modelHeight = 0; |
| | | this.getTilesetArgs(tileset, res); |
| | | } |
| | | }); |
| | | this.$store.state.setAlphaList.push({ |
| | | name: res.cnName, |
| | |
| | | }) |
| | | ); |
| | | layer.name = res.cnName; |
| | | layer.id = "TMS" |
| | | this.setChangeWMS(); |
| | | } |
| | | |
| | |
| | | if (data.code != 200) { |
| | | |
| | | } else { |
| | | this.reload(tileset, data.result.json) |
| | | if (res.serveType != '3DML') { |
| | | this.reload(tileset, data.result.json) |
| | | } else { |
| | | this.tileSet(tileset, parseFloat(res.elev)) |
| | | } |
| | | |
| | | } |
| | | } else { |
| | | this.tileSet(tileset, parseFloat(res.elev)) |
| | |
| | | |
| | | layer.name = res.cnName; |
| | | |
| | | // if (data.result.geom) { |
| | | // var wkt = this.$wkt.parse(data.result.geom); |
| | | // Viewer.camera.flyTo({ |
| | | // destination: Cesium.Cartesian3.fromDegrees(wkt.coordinates[1], wkt.coordinates[0], 2000), |
| | | // }); |
| | | // } |
| | | if (data.result.geom) { |
| | | // var wkt = this.$wkt.parse(data.result.geom); |
| | | // Viewer.camera.flyTo({ |
| | | // destination: Cesium.Cartesian3.fromDegrees(wkt.coordinates[1], wkt.coordinates[0], 2000), |
| | | // }); |
| | | } |
| | | this.setChangeWMS(); |
| | | } |
| | | }, |
| | |
| | | } |
| | | this.$refs.tree.setCheckedKeys(std); |
| | | }, |
| | | getNewTree(obj, result) { |
| | | for (const i in obj) { |
| | | result.push(obj[i]) |
| | | if (obj[i].children && obj[i].children.length > 0) { |
| | | this.getNewTree(obj[i].children, result) |
| | | } |
| | | } |
| | | return result |
| | | }, |
| | | |
| | | |
| | | |
| | | // 查询 |
| | | filterNode(value, data) { |
| | | |
| | | if (!value) return true; |
| | | return data.cnName.indexOf(value) !== -1; |
| | | }, |
| | |
| | | return rs |
| | | } |
| | | }) |
| | | |
| | | var val = this.$store.state.oldTree.filter(rs => { |
| | | if (rs.enName == st_code[0].code) { |
| | | return rs |
| | |
| | | } |
| | | |
| | | } |
| | | this.cannelTerrainLayer(); |
| | | this.setTerrainMptLayer(); |
| | | //清空图层树选中状态 |
| | | this.$refs.tree.setCheckedKeys([]); |
| | | |
| | | |
| | | if (val.length > 0) { |
| | | |
| | | if (val[0].type == 1 && val[0].isProject == 1) {//项目分类 |
| | | var std = []; |
| | | |
| | | var std_check = []; |
| | | for (var i in val) { |
| | | var std_val = this.getNewTree([this.$refs.tree.getNode(val[i].id).data], []) |
| | | for (var j in std_val) { |
| | | std.push(std_val[j]) |
| | | std_check.push(std_val[j]) |
| | | } |
| | | } |
| | | |
| | | |
| | | var value = this.$store.state.isProjectLayer; |
| | | for (var i in value) { |
| | | std.push(value[i]) |
| | | |
| | | std_check.push(value[i]) |
| | | } |
| | | |
| | | |
| | | this.setProjectLayer(std); |
| | | this.setProjectLayer(std_check); |
| | | } else { |
| | | this.setChangeProLayer(); |
| | | } |
| | | } else { |
| | | this.setChangeProLayer(); |
| | | } |
| | | |
| | | |
| | | } else { |
| | | this.removeAllLayer(); |
| | | this.$store.state.pigCode = null; |
| | |
| | | for (var i in this.setCheeckedLayer) { |
| | | std.push(this.$refs.tree.getNode(this.setCheeckedLayer[i]).data) |
| | | } |
| | | |
| | | this.setProjectLayer(std); |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | }, |
| | | |
| | | setProjectLayer(res) { |
| | | var layerid = []; |
| | | for (var i in res) { |
| | | layerid.push(res[i].id) |
| | | } |
| | | this.$refs.tree.setCheckedKeys(layerid); |
| | | // var value = this.$refs.tree.getCheckedNodes(); |
| | | // this.$bus.$emit("showMenuLayer", value); |
| | | |
| | | var listWMS = []; |
| | | var listWFS = []; |
| | | var listTileset = []; |
| | | var listTMS = []; |
| | | var listMpt = []; |
| | | for (var i in res) { |
| | | if (res[i].type == 2) { |
| | | switch (res[i].serveType) { |
| | | case 'WMS': |
| | | listWMS.push(res[i]) |
| | | break; |
| | | case 'WFS': |
| | | listWFS.push(res[i]) |
| | | break; |
| | | case 'Tileset': |
| | | listTileset.push(res[i]) |
| | | break; |
| | | case 'Mpt': |
| | | listMpt.push(res[i]) |
| | | break; |
| | | case 'TMS': |
| | | listTMS.push(res[i]) |
| | | break; |
| | | |
| | | } |
| | | } |
| | | } |
| | | // this.setChangeProLayer(); |
| | | this.setChangeWMS(listWMS, true); |
| | | this.setChangeWFS(listWFS, true); |
| | | this.setChangeTileset(listTileset, true); |
| | | this.setChangeTMS(listTMS, true); |
| | | this.setChangeMpt(listMpt, true); |
| | | }, |
| | | removeAllLayer() { |
| | | for (var j in Viewer.scene.primitives._primitives) { |
| | |
| | | } |
| | | this.mptLayer = []; |
| | | }, |
| | | setProjectLayer(res) { |
| | | var layerid = []; |
| | | for (var i in res) { |
| | | layerid.push(res[i].id) |
| | | } |
| | | this.$refs.tree.setCheckedKeys(layerid); |
| | | // var value = this.$refs.tree.getCheckedNodes(); |
| | | // this.$bus.$emit("showMenuLayer", value); |
| | | |
| | | var listWMS = []; |
| | | var listWFS = []; |
| | | var listTileset = []; |
| | | var listTMS = []; |
| | | var listMpt = []; |
| | | for (var i in res) { |
| | | if (res[i].type == 2) { |
| | | switch (res[i].serveType) { |
| | | case 'WMS': |
| | | listWMS.push(res[i]) |
| | | break; |
| | | case 'WFS': |
| | | listWFS.push(res[i]) |
| | | break; |
| | | case '3DML': |
| | | case 'Tileset': |
| | | listTileset.push(res[i]) |
| | | break; |
| | | case 'Mpt': |
| | | listMpt.push(res[i]) |
| | | break; |
| | | case 'TMS': |
| | | listTMS.push(res[i]) |
| | | break; |
| | | |
| | | } |
| | | } |
| | | } |
| | | // this.setChangeProLayer(); |
| | | this.setChangeWMS(listWMS, true); |
| | | this.setChangeWFS(listWFS, true); |
| | | this.setChangeTileset(listTileset, true); |
| | | this.setChangeTMS(listTMS, true); |
| | | this.setChangeMpt(listMpt, true); |
| | | }, |
| | | getNewTree(obj, result) { |
| | | for (const i in obj) { |
| | | console.log(obj[i].cnName) |
| | | result.push(obj[i]) |
| | | if (obj[i].children && obj[i].children.length > 0) { |
| | | this.getNewTree(obj[i].children, result) |
| | | } |
| | | } |
| | | return result |
| | | }, |
| | | cannelTerrainLayer() { |
| | | //清空地形 |
| | | if (window.terrainMptLayer) { |
| | | window.terrainMptLayer.deleteObject(); |
| | | window.terrainMptLayer = null; |
| | | } |
| | | if (window.terrainDemLayer) { |
| | | Viewer.terrainProvider = new Cesium.EllipsoidTerrainProvider(); |
| | | window.terrainDemLayer = null; |
| | | } |
| | | }, |
| | | setTerrainMptLayer() { |
| | | // //默认地形MPT |
| | | // var option = { |
| | | // url: window.sceneConfig.SGUrl, |
| | | // layerName: window.sceneConfig.mptName, |
| | | // requestVertexNormals: true, |
| | | // }; |
| | | // window.terrainMptLayer = sgworld.Creator.sfsterrainprovider("", option, "", true, ""); |
| | | window.terrainDemLayer = new Cesium.CesiumTerrainProvider({ |
| | | // url: LFData + '/3d/terrain/dem20230321' |
| | | url: demLayer |
| | | }); |
| | | Viewer.terrainProvider = window.terrainDemLayer |
| | | }, |
| | | setChangeProLayer() { |
| | | |
| | | var value = this.$store.state.isProjectLayer; |
| | | |
| | | if (value.length != 0) { |
| | | |
| | | var std = []; |