|
@@ -82,6 +82,7 @@
|
|
|
import axios from "axios";
|
|
|
import { GetGDlnfo, GetXzqhTree } from "../../../api/map";
|
|
|
import { keys } from "lodash";
|
|
|
+import { handlerModel, clearTranslate } from "./modelLayering";
|
|
|
let gwtype;
|
|
|
export default {
|
|
|
name: "clickQuery",
|
|
@@ -241,17 +242,20 @@ export default {
|
|
|
handleTabClick(item, a) {
|
|
|
this.activeLayerId = item.name;
|
|
|
},
|
|
|
+ // 设置数据
|
|
|
+ setData() {
|
|
|
+ this.dataSourceLayer = new Cesium.CustomDataSource("query");
|
|
|
+ this.viewer.dataSources.add(this.dataSourceLayer);
|
|
|
+ this.activeLayerId = "0";
|
|
|
+ this.queryResults = {};
|
|
|
+ this.queryResultsGeom = {};
|
|
|
+ },
|
|
|
/**
|
|
|
- * 左键点击查询
|
|
|
+ * 左键点击查询图层
|
|
|
*/
|
|
|
mapLayerQuery() {
|
|
|
- this.dataSourceLayer = new Cesium.CustomDataSource("query");
|
|
|
- this.viewer.dataSources.add(this.dataSourceLayer);
|
|
|
+ this.setData();
|
|
|
let that = this;
|
|
|
- that.activeLayerId = "0";
|
|
|
- that.queryResults = {};
|
|
|
- that.queryResultsGeom = {};
|
|
|
- that.viewer.entities.removeAll();
|
|
|
this.handler.setInputAction(async function (movement) {
|
|
|
that.activeLayerId = "0";
|
|
|
that.layerList = [];
|
|
@@ -408,6 +412,22 @@ export default {
|
|
|
that.removeMapLayerQuery();
|
|
|
}, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
|
|
|
},
|
|
|
+ /**
|
|
|
+ * 左键点击模型查询
|
|
|
+ */
|
|
|
+ mapModelQuery() {
|
|
|
+ this.setData();
|
|
|
+ let that = this;
|
|
|
+ this.handler.setInputAction(async function (movement) {
|
|
|
+ that.viewer.entities.removeAll();
|
|
|
+ that.dataSourceLayer.entities.removeAll();
|
|
|
+ handlerModel(movement);
|
|
|
+ }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
|
|
|
+ this.handler.setInputAction(async function (movement) {
|
|
|
+ that.removeMapLayerQuery();
|
|
|
+ clearTranslate();
|
|
|
+ }, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
|
|
|
+ },
|
|
|
/**
|
|
|
* 超图
|
|
|
* 根据返回的三维对象查询数据信息
|
|
@@ -511,27 +531,29 @@ export default {
|
|
|
return uriArr.join("/");
|
|
|
},
|
|
|
//地图数据查询事件
|
|
|
- changleQueryItem(item){
|
|
|
+ changleQueryItem(item) {
|
|
|
switch (item.index) {
|
|
|
case 1: {
|
|
|
this.mapLayerQuery(); //图层点击事件
|
|
|
break;
|
|
|
}
|
|
|
case 2: {
|
|
|
- console.log('我是模型点击');
|
|
|
+ this.mapModelQuery();
|
|
|
break;
|
|
|
}
|
|
|
case 3: {
|
|
|
this.removeMapLayerQuery(); //清除
|
|
|
+ clearTranslate();
|
|
|
break;
|
|
|
}
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
},
|
|
|
beforeDestroy() {
|
|
|
this.removeMapLayerQuery();
|
|
|
+ clearTranslate();
|
|
|
},
|
|
|
};
|
|
|
</script>
|