管道基础大数据平台系统开发-【前端】-新系統界面
src/components/MapView/mapSpacePop.vue
@@ -1,7 +1,11 @@
<template>
  <div class="menuPop">
    <div style="padding: 5px">
      <el-form :inline="true" :model="formInline" class="demo-form-inline">
      <el-form
        :inline="true"
        :model="formInline"
        class="demo-form-inline"
      >
        <el-form-item>
          <el-select
            v-model="formInline.name"
@@ -41,12 +45,16 @@
          ></el-input>
        </el-form-item>
        <el-form-item>
          <el-button size="small" plain @click="setSpaceTableLayer"
            >查询</el-button
          >
          <el-button plain size="small" @click="restSpacePopLayer"
            >重置</el-button
          >
          <el-button
            size="small"
            plain
            @click="setSpaceTableLayer"
          >查询</el-button>
          <el-button
            plain
            size="small"
            @click="restSpacePopLayer"
          >重置</el-button>
        </el-form-item>
      </el-form>
      <div class="centTable">
@@ -63,12 +71,30 @@
            label="序号"
            width="50"
          />
          <el-table-column label="定位" width="100" align="center">
          <el-table-column
            label="定位"
            width="100"
            align="center"
          >
            <template slot-scope="scope">
              <el-button
                icon="el-icon-map-location"
                size="small"
                @click="spaceLocation(scope.$index, scope.row)"
              ></el-button>
            </template>
          </el-table-column>
          <el-table-column
            label="柱状图"
            width="100"
            align="center"
            v-if="spaceLayer == 'sexplorationpoint'"
          >
            <template slot-scope="scope">
              <el-button
                icon="el-icon-map-location"
                size="small"
                @click="spaceHistogram(scope.$index, scope.row)"
              ></el-button>
            </template>
          </el-table-column>
@@ -192,12 +218,13 @@
      // this.getTableselectFields();
      // this.restSpacePopLayer();
    },
  },
  created() {
    this.spaceLayer = this.$store.state.mapSpaceQueryLayer
    // this.showSpacePopLayer();
    //   this.getTableselectFields();
    this.getDomainsLayer()
  },
@@ -372,6 +399,132 @@
      this.tableData = data.result
      this.$refs.filterTable.doLayout()
    },
    async spaceHistogram(index, row) {
      if (this.$store.state.histogramLayer.length != 0) {
        for (var i in this.$store.state.histogramLayer) {
          Viewer.entities.remove(this.$store.state.histogramLayer[i])
        }
      }
      if (window.histogramHandler != null && Cesium.defined(window.histogramHandler)) {
        window.histogramHandler.removeInputAction(
          Cesium.ScreenSpaceEventType.MOUSE_MOVE
        )
        window.histogramHandler = null
      }
      var param = {
        gid: row.gid,
        name: this.spaceLayer,
      }
      const data1 = await dataQuerySelectWktById(param)
      if (data1.code != 200) {
        this.$message.error("列表调用失败")
      }
      var val1 = decr(data1.result)
      var wkt = this.$wkt.parse(val1)
      var coord = wkt.coordinates
      var obj = {
        pageIndex: 1,
        pageSize: 10,
        name: 'sexplorationpointstratum',
        filter: "exppointid = '" + row.exppointid + "'"
      }
      var data = await dataQuerySelectByPage(obj)
      if (data.code != 200) {
      }
      if (data.result.length != 0) {
        var val = data.result;
        //冒泡排序
        for (var i = 0; i < val.length; i++) {
          for (var u = i + 1; u < val.length; u++) {
            if (val[i].botdepth > val[u].botdepth) {
              var num = val[i];
              val[i] = val[u];
              val[u] = num;
            }
          }
        }
        var outlineList = [
          'rgba(141,135,114,1)',
          'rgba(248,235,179,1)',
          'rgba(185,183,151,1)',
          'rgba(224,222,94,1)',
          'rgba(250,190,153,1)',
          'rgba(197,222,130,1)',
          'rgba(208,228,177,1)',
        ]
        var num = row.elev;
        var height = 0;
        for (var i = 0; i < val.length; i++) {
          var fill, line;
          if (i > outlineList.length) {
            var len = outlineList.length - 1;
            fill = outlineList[len];
            line = outlineList[len];
          } else {
            fill = outlineList[i];
            line = outlineList[i];
          }
          var height = num - val[i].botdepth
          var layer = Viewer.entities.add({
            position: Cesium.Cartesian3.fromDegrees(coord[0], coord[1]),
            tag: 'Histogram',
            properties: val[i],
            ellipse: {
              semiMinorAxis: 1.0, //短轴
              semiMajorAxis: 1.0, //长轴
              height: height, //拉伸高度    elev  gwaterdep
              extrudedHeight: num, //离地高度
              rotation: Cesium.Math.toRadians(0), //旋转
              fill: true, //是否显示圆的填充
              material: Cesium.Color.fromCssColorString(line), //圆的颜色,
              outline: false, //是否显示圆轮廓
            },
          });
          num -= val[i].botdepth;
          this.$store.state.histogramLayer.push(layer)
          sgworld.Navigate.flyToObj(layer)
        }
        window.histogramHandler = new Cesium.ScreenSpaceEventHandler(
          sgworld.Viewer.scene.canvas
        )
        var that = this;
        window.histogramHandler.setInputAction((event) => {
          // var ellipsoid = sgworld.Viewer.scene.globe.ellipsoid;
          // var cartesian = sgworld.Viewer.scene.camera.pickEllipsoid(event.endPosition, ellipsoid);
          var pick = sgworld.Viewer.scene.pick(event.endPosition);
          var selectedEntity = null;
          if (Cesium.defined(pick)) {
            if (pick && pick.id && pick.id.tag && pick.id.tag == "Histogram") {
              that.$store.state.propertiesInfo = {
                title: pick.id.properties._exppointid._value,
                name: pick.id.properties._geoname._value,
                type: pick.id.properties.geotype._value,
                botdepth: pick.id.properties._botdepth._value,
                describe: pick.id.properties._describe._value,
              }
              that.$store.state.propertiesFlag = "2"
            } else {
              that.$store.state.propertiesFlag = null
            }
          } else {
            that.$store.state.propertiesFlag = null
          }
        }, Cesium.ScreenSpaceEventType.MOUSE_MOVE)
      } else {
        var msg = row.exppointid + " 没勘探点地层表数据,无法生成柱状图"
        this.$message.error(msg);
      }
    },
    async spaceLocation(index, row) {
      var param = {
        gid: row.gid,
@@ -411,83 +564,80 @@
      }
      var coord = res.coordinates
      if (res.type == "Point") {
        var val = Cesium.Cartesian3.fromDegrees(
          res.coordinates[0],
          res.coordinates[1]
        )
        this.$store.state.primitLayer = Viewer.entities.add({
          properties: properties,
          tag: "properties_point",
          position: val,
          billboard: {
            // 图像地址,URI或Canvas的属性
            image: SmartEarthRootUrl + "Workers/image/mark.png",
            heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
            // 大小是否以米为单位
            sizeInMeters: false,
            // 相对于坐标的垂直位置
            verticalOrigin: Cesium.VerticalOrigin.CENTER,
            // 相对于坐标的水平位置
            horizontalOrigin: Cesium.HorizontalOrigin.LEFT,
            // 应用于图像的统一比例。比例大于会1.0放大标签,而比例小于会1.0缩小标签。
            scale: 1.0,
            // 是否显示
            show: true,
          },
        })
        this.$store.state.primitLayer.billboard.disableDepthTestDistance =
          Number.POSITIVE_INFINITY
      switch (res.type) {
        case "Point":
          var val = Cesium.Cartesian3.fromDegrees(
            res.coordinates[0],
            res.coordinates[1]
          )
          var point = Viewer.entities.add({
            properties: properties,
            tag: "properties_point",
            position: val,
            billboard: {
              // 图像地址,URI或Canvas的属性
              image: SmartEarthRootUrl + "Workers/image/mark.png",
              heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
              // 大小是否以米为单位
              sizeInMeters: false,
              // 相对于坐标的垂直位置
              verticalOrigin: Cesium.VerticalOrigin.CENTER,
              // 相对于坐标的水平位置
              horizontalOrigin: Cesium.HorizontalOrigin.LEFT,
              // 应用于图像的统一比例。比例大于会1.0放大标签,而比例小于会1.0缩小标签。
              scale: 1.0,
              // 是否显示
              show: true,
            },
          })
          point.billboard.disableDepthTestDistance = Number.POSITIVE_INFINITY
          this.$store.state.queryInfo.push(point)
          sgworld.Navigate.flyToObj(point)
          this.$store.state.primitLayer = point
        sgworld.Navigate.flyToObj(this.$store.state.primitLayer)
      } else if (res.type == "MultiPolygon" || res.type == "LineString") {
        var val = res.coordinates[0][0]
        var std = []
        for (var i in val) {
          std.push(val[i][0])
          std.push(val[i][1])
        }
        this.$store.state.primitLayer = Viewer.entities.add({
          properties: properties,
          tag: "properties_line",
          polyline: {
            positions: Cesium.Cartesian3.fromDegreesArray(std),
            width: 5,
            material: new Cesium.Color(1.0, 0.0, 0.0, 0.3),
            clampToGround: true,
          },
        })
        // this.$store.state.primitLayer = sgworld.Creator.createPolygon(std, {
        //   fillColor: '#ffff00',
        //   outlineColor: '#fff',
        //   outlineWidth: 2
        // }, 1, 0, "面");
        sgworld.Navigate.flyToObj(this.$store.state.primitLayer)
      } else if (res.type == "MultiLineString") {
        var line = res.coordinates[0]
        var std = []
        for (var i in line) {
          std.push({ x: line[i][0], y: line[i][1], z: 1000 })
        }
        const polyline = sgworld.Creator.createPolyline(
          std,
          "#ffff00",
          1,
          0,
          "线"
        )
        const entity =  polyline.item
        entity.properties = properties
        entity.tag =   "properties_line"
        this.$store.state.primitLayer = polyline
        sgworld.Navigate.flyToObj(entity)
          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 polyline = Viewer.entities.add({
            properties: properties,
            tag: "properties_line",
            polyline: {
              positions: Cesium.Cartesian3.fromDegreesArray(std),
              width: 5,
              material: new Cesium.Color(1.0, 0.0, 0.0, 0.3),
              clampToGround: true,
            },
          })
          this.$store.state.queryInfo.push(polyline)
          sgworld.Navigate.flyToObj(polyline)
          this.$store.state.primitLayer = polyline
          break
        case "MultiPolygon":
          var val = res.coordinates[0][0]
          var std = []
          for (var i in val) {
            std.push(val[i][0], val[i][1])
          }
          var entity = Viewer.entities.add({
            properties: properties,
            tag: "properties_polygon",
            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)
          sgworld.Navigate.flyToObj(entity)
          this.$store.state.primitLayer = entity
          break
      }
      this.setMapHandler()
    },
@@ -497,24 +647,12 @@
      )
      window.propertieshandler.setInputAction(event => {
        let pick = sgworld.Viewer.scene.pick(event.position)
        // ;
        if (pick && pick.id && pick.id.tag == "properties_point") {
          this.$store.state.propertiesFlag = "1"
          let properties = pick.id.properties
          let propertyNames = pick.id.properties.propertyNames
          let obj = {}
          obj["eventid"] = properties["_eventid"]._value
          //
          this.attributeData.forEach(item => {
            propertyNames.forEach(itemElement => {
              if (itemElement == item.field) {
                obj[item.alias] = properties[itemElement]._value
              }
            })
          })
          this.$store.state.propertiesInfo = obj
        } else if (pick && pick.id && pick.id._polyline && pick.id.tag == "properties_line") {
        if (
          pick &&
          pick.id &&
          pick.id.tag &&
          pick.id.tag.includes("properties_")
        ) {
          this.$store.state.propertiesFlag = "1"
          let properties = pick.id.properties
          let propertyNames = pick.id.properties.propertyNames