管道基础大数据平台系统开发-【前端】-新系統界面
1
Surpriseplus
2023-02-16 a92fa5ec4d415ccc42f8c3b7eae7d07cc8418889
src/components/MapView/mapMenuPop.vue
@@ -467,7 +467,20 @@
      this.listdata.name = null;
      this.option = [];
    },
    clearQuerInfo() {
      if (this.$store.state.queryInfo.length != 0) {
        for (var i in this.$store.state.queryInfo) {
          sgworld.Viewer.entities.remove(this.$store.state.queryInfo[i]);
        }
        this.$store.state.queryInfo = [];
        if (this.$store.state.primitLayer != null) {
          sgworld.Creator.DeleteObject(this.$store.state.primitLayer);
          this.$store.state.primitLayer = null;
        }
      }
    },
    setTableAll() {
      this.clearQuerInfo();
      this.signGetPublicKey();
      this.startTableMssage();
      this.listdata.wkt = this.$store.state.mapMenuShpFile;
@@ -628,13 +641,7 @@
      this.showAllImage(data.result);
    },
    async showAllImage(res) {
      if (window.Viewer.scene.primitives.length != null) {
        window.Viewer.scene.primitives.removeAll();
      }
      if (this.$store.state.primitLayer != null) {
        sgworld.Creator.DeleteObject(this.$store.state.primitLayer);
        this.$store.state.primitLayer = null;
      }
      for (var i in res) {
        var param = {
          gid: res[i].gid,
@@ -647,7 +654,7 @@
        var val1 = decr(data.result);
        if (val1) {
          var wkt = this.$wkt.parse(val1);
          this.getprimitiLayer(wkt);
          // this.getprimitiLayer(wkt);
          this.primitivesAddLayer(wkt);
        }
      }
@@ -662,6 +669,7 @@
      }
    },
    primitivesAddLayer(res) {
      debugger
      switch (res.type) {
        case "Point":
          var val = Cesium.Cartesian3.fromDegrees(
@@ -669,34 +677,41 @@
            res.coordinates[1],
            200
          );
          this.$store.state.primitLayer.add({
          var point = Viewer.entities.add({
            position: val,
            image: SmartEarthRootUrl + "Workers/image/mark.png",
            billboard: {
              // 图像地址,URI或Canvas的属性
              image: SmartEarthRootUrl + "Workers/image/mark.png",
              // 大小是否以米为单位
              sizeInMeters: false,
              // 相对于坐标的垂直位置
              verticalOrigin: Cesium.VerticalOrigin.CENTER,
              // 相对于坐标的水平位置
              horizontalOrigin: Cesium.HorizontalOrigin.LEFT,
              // 应用于图像的统一比例。比例大于会1.0放大标签,而比例小于会1.0缩小标签。
              scale: 1.0,
              // 是否显示
              show: true
            }
          });
          this.$store.state.queryInfo.push(point)
          break;
        case "LineString":
        case "MultiLineString":
          var line = res.coordinates[0];
          var std = [];
          for (var i in line) {
            std.push(line[i][0], line[i][1]);
          }
          var instance = new Cesium.GeometryInstance({
            geometry: new Cesium.GroundPolylineGeometry({
          var polyline = Viewer.entities.add({
            polyline: {
              positions: Cesium.Cartesian3.fromDegreesArray(std),
              width: 4.0,
            }),
            attributes: {
              color: Cesium.ColorGeometryInstanceAttribute.fromColor(
                new Cesium.Color(1.0, 0.0, 0.0, 0.3)
              ),
            },
          });
          window.Viewer.scene.primitives.add(
            new Cesium.GroundPolylinePrimitive({
              geometryInstances: instance,
              appearance: new Cesium.PolylineColorAppearance(),
            })
          );
              width: 5,
              material: new Cesium.Color(1.0, 0.0, 0.0, 0.3),
              clampToGround: true,
            }
          })
          this.$store.state.queryInfo.push(polyline)
          break;
        case "MultiPolygon":
          var val = res.coordinates[0][0];
@@ -704,24 +719,16 @@
          for (var i in val) {
            std.push(val[i][0], val[i][1]);
          }
          var primitive = new Cesium.GroundPrimitive({
            //贴地的primitive
            geometryInstances: new Cesium.GeometryInstance({
              geometry: new Cesium.PolygonGeometry({
                //支持CircleGeometry,CorridorGeometry,EllipseGeometry,RectangleGeometry
                polygonHierarchy: new Cesium.PolygonHierarchy(
                  Cesium.Cartesian3.fromDegreesArray(std)
                ),
              }),
              attributes: {
                color: Cesium.ColorGeometryInstanceAttribute.fromColor(
                  new Cesium.Color(1.0, 0.0, 0.0, 0.3)
                ),
              },
            }),
            appearance: Cesium.EllipsoidSurfaceAppearance(),
          });
          window.Viewer.scene.primitives.add(primitive);
          var entity = Viewer.entities.add({
            polygon: {
              hierarchy: Cesium.Cartesian3.fromDegreesArray(std),
              //height : 100000,
              material: new Cesium.Color(1.0, 0.0, 0.0, 0.3),
              outline: true,
              outlineColor: new Cesium.Color(1.0, 0.0, 0.0, 0.3),
            }
          })
          this.$store.state.queryInfo.push(entity)
          break;
      }
    },