|
@@ -16,6 +16,8 @@
|
|
<script>
|
|
<script>
|
|
import { Collect, GetResourceTree, GetMyCollect } from "@/api/map";
|
|
import { Collect, GetResourceTree, GetMyCollect } from "@/api/map";
|
|
import LayerLegend from "./LayerLegend.vue";
|
|
import LayerLegend from "./LayerLegend.vue";
|
|
|
|
+import xml2js from "xml2js";
|
|
|
|
+let geoLayers = [];
|
|
export default {
|
|
export default {
|
|
name: "LayerManage",
|
|
name: "LayerManage",
|
|
components: { LayerLegend },
|
|
components: { LayerLegend },
|
|
@@ -449,12 +451,11 @@ export default {
|
|
null;
|
|
null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (type == "split"){
|
|
|
|
|
|
+ if (type == "split") {
|
|
this.bus.$emit("setImagerySplit", obj, obj.checked, splitId, true);
|
|
this.bus.$emit("setImagerySplit", obj, obj.checked, splitId, true);
|
|
- }else if(type == "share"){
|
|
|
|
- this.bus.$emit("setShareResources", obj, obj.checked, -2, true);
|
|
|
|
|
|
+ } else if (type == "share") {
|
|
|
|
+ this.bus.$emit("setShareResources", obj, obj.checked, -2, true);
|
|
}
|
|
}
|
|
-
|
|
|
|
} else {
|
|
} else {
|
|
if (obj.title.indexOf("雨水") > -1 || obj.title.indexOf("管线") > -1) {
|
|
if (obj.title.indexOf("雨水") > -1 || obj.title.indexOf("管线") > -1) {
|
|
console.log(obj.checked, "obj.checked");
|
|
console.log(obj.checked, "obj.checked");
|
|
@@ -531,17 +532,42 @@ export default {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
-
|
|
|
|
|
|
+ async getPos() {
|
|
|
|
+ let url = "http://192.168.60.52:28085/geoserver/wms";
|
|
|
|
+ let params = {
|
|
|
|
+ service: "WMS",
|
|
|
|
+ version: "1.1.1",
|
|
|
|
+ request: "GetCapabilities",
|
|
|
|
+ };
|
|
|
|
+ let res = await axios.get(url, { params });
|
|
|
|
+ new xml2js.Parser().parseString(res.data, (err, result) => {
|
|
|
|
+ geoLayers = result.WMT_MS_Capabilities.Capability[0].Layer[0].Layer;
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ async flyTogeo(obj) {
|
|
|
|
+ if (geoLayers) await this.getPos();
|
|
|
|
+ let ser = geoLayers.find((li) => li.Title.indexOf(obj.fwmc) >= 0);
|
|
|
|
+ if (ser) {
|
|
|
|
+ let pos = ser.LatLonBoundingBox[0]["$"];
|
|
|
|
+ viewer.camera.flyTo({
|
|
|
|
+ destination: Cesium.Rectangle.fromDegrees(
|
|
|
|
+ pos.minx,
|
|
|
|
+ pos.miny,
|
|
|
|
+ pos.maxx,
|
|
|
|
+ pos.maxy
|
|
|
|
+ ),
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ },
|
|
//图层定位
|
|
//图层定位
|
|
location(obj) {
|
|
location(obj) {
|
|
let imageryLayers = viewer.imageryLayers;
|
|
let imageryLayers = viewer.imageryLayers;
|
|
if (obj.serverType == "geoserver") {
|
|
if (obj.serverType == "geoserver") {
|
|
switch (obj.type) {
|
|
switch (obj.type) {
|
|
case "wms":
|
|
case "wms":
|
|
- console.log("11", this.layerparams[obj.id]);
|
|
|
|
- break;
|
|
|
|
case "wmts":
|
|
case "wmts":
|
|
- console.log("11", this.layerparams[obj.id]);
|
|
|
|
|
|
+ // console.log("11", this.layerparams[obj.id]);
|
|
|
|
+ this.flyTogeo(obj);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
} else if (obj.serverType == "arcgis") {
|
|
} else if (obj.serverType == "arcgis") {
|