|
@@ -107,6 +107,9 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import { test } from "shelljs";
|
|
|
+import drawData from "./draw.json";
|
|
|
+import ghjgData from "./规划结果.json";
|
|
|
export default {
|
|
|
components: {},
|
|
|
props: {
|
|
@@ -187,10 +190,198 @@ export default {
|
|
|
},
|
|
|
};
|
|
|
},
|
|
|
- mounted() {},
|
|
|
+ mounted() {
|
|
|
+ console.log(drawData, "drawData", ghjgData);
|
|
|
+ this.init_hyqy();
|
|
|
+ // ghjgData.features.forEach((el,i) =>{
|
|
|
+ // this.creatPolyGon(el)
|
|
|
+ // })
|
|
|
+ this.test();
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ test() {
|
|
|
+ ghjgData.features.forEach((res) => {
|
|
|
+ let obj = {
|
|
|
+ // type: "cockpit",
|
|
|
+ type: "Feature",
|
|
|
+ name: res.properties.kzxxgydmc,
|
|
|
+ ydmj: res.properties.ydmj,
|
|
|
+ // centroid: res.properties.centroid,
|
|
|
+ // adcode: res.properties.adcode,
|
|
|
+ };
|
|
|
+ res.geometry.coordinates.forEach((item) => {
|
|
|
+ const twoDArray = item[0];
|
|
|
+ const oneDArray = twoDArray.reduce(
|
|
|
+ (accumulator, currentValue) => accumulator.concat(currentValue),
|
|
|
+ []
|
|
|
+ );
|
|
|
+
|
|
|
+ viewer.entities.add({
|
|
|
+ // position: Cesium.Cartesian3.fromDegrees(
|
|
|
+ // obj.centroid[0],
|
|
|
+ // res.properties.centroid[1],
|
|
|
+ // 100
|
|
|
+ // ),
|
|
|
+ text: obj.name,
|
|
|
+ label: {
|
|
|
+ scale: 1.5,
|
|
|
+ font: "bolder 16px sans-serif",
|
|
|
+ style: Cesium.LabelStyle.FILL_AND_OUTLINE,
|
|
|
+ text: res.properties.ydmj, //图标名称
|
|
|
+ fillColor: Cesium.Color.fromCssColorString("#ffffff"),
|
|
|
+ pixelOffset: new Cesium.Cartesian2(5, -15),
|
|
|
+ zIndex: 3,
|
|
|
+ // 设置远近裁条件
|
|
|
+ distanceDisplayCondition: new Cesium.DistanceDisplayCondition(
|
|
|
+ 20000,
|
|
|
+ 9999999999.0
|
|
|
+ ),
|
|
|
+ },
|
|
|
+ // billboard: {
|
|
|
+ // // 图像地址,URI或Canvas的属性
|
|
|
+ // image: "./static/images/overview/htq-f.png",
|
|
|
+ // height: 60,
|
|
|
+ // // 宽度(以像素为单位)
|
|
|
+ // width: 150,
|
|
|
+ // // 相对于坐标的垂直位置
|
|
|
+ // // verticalOrigin: Cesium.VerticalOrigin.CENTER,
|
|
|
+ // // // 相对于坐标的水平位置
|
|
|
+ // // horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
|
|
|
+ // scale: 1.0,
|
|
|
+ // zIndex: 2,
|
|
|
+ // // 设置远近裁条件
|
|
|
+ // distanceDisplayCondition: new Cesium.DistanceDisplayCondition(
|
|
|
+ // 20000,
|
|
|
+ // 9999999999.0
|
|
|
+ // ),
|
|
|
+ // show: true,
|
|
|
+ // },
|
|
|
+ properties: obj,
|
|
|
+ polygon: {
|
|
|
+ zIndex: 1,
|
|
|
+ hierarchy: {
|
|
|
+ positions: Cesium.Cartesian3.fromDegreesArray(oneDArray),
|
|
|
+ },
|
|
|
+ // outline: false,
|
|
|
+ // material: Cesium.Color.fromCssColorString(this.xzqh_color),
|
|
|
+ height: 100,
|
|
|
+ // extrudedHeight: res.properties.extrudedHeight,
|
|
|
+ material: Cesium.Color.WHITE.withAlpha(0.2),
|
|
|
+ outline: true,
|
|
|
+ outlineWidth: 3,
|
|
|
+ outlineColor: Cesium.Color.fromCssColorString("#4B93E0"), // 设置远近裁条件
|
|
|
+ // distanceDisplayCondition: new Cesium.DistanceDisplayCondition(
|
|
|
+ // 20000,
|
|
|
+ // 9999999999.0
|
|
|
+ // ),
|
|
|
+ },
|
|
|
+ });
|
|
|
+
|
|
|
+ // let polygon = new Cesium.GeometryInstance({
|
|
|
+ // geometry: new Cesium.PolygonGeometry({
|
|
|
+ // polygonHierarchy: new Cesium.PolygonHierarchy(
|
|
|
+ // Cesium.Cartesian3.fromDegreesArray(oneDArray)
|
|
|
+ // ),
|
|
|
+ // height: 100,
|
|
|
+ // extrudedHeight: res.properties.extrudedHeight,
|
|
|
+
|
|
|
+ // })
|
|
|
+ // })
|
|
|
+
|
|
|
+ // let addPolygonGeometry = new Cesium.Primitive({
|
|
|
+ // geometryInstances: polygon,
|
|
|
+ // appearance: this.colorFun(Cesium.Color.fromCssColorString("rgba(254, 129, 6, 0.1)"))
|
|
|
+
|
|
|
+ // })
|
|
|
+
|
|
|
+ // viewer.scene.primitives.add(addPolygonGeometry)
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ creatPolyGon(item) {
|
|
|
+ let obj = {
|
|
|
+ type: item.type,
|
|
|
+ name: item.properties.kzxxgydmc || "ceshi",
|
|
|
+ };
|
|
|
+ const twoDArray = item.geometry.coordinates[0][0];
|
|
|
+ const oneDArray = twoDArray.reduce(
|
|
|
+ (accumulator, currentValue) => accumulator.concat(currentValue),
|
|
|
+ []
|
|
|
+ );
|
|
|
+
|
|
|
+ viewer.entities.add({
|
|
|
+ // position: Cesium.Cartesian3.fromDegrees(res.properties.centroid[0], res.properties.centroid[1], 500),
|
|
|
+ properties: obj,
|
|
|
+ name: item.properties.kzxxgydmc || "ceshi",
|
|
|
+ polygon: {
|
|
|
+ hierarchy: {
|
|
|
+ positions: Cesium.Cartesian3.fromDegreesArray(oneDArray),
|
|
|
+ },
|
|
|
+ material: Cesium.Color.WHITE.withAlpha(0.2),
|
|
|
+ height: 100,
|
|
|
+ outline: true,
|
|
|
+ outlineWidth: 3,
|
|
|
+ outlineColor: Cesium.Color.fromCssColorString("#4B93E0"),
|
|
|
+ },
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ init_hyqy() {
|
|
|
+ const that = this;
|
|
|
+ drawData.features.forEach((res) => {
|
|
|
+ let obj = {
|
|
|
+ type: "cockpit",
|
|
|
+ // 'name': res.properties.name,
|
|
|
+ // 'centroid': res.properties.centroid,
|
|
|
+ // 'adcode': res.properties.adcode,
|
|
|
+ name: "ceshi",
|
|
|
+ };
|
|
|
+ const twoDArray = res.geometry.coordinates[0];
|
|
|
+ const oneDArray = twoDArray.reduce(
|
|
|
+ (accumulator, currentValue) => accumulator.concat(currentValue),
|
|
|
+ []
|
|
|
+ );
|
|
|
+
|
|
|
+ viewer.entities.add({
|
|
|
+ // position: Cesium.Cartesian3.fromDegrees(res.properties.centroid[0], res.properties.centroid[1], 500),
|
|
|
+ properties: obj,
|
|
|
+ name: "ceshi",
|
|
|
+ polygon: {
|
|
|
+ // zIndex: 1,
|
|
|
+ hierarchy: {
|
|
|
+ positions: Cesium.Cartesian3.fromDegreesArray(oneDArray),
|
|
|
+ },
|
|
|
+ // outline: false,
|
|
|
+ // material: Cesium.Color.fromCssColorString('#FF0000'),
|
|
|
+ material: Cesium.Color.WHITE.withAlpha(0.3),
|
|
|
+ height: 100,
|
|
|
+ // extrudedHeight: 350,
|
|
|
+ outline: true,
|
|
|
+ outlineWidth: 5,
|
|
|
+ // outlineColor : Cesium.Color.BLACK
|
|
|
+ outlineColor: Cesium.Color.fromCssColorString("#FF0000"),
|
|
|
+ },
|
|
|
+ });
|
|
|
+
|
|
|
+ // 设置视图中心点和高度
|
|
|
+ viewer.camera.flyTo({
|
|
|
+ destination: Cesium.Cartesian3.fromDegrees(
|
|
|
+ 109.431774698027056,
|
|
|
+ 18.308104945636849,
|
|
|
+ 20000
|
|
|
+ ), // 设置中心点经纬度和高度
|
|
|
+ // orientation: {
|
|
|
+ // heading: Cesium.Math.toRadians(0), // 设置相机的朝向角度
|
|
|
+ // pitch: Cesium.Math.toRadians(-90), // 设置相机的俯仰角度
|
|
|
+ // roll: 0 // 设置相机的滚动角度
|
|
|
+ // },
|
|
|
+ duration: 3, // 设置飞行时间,单位为秒
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
addprogramme(e, item) {
|
|
|
- console.log(item, "-------");
|
|
|
e.stopPropagation();
|
|
|
const list = this.bgList.filter((item1) => {
|
|
|
return item1 == item;
|
|
@@ -448,7 +639,6 @@ export default {
|
|
|
}
|
|
|
.xz-btn {
|
|
|
width: 100%;
|
|
|
- background: #efefef;
|
|
|
position: absolute;
|
|
|
height: 55px;
|
|
|
z-index: 2;
|