|
@@ -133,7 +133,7 @@ import * as tdsy from "@/views/cockpit/js/tdsy";
|
|
|
|
|
|
import * as wellknown from "wellknown";
|
|
|
import * as turf from "@turf/turf";
|
|
|
-
|
|
|
+import { loadGeoJSON } from "@/utils/MapHelper/help.js";
|
|
|
import CockpitVector from "@/components/Query/clickQuery/CockpitVector.vue";
|
|
|
let BoxCommonVector_entity = null;
|
|
|
let layerSources = {};
|
|
@@ -224,29 +224,30 @@ export default {
|
|
|
})
|
|
|
);
|
|
|
tdsy.layersObj[lid] = layer;
|
|
|
- this.loadGeoJSON(geom, lid);
|
|
|
- },
|
|
|
- loadGeoJSON(geojson, id, yanse, isfly = true) {
|
|
|
- let polygon = Cesium.GeoJsonDataSource.load(geojson, {
|
|
|
- clampToGround: true,
|
|
|
- stroke: yanse
|
|
|
- ? Cesium.Color.fromCssColorString(yanse)
|
|
|
- : Cesium.Color.RED.withAlpha(0),
|
|
|
- fill: yanse
|
|
|
- ? Cesium.Color.fromCssColorString(yanse).withAlpha(0.3)
|
|
|
- : Cesium.Color.WHITE.withAlpha(0),
|
|
|
- strokeWidth: isfly ? 5 : 2,
|
|
|
- zIndex: isfly ? 10 : 5,
|
|
|
- });
|
|
|
- polygon.then(function (dataSource) {
|
|
|
- viewer.dataSources.add(dataSource);
|
|
|
- layerSources[id] = dataSource;
|
|
|
- if (isfly)
|
|
|
- viewer.flyTo(dataSource, {
|
|
|
- offset: new Cesium.HeadingPitchRange(0, -45),
|
|
|
- });
|
|
|
+ loadGeoJSON(geom, null, { isfly: true }, (data) => {
|
|
|
+ layerSources[lid] = data;
|
|
|
});
|
|
|
},
|
|
|
+ // loadGeoJSON(geojson, id, yanse, isfly = true) {
|
|
|
+ // let polygon = Cesium.GeoJsonDataSource.load(geojson, {
|
|
|
+ // clampToGround: true,
|
|
|
+ // stroke: yanse
|
|
|
+ // ? Cesium.Color.fromCssColorString(yanse)
|
|
|
+ // : Cesium.Color.RED.withAlpha(0),
|
|
|
+ // fill: yanse
|
|
|
+ // ? Cesium.Color.fromCssColorString(yanse).withAlpha(0.3)
|
|
|
+ // : Cesium.Color.WHITE.withAlpha(0),
|
|
|
+ // strokeWidth: isfly ? 5 : 2,
|
|
|
+ // });
|
|
|
+ // polygon.then(function (dataSource) {
|
|
|
+ // viewer.dataSources.add(dataSource);
|
|
|
+ // layerSources[id] = dataSource;
|
|
|
+ // if (isfly)
|
|
|
+ // viewer.flyTo(dataSource, {
|
|
|
+ // offset: new Cesium.HeadingPitchRange(0, -45),
|
|
|
+ // });
|
|
|
+ // });
|
|
|
+ // },
|
|
|
multiPolygonToPolygons(multiPolygon) {
|
|
|
const polygons = [];
|
|
|
multiPolygon.coordinates.forEach((polygonCoordinates) => {
|
|
@@ -408,7 +409,14 @@ export default {
|
|
|
offset: new Cesium.HeadingPitchRange(0, -45),
|
|
|
});
|
|
|
} else {
|
|
|
- this.loadGeoJSON(item.geom, "h_" + item.index, "#ff0000");
|
|
|
+ loadGeoJSON(
|
|
|
+ item.geom,
|
|
|
+ "#ff0000",
|
|
|
+ { isfly: true, sw: 5 },
|
|
|
+ (data) => {
|
|
|
+ layerSources["h_" + item.index] = data;
|
|
|
+ }
|
|
|
+ );
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -631,8 +639,15 @@ export default {
|
|
|
// else this.draw_vector_tdgy_gy_jd(newVal);
|
|
|
else {
|
|
|
newVal.forEach((res, index) => {
|
|
|
+ res.type = "图斑上图";
|
|
|
res.index = index;
|
|
|
- if (res.geom) this.loadGeoJSON(res.geom, index, "#55A1E3", false);
|
|
|
+ if (res.geom)
|
|
|
+ loadGeoJSON(res.geom, "#55A1E3", {}, (data) => {
|
|
|
+ layerSources[index] = data;
|
|
|
+ data.entities.values.forEach((entity) => {
|
|
|
+ entity.properties = res;
|
|
|
+ });
|
|
|
+ });
|
|
|
});
|
|
|
}
|
|
|
},
|
|
@@ -643,7 +658,12 @@ export default {
|
|
|
// tdsy.layersObj[newVal].show = true;
|
|
|
}
|
|
|
if (oldVal && layerSources[oldVal]) {
|
|
|
- viewer.dataSources.remove(layerSources[oldVal]);
|
|
|
+ try {
|
|
|
+ viewer.dataSources.remove(layerSources[oldVal]);
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error);
|
|
|
+ }
|
|
|
+
|
|
|
layerSources[oldVal] = null;
|
|
|
}
|
|
|
console.log(newVal, oldVal, "----");
|