|
@@ -0,0 +1,367 @@
|
|
|
|
+<template>
|
|
|
|
+ <div class="background">
|
|
|
|
+ <div class="bottomTerrainClass">
|
|
|
|
+ <el-tree class="treeclass" :data="treeLayerData" show-checkbox @node-click="setCurrentNode"
|
|
|
|
+ highlight-current node-key="name" @check-change="setVisible" ref="xytree2">
|
|
|
|
+ <span slot-scope="{ node, data }" @dblclick="flyTo(node, data)" style="width: 100%">
|
|
|
|
+ <div>
|
|
|
|
+ {{ node.label }}
|
|
|
|
+ </div>
|
|
|
|
+ </span>
|
|
|
|
+ </el-tree>
|
|
|
|
+ <div>
|
|
|
|
+ <div>
|
|
|
|
+ <el-radio-group v-model="currentTerrain" class="terrain1">
|
|
|
|
+ <el-radio :label="item.name" v-for="(item, index) in terrainList" :key="index"
|
|
|
|
+ @change="changeTerrain">{{ item.name }}</el-radio>
|
|
|
|
+ </el-radio-group>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<script>
|
|
|
|
+import primitiveLayerManager from "../../../../Platform/ShiKongFenXi/lib/PrimitiveLayerManager";
|
|
|
|
+import axiosRequestAPI from "../../../../Platform/ShiKongFenXi/lib/axiosRequestAPI"
|
|
|
|
+export default {
|
|
|
|
+ data() {
|
|
|
|
+ return {
|
|
|
|
+ treeLayerData: [],
|
|
|
|
+ testname: '新增发布数据',
|
|
|
|
+ currentTerrain: "",
|
|
|
|
+ terrainList: [],
|
|
|
|
+
|
|
|
|
+ };
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ created() {
|
|
|
|
+ this.$bus.on("app.init", app => {
|
|
|
|
+ this.app = app;
|
|
|
|
+ this.earth = app.viewer;
|
|
|
|
+ });
|
|
|
|
+ this.treeLayerData = AppConfig.layersConfig.find(layer => layer.name === this.testname).children || [];
|
|
|
|
+ this.terrainList = AppConfig.terrainList;
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ changeTerrain(name) {
|
|
|
|
+ let terrian = this.terrainList.find(tr => {
|
|
|
|
+ return tr.name == name;
|
|
|
|
+ console.log(terrian);
|
|
|
|
+ });
|
|
|
|
+ if (terrian) {
|
|
|
|
+ this.app.viewer.terrainProvider = new Cesium.CesiumTerrainProvider({
|
|
|
|
+ url: terrian.url,
|
|
|
|
+ requestVertexNormals: true
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ this.app.viewer.terrainProvider = new Cesium.EllipsoidTerrainProvider();
|
|
|
|
+ }
|
|
|
|
+ this.currentTerrain = name;
|
|
|
|
+ },
|
|
|
|
+ setCurrentNode(currentNode) {
|
|
|
|
+ this.currentNode = currentNode;
|
|
|
|
+ console.log(currentNode);
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ setVisible(node, checked) {
|
|
|
|
+ // // 取消浏览模式
|
|
|
|
+ // this.CameraBrowsing(false)
|
|
|
|
+ // 倾斜节点node
|
|
|
|
+
|
|
|
|
+ if (node.type == "group") return;
|
|
|
|
+ console.log(this.app.layerManager);
|
|
|
|
+
|
|
|
|
+ let layer = this.app.layerManager.getLayer(node.name);
|
|
|
|
+ if (layer) {
|
|
|
|
+ layer.show = checked;
|
|
|
|
+ }
|
|
|
|
+ if (node.type === "geojson_mian" && checked) {
|
|
|
|
+ axiosRequestAPI
|
|
|
|
+ .listAllTuBanTableName(node.name)
|
|
|
|
+ .then((result) => {
|
|
|
|
+ primitiveLayerManager.addLayer(result, node.name, Cesium.Color.fromBytes(0, 169, 255).withAlpha(1));
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ else if (!checked) {
|
|
|
|
+ primitiveLayerManager.removeLayerChange(node.name)
|
|
|
|
+ }
|
|
|
|
+ if (node.type === "3dTiles" && checked && node.name !== "房屋数据") {
|
|
|
|
+ earth.zoomTo(layer);
|
|
|
|
+ //clear鼠标点击操作
|
|
|
|
+ this.$bus.emit("clearhandler");
|
|
|
|
+ }
|
|
|
|
+ if (node.type === "3dTilesHeight" && checked && node.name !== "房屋数据") {
|
|
|
|
+ earth.zoomTo(layer);
|
|
|
|
+ //clear鼠标点击操作
|
|
|
|
+ this.$bus.emit("clearhandler");
|
|
|
|
+ }
|
|
|
|
+ if (node.type === "3dTilesMax" && checked && node.name !== "房屋数据") {
|
|
|
|
+ earth.zoomTo(layer);
|
|
|
|
+ // 浏览模式
|
|
|
|
+ this.CameraBrowsing(checked)
|
|
|
|
+ //clear鼠标点击操作
|
|
|
|
+ this.$bus.emit("clearhandler");
|
|
|
|
+ // 打开浏览面板
|
|
|
|
+ }
|
|
|
|
+ if (node.type === "3dTilesMax" && checked && node.name === "教学楼max") {
|
|
|
|
+ this.$bus.emit("showmaxposition1");
|
|
|
|
+ }
|
|
|
|
+ if (node.type === "3dTilesMax" && checked && node.name === "停车场max") {
|
|
|
|
+ this.$bus.emit("showmaxposition2");
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ if (node.type === "3dTilesMax" && !checked) {
|
|
|
|
+ // 关闭浏览面板
|
|
|
|
+ this.$bus.emit("closemaxposition");
|
|
|
|
+ }
|
|
|
|
+ if (node.type === "3dTilesHeight" && node.name === "房屋数据" && checked) {
|
|
|
|
+ // console.log(layer._root.transform[14]);
|
|
|
|
+ earth.zoomTo(layer);
|
|
|
|
+ //白膜图层高度修改
|
|
|
|
+ // this.layer1.modelMatrix[14] = this.layer1.modelMatrix[14] +node.height
|
|
|
|
+ // layer._root.transform[14] = layer._root.transform[14] + node.height;
|
|
|
|
+ // layer._root.transform[13] = 4802609.35862297
|
|
|
|
+ // layer._root.transform[12] = -1959543.00275453
|
|
|
|
+ this.pickshp();
|
|
|
|
+ this.baimolayer_temp = layer;
|
|
|
|
+ }
|
|
|
|
+ if (node.type === "dianyun" && checked) {
|
|
|
|
+ earth.flyTo(layer);
|
|
|
|
+ //渲染点云数据
|
|
|
|
+
|
|
|
|
+ // layer.readyPromise.then((layer) => {
|
|
|
|
+ // // 实例化点云符号化类
|
|
|
|
+ // new Uninpho.PclColorStyle({
|
|
|
|
+ // viewer: viewer,
|
|
|
|
+ // minHeight: node.minHeight,
|
|
|
|
+ // maxHeight: node.maxHeight,
|
|
|
|
+ // alpha: 0.6,
|
|
|
|
+ // // colorImage: '../../../../static/img/colortable/colpick_slider.png',
|
|
|
|
+ // center: layer.boundingSphere.center
|
|
|
|
+ // });
|
|
|
|
+ // })
|
|
|
|
+ }
|
|
|
|
+ if (node.type === "zaihaidian" && checked) {
|
|
|
|
+ //获取灾害点所有数据
|
|
|
|
+ this.$axiosInstance.zaihaidianadding().then(data => {
|
|
|
|
+ // console.log(data.data);
|
|
|
|
+ let res = data.data;
|
|
|
|
+ res.forEach(zaihaidian => {
|
|
|
|
+ this.zaihaidian = zaihaidian;
|
|
|
|
+ var dzdtc = earth.entities.add({
|
|
|
|
+ id: this.zaihaidian.id,
|
|
|
|
+ position: Cesium.Cartesian3.fromDegrees(
|
|
|
|
+ this.zaihaidian.lon,
|
|
|
|
+ this.zaihaidian.lat,
|
|
|
|
+ 2000
|
|
|
|
+ ),
|
|
|
|
+ billboard: {
|
|
|
|
+ // id :this.zaihaidian.id,
|
|
|
|
+ image: "../../../../static/img/poi/zaihaidian.png",
|
|
|
|
+ show: true,
|
|
|
|
+ scale: 0.1,
|
|
|
|
+ // color: Cesium.Color.RED,
|
|
|
|
+ heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ yichuzhd.push(dzdtc);
|
|
|
|
+ });
|
|
|
|
+ // console.log(yichuzhd);
|
|
|
|
+ this.pickshp();
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ if (node.type === "zaihaidian" && !checked) {
|
|
|
|
+ this.zhdshowbox = false;
|
|
|
|
+ this.earth.entities.removeById("ZHDSearch111");
|
|
|
|
+ for (var i = 0; i < yichuzhd.length; i++) {
|
|
|
|
+ this.earth.entities.removeById(yichuzhd[i].id);
|
|
|
|
+ // yichuzhd[i].show = false
|
|
|
|
+ }
|
|
|
|
+ yichuzhd = [];
|
|
|
|
+ }
|
|
|
|
+ if (node.type === "wms" && node.label === "用地数据" && checked) {
|
|
|
|
+ ydhandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK); //移除事件
|
|
|
|
+ ydhandler.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE); //移除事件
|
|
|
|
+ ydhandler.removeInputAction(Cesium.ScreenSpaceEventType.RIGHT_CLICK); //移除事件
|
|
|
|
+ ydhandler.setInputAction(event => {
|
|
|
|
+ //获取点击区域的经纬度
|
|
|
|
+ var cartesian = this.earth.camera.pickEllipsoid(
|
|
|
|
+ event.position,
|
|
|
|
+ this.earth.scene.globe.ellipsoid
|
|
|
|
+ );
|
|
|
|
+ var cartographic = Cesium.Cartographic.fromCartesian(cartesian);
|
|
|
|
+ var lng = Cesium.Math.toDegrees(cartographic.longitude); //经度值
|
|
|
|
+ var lat = Cesium.Math.toDegrees(cartographic.latitude); //纬度值
|
|
|
|
+ // console.log(lng,lat);
|
|
|
|
+ let point = [lng, lat]; //鼠标单击点的 经纬度坐标
|
|
|
|
+ //geoserver点查询
|
|
|
|
+ let offset = 0.00001;
|
|
|
|
+
|
|
|
|
+ let minx = point[0] - offset;
|
|
|
|
+ let miny = point[1] - offset;
|
|
|
|
+ let maxx = point[0] + offset;
|
|
|
|
+ let maxy = point[1] + offset;
|
|
|
|
+
|
|
|
|
+ //geoserver地址
|
|
|
|
+ let geoUrl = node.searchImageUrl;
|
|
|
|
+ //查询图层名
|
|
|
|
+ let layertuceng = node.geolayer;
|
|
|
|
+ let searchImageUrl = `${geoUrl}
|
|
|
|
+ SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo
|
|
|
|
+ &QUERY_LAYERS=${layertuceng}
|
|
|
|
+ &LAYERS=${layertuceng}
|
|
|
|
+ &INFO_FORMAT=application%2Fjson
|
|
|
|
+ &FEATURE_COUNT=500
|
|
|
|
+ &X=50&Y=50
|
|
|
|
+ &SRS=EPSG%3A4326
|
|
|
|
+ &WIDTH=101&HEIGHT=101
|
|
|
|
+ &BBOX=${minx},${miny},${maxx},${maxy}`;
|
|
|
|
+
|
|
|
|
+ // let searchImageUrl =
|
|
|
|
+ // `http://localhost:8090/geoserver/UninphoServer/wms?
|
|
|
|
+ // SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo
|
|
|
|
+ // &QUERY_LAYERS=UninphoServer:qinshui_yongdi
|
|
|
|
+ // &LAYERS=UninphoServer:qinshui_yongdi
|
|
|
|
+ // &INFO_FORMAT=application%2Fjson
|
|
|
|
+ // &FEATURE_COUNT=500
|
|
|
|
+ // &X=50&Y=50
|
|
|
|
+ // &SRS=EPSG%3A4326
|
|
|
|
+ // &WIDTH=101&HEIGHT=101
|
|
|
|
+ // &BBOX=${minx},${miny},${maxx},${maxy}`
|
|
|
|
+ // console.log(searchImageUrl);
|
|
|
|
+
|
|
|
|
+ // url
|
|
|
|
+
|
|
|
|
+ //geoserver点查询
|
|
|
|
+ this.$axios.get(searchImageUrl).then(data => {
|
|
|
|
+ console.log(data);
|
|
|
|
+ if (data.data.features[0] !== undefined) {
|
|
|
|
+ let res = data.data.features;
|
|
|
|
+ let yongdi = res[0].properties;
|
|
|
|
+ // res内容放在框里面
|
|
|
|
+ this.$bus.emit("yongdixinxi", yongdi);
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ this.ydlxbox = true;
|
|
|
|
+ }, 200);
|
|
|
|
+ }
|
|
|
|
+ //点击空白处取消弹框
|
|
|
|
+ else if (data.data.features[0] == undefined) {
|
|
|
|
+ this.ydlxbox = false;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
|
|
|
|
+ }
|
|
|
|
+ if (node.type === "wms" && node.label === "用地数据" && !checked) {
|
|
|
|
+ this.ydlxbox = false;
|
|
|
|
+ ydhandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK); //移除事件
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (node.type == "yaping") {
|
|
|
|
+
|
|
|
|
+ if (checked) {
|
|
|
|
+ var arr = node.arr
|
|
|
|
+ console.log(arr);
|
|
|
|
+ this.app.layerManager.excavation.start(arr, 10);
|
|
|
|
+ } else {
|
|
|
|
+ this.app.layerManager.excavation.stop();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (node.type == "flyToIndoor") {
|
|
|
|
+ if (checked) {
|
|
|
|
+ var camera = viewer.camera;
|
|
|
|
+ camera.flyTo({
|
|
|
|
+ destination: Cesium.Cartesian3.fromDegrees(node.longitude1, node.latitude1, node.height1),
|
|
|
|
+ orientation: {
|
|
|
|
+ heading: Cesium.Math.toRadians(node.heading1),
|
|
|
|
+ pitch: Cesium.Math.toRadians(node.pitch1),
|
|
|
|
+ roll: Cesium.Math.toRadians(node.roll1)
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ camera.flyTo({
|
|
|
|
+ destination: Cesium.Cartesian3.fromDegrees(node.longitude2, node.latitude2, node.height2),
|
|
|
|
+ orientation: {
|
|
|
|
+ heading: Cesium.Math.toRadians(node.heading2),
|
|
|
|
+ pitch: Cesium.Math.toRadians(node.pitch2),
|
|
|
|
+ roll: Cesium.Math.toRadians(node.roll2)
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }, node.time)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ flyTo(el_node, node) {
|
|
|
|
+ if (node.type === 1) {
|
|
|
|
+ xyLayerManager.flyToById(node.uuid);
|
|
|
|
+ } else if (node.type === "3dTiles") {
|
|
|
|
+ el_node.checked = true;
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ earth.flyTo(this.app.layerManager.getLayer(node.name));
|
|
|
|
+ }, 500);
|
|
|
|
+ if (el_node.data.label !== "房屋数据") {
|
|
|
|
+ //关闭A_information属性面板
|
|
|
|
+ this.$bus.emit("A_information", {
|
|
|
|
+ flag: false,
|
|
|
|
+ content: ""
|
|
|
|
+ });
|
|
|
|
+ this.$bus.emit("pickshp_cancal");
|
|
|
|
+ } else if (el_node.data.label === "房屋数据") {
|
|
|
|
+ this.$bus.emit("pickshp");
|
|
|
|
+ } else {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ } else if (node.type === "dianyun") {
|
|
|
|
+ el_node.checked = true;
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ earth.flyTo(this.app.layerManager.getLayer(node.name));
|
|
|
|
+ }, 500);
|
|
|
|
+ } else if (node.type === "geojson_mian") {
|
|
|
|
+ el_node.checked = true;
|
|
|
|
+ console.log(this.app.layerManager.getLayer(node.name));
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ earth.flyTo(this.app.layerManager.getLayer(node.name));
|
|
|
|
+ }, 500);
|
|
|
|
+ } else {
|
|
|
|
+ this.$message.warning("请选择数据图层");
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+</script>
|
|
|
|
+<style scoped>
|
|
|
|
+.treeclass {
|
|
|
|
+ background-color: rgba(0, 0, 0, 0);
|
|
|
|
+ border: solid 1px rgba(255, 255, 255, 0.402);
|
|
|
|
+ position: absolute;
|
|
|
|
+ height: 80px;
|
|
|
|
+ width: 240px;
|
|
|
|
+ top: 0;
|
|
|
|
+ left: 0px;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.terrain1 {
|
|
|
|
+ background-color: rgba(0, 0, 0, 0);
|
|
|
|
+ /* border: solid 1px rgba(255, 255, 255, 0.402); */
|
|
|
|
+ position: absolute;
|
|
|
|
+ height: 100px;
|
|
|
|
+ width: 260px;
|
|
|
|
+ top: 100px;
|
|
|
|
+ left: 35px;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.background {
|
|
|
|
+ background-color: rgba(0, 0, 0, 0.52);
|
|
|
|
+ border: solid 1px rgba(255, 255, 255, 0.402);
|
|
|
|
+ position: absolute;
|
|
|
|
+ height: 180px;
|
|
|
|
+ width: 260px;
|
|
|
|
+ top: 0;
|
|
|
|
+ left: 350px;
|
|
|
|
+}
|
|
|
|
+</style>
|