|
@@ -35,7 +35,7 @@
|
|
//这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
|
|
//这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
|
|
import { GetTableData } from '@/api/cockpitNew'
|
|
import { GetTableData } from '@/api/cockpitNew'
|
|
import * as wellknown from "wellknown";
|
|
import * as wellknown from "wellknown";
|
|
-
|
|
|
|
|
|
+import * as turf from "@turf/turf";
|
|
export default {
|
|
export default {
|
|
components: {},
|
|
components: {},
|
|
data() {
|
|
data() {
|
|
@@ -44,6 +44,8 @@ export default {
|
|
handler_multi_level_query: null,
|
|
handler_multi_level_query: null,
|
|
manager_multi_level_query: null,
|
|
manager_multi_level_query: null,
|
|
manager_multi_level_vector: null,
|
|
manager_multi_level_vector: null,
|
|
|
|
+ pick_entity: null,
|
|
|
|
+ pick_entity_geo: null,
|
|
};
|
|
};
|
|
},
|
|
},
|
|
//监听属性 类似于data概念
|
|
//监听属性 类似于data概念
|
|
@@ -52,44 +54,85 @@ export default {
|
|
watch: {},
|
|
watch: {},
|
|
//方法集合
|
|
//方法集合
|
|
methods: {
|
|
methods: {
|
|
|
|
+ switch_show(flag) {
|
|
|
|
+ this.pick_entity.entities.values.forEach((res) => {
|
|
|
|
+ res.show = flag;
|
|
|
|
+ })
|
|
|
|
+ },
|
|
go(e) {
|
|
go(e) {
|
|
const that = this;
|
|
const that = this;
|
|
e.forEach(element => {
|
|
e.forEach(element => {
|
|
- // if (element.filed == "geom") {
|
|
|
|
- // viewer.dataSources.remove(viewer.dataSources.getByName('闪烁')[0]);
|
|
|
|
-
|
|
|
|
- // let geojson = wellknown.parse(element.data);
|
|
|
|
-
|
|
|
|
- // let polygon = Cesium.GeoJsonDataSource.load(geojson, {
|
|
|
|
- // // clampToGround: true,
|
|
|
|
- // stroke: Cesium.Color.RED,
|
|
|
|
- // fill: Cesium.Color.WHITE.withAlpha(0),
|
|
|
|
- // strokeWidth: 5,
|
|
|
|
- // });
|
|
|
|
- // polygon.then(function (dataSource) {
|
|
|
|
- // console.log('dataSource: ', dataSource);
|
|
|
|
- // // 将数据源添加到Cesium Viewer
|
|
|
|
- // viewer.dataSources.add(dataSource);
|
|
|
|
- // dataSource.name = '闪烁';
|
|
|
|
- // viewer.zoomTo(dataSource);
|
|
|
|
|
|
+ if (element.filed == "geom") {
|
|
|
|
+ let geojson = wellknown.parse(element.data);
|
|
|
|
+
|
|
|
|
+ const twoDArray = geojson.coordinates[0];
|
|
|
|
+ const oneDArray = twoDArray.reduce((accumulator, currentValue) => accumulator.concat(currentValue), []);
|
|
|
|
+ that.pick_entity_geo = oneDArray;
|
|
|
|
+
|
|
|
|
+ that.pick_entity.entities.add({
|
|
|
|
+ polygon: {
|
|
|
|
+ // 获取指定属性(positions,holes(图形内需要挖空的区域))
|
|
|
|
+ hierarchy: {
|
|
|
|
+ positions: Cesium.Cartesian3.fromDegreesArray(oneDArray),
|
|
|
|
+ },
|
|
|
|
+ // 边框
|
|
|
|
+ outline: true,
|
|
|
|
+ // 边框颜色
|
|
|
|
+ outlineColor: Cesium.Color.RED,
|
|
|
|
+ // 边框尺寸
|
|
|
|
+ outlineWidth: 2,
|
|
|
|
+ // 填充的颜色,withAlpha透明度
|
|
|
|
+ material: Cesium.Color.GREEN.withAlpha(0),
|
|
|
|
+ // 是否被提供的材质填充
|
|
|
|
+ fill: true,
|
|
|
|
+ // 恒定高度
|
|
|
|
+ height: 1.1,
|
|
|
|
+ // 显示在距相机的距离处的属性,多少区间内是可以显示的
|
|
|
|
+ // distanceDisplayCondition: new Cesium.DistanceDisplayCondition(1000, 10000000),
|
|
|
|
+ // 是否显示
|
|
|
|
+ show: true,
|
|
|
|
+ // 顺序,仅当`clampToGround`为true并且支持地形上的折线时才有效。
|
|
|
|
+ zIndex: 10
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ let flag = true;
|
|
|
|
+ let time = setInterval(() => {
|
|
|
|
+ flag = !flag
|
|
|
|
+ that.switch_show(flag);
|
|
|
|
+ }, 500);
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ clearInterval(time);
|
|
|
|
+ this.pick_entity.entities.values.forEach((res) => {
|
|
|
|
+
|
|
|
|
+ this.pick_entity.entities.remove(res);
|
|
|
|
|
|
- // let time = setInterval(() => {
|
|
|
|
- // dataSource.show = !dataSource.show;
|
|
|
|
- // }, 500);
|
|
|
|
- // setTimeout(() => {
|
|
|
|
- // clearInterval(time);
|
|
|
|
- // viewer.dataSources.remove(viewer.dataSources.getByName('闪烁')[0]);
|
|
|
|
|
|
+ })
|
|
|
|
+ }, 6000)
|
|
|
|
|
|
- // }, 6000);
|
|
|
|
|
|
|
|
|
|
+ // 注意:polygon首尾坐标要一致
|
|
|
|
+ var polygon = turf.polygon([geojson.coordinates[0]]);
|
|
|
|
|
|
- // });
|
|
|
|
- // }
|
|
|
|
|
|
+ var centroid = turf.centroid(polygon).geometry.coordinates;
|
|
|
|
|
|
|
|
+ viewer.camera.flyTo({
|
|
|
|
+ duration: 1,
|
|
|
|
|
|
-
|
|
|
|
|
|
+ destination: Cesium.Cartesian3.fromDegrees(centroid[0],centroid[1],3000),
|
|
|
|
+ // destination: {
|
|
|
|
+ // x: -6283267.004204832,
|
|
|
|
+ // y: 28123682.896774407,
|
|
|
|
+ // z: 23709669.98539126
|
|
|
|
+ // },
|
|
|
|
+ orientation: {
|
|
|
|
+ heading: 6.149339593573709,
|
|
|
|
+ pitch: -1.539825618847483,
|
|
|
|
+ roll: 0
|
|
|
|
+ },
|
|
|
|
+ });
|
|
|
|
+ }
|
|
});
|
|
});
|
|
-
|
|
|
|
},
|
|
},
|
|
handleChange(val) {
|
|
handleChange(val) {
|
|
// console.log(val);
|
|
// console.log(val);
|
|
@@ -174,13 +217,16 @@ export default {
|
|
e.forEach((res) => {
|
|
e.forEach((res) => {
|
|
if (res.filed == 'geom') {
|
|
if (res.filed == 'geom') {
|
|
let geojson = wellknown.parse(res.data);
|
|
let geojson = wellknown.parse(res.data);
|
|
-
|
|
|
|
- that.draw_vector(geojson, e);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ that.draw_vector(geojson, e,);
|
|
}
|
|
}
|
|
})
|
|
})
|
|
});
|
|
});
|
|
|
|
+
|
|
|
|
+ store.state.query_pick_pane.push({
|
|
|
|
+ name: element.dataname,
|
|
|
|
+ value: element.data,
|
|
|
|
+ });
|
|
|
|
+
|
|
// that.draw_vector(e);
|
|
// that.draw_vector(e);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -255,7 +301,6 @@ export default {
|
|
show: true,
|
|
show: true,
|
|
|
|
|
|
})
|
|
})
|
|
-
|
|
|
|
this.manager_multi_level_vector.add(addPolygonGeometry)
|
|
this.manager_multi_level_vector.add(addPolygonGeometry)
|
|
},
|
|
},
|
|
draw_vector(geojson, data) {
|
|
draw_vector(geojson, data) {
|
|
@@ -291,6 +336,10 @@ export default {
|
|
this.manager_multi_level_vector = new Cesium.PrimitiveCollection();
|
|
this.manager_multi_level_vector = new Cesium.PrimitiveCollection();
|
|
this.manager_multi_level_vector.destroyPrimitives = false;
|
|
this.manager_multi_level_vector.destroyPrimitives = false;
|
|
viewer.scene.primitives.add(this.manager_multi_level_vector);
|
|
viewer.scene.primitives.add(this.manager_multi_level_vector);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ that.pick_entity = new Cesium.CustomDataSource("pick_entity");
|
|
|
|
+ viewer.dataSources.add(that.pick_entity);
|
|
})
|
|
})
|
|
|
|
|
|
}, //生命周期 - 挂在完成
|
|
}, //生命周期 - 挂在完成
|