月球大数据地理空间分析展示平台-【前端】-月球2期前端
surprise
2023-10-26 19a4741002f4208bf7fc951cbf3219897af5699a
src/views/plotting/plotting.vue
@@ -1,8 +1,14 @@
<template>
  <div v-drag class="plottingBox">
  <div
    v-drag
    class="plottingBox"
  >
    <div class="plottingTitle">
      <div class="tileLeft">
        <div class="titleImg" @click="setCloseplotting">
        <div
          class="titleImg"
          @click="setCloseplotting"
        >
          <ArrowLeft />
        </div>
        <div class="titleLable">标绘查询</div>
@@ -12,9 +18,18 @@
      <div class="plotting_content_btn">
        <span class="plotting_content_title">标绘工具</span>
        <div class="plotting_btn">
          <div class="btn_box_d btn_box" @click="setMenuDraw('point')"></div>
          <div class="btn_box_x btn_box" @click="setMenuDraw('polyline')"></div>
          <div class="btn_box_m btn_box" @click="setMenuDraw('polygon')"></div>
          <div
            class="btn_box_d btn_box"
            @click="setMenuDraw('point')"
          ></div>
          <div
            class="btn_box_x btn_box"
            @click="setMenuDraw('polyline')"
          ></div>
          <div
            class="btn_box_m btn_box"
            @click="setMenuDraw('polygon')"
          ></div>
        </div>
      </div>
      <div class="plotting_list">
@@ -32,8 +47,14 @@
            /><span>{{ item.name }}</span>
          </div>
          <div class="plotting_list_tr_btn">
            <div class="tr_btn dw" @click.stop="setLayerLocation(item)"></div>
            <div class="tr_btn sc" @click.stop="setLayerRemove(item)"></div>
            <div
              class="tr_btn dw"
              @click.stop="setLayerLocation(item)"
            ></div>
            <div
              class="tr_btn sc"
              @click.stop="setLayerRemove(item)"
            ></div>
          </div>
        </div>
      </div>
@@ -159,10 +180,11 @@
const setAddEntityPolyline = (res) => {
  var std = [];
  var res_val = res.polyline.positions.getValue();
  var coord = [];
  for (var i in res_val) {
    var geom = setCartesianToEightFour(res_val[i]);
    std.push(geom.lng, geom.lat);
    coord.push([geom.lng, geom.lat]);
  }
  var name = "Plyline#" + plotNum.value.line;
  var layer = Viewer.entities.add({
@@ -171,16 +193,15 @@
      positions: Cesium.Cartesian3.fromDegreesArray(std),
      width: 6,
      material: lineColor.value,
      clampToGround: true,
      //clampToGround: true,
      heightReference: Cesium.HeightReference.CLAMP_TO_GROUND, //设置 HeightReference 高度参考类型为 CLAMP_TO_GROUND 贴地类型
      //classificationType: Cesium.ClassificationType.BOTH, //贴地形和3dtile  BOTH 或 CESIUM_3D_TILE 或 TERRAIN
      verticalOrigin: Cesium.VerticalOrigin.CENTER, // 垂直位置
      horizontalOrigin: Cesium.HorizontalOrigin.CENTER, // 水平位置
    },
  });
  var linestring = turf.lineString([
    [-24, 63],
    [-23, 60],
    [-25, 65],
    [-20, 69],
  ]);
  var linestring = turf.lineString(coord);
  console.log(linestring);
  var wkt = WKT.convert(linestring.geometry);
  list.value.push({
    wkt: wkt,
@@ -209,9 +230,10 @@
      outline: true,
      outlineColor: lineColor.value,
      outlineWidth: 2,
      classificationType: Cesium.ClassificationType.BOTH, //贴地形和3dtile
      classificationType: Cesium.ClassificationType.BOTH, //贴地形和3dtile  BOTH 或 CESIUM_3D_TILE 或 TERRAIN
      clampToGround: true, //开启贴地
      height: 0,
      heightReference: Cesium.HeightReference.CLAMP_TO_GROUND, //设置 HeightReference 高度参考类型为 CLAMP_TO_GROUND 贴地类型
    },
  });
@@ -219,7 +241,7 @@
  var polygon = turf.polygon([coord]);
  var wkt = WKT.convert(polygon.geometry);
  console.log(polygon.geometry);
  let turfPoint = [];
  polygon.geometry.coordinates[0].forEach((e) => {
    turfPoint.push(turf.point(e));
@@ -227,7 +249,7 @@
  var features = turf.featureCollection(turfPoint);
  var center = turf.center(features);
  console.log(center);
  list.value.push({
    wkt: wkt,
    name: name,
@@ -252,7 +274,6 @@
  emits("setCloseplotting", false);
};
const resultShow = (res) => {
  console.log(res);
  let obj = {
    isshow: true,
    entitiesData: res,
@@ -265,6 +286,7 @@
watch(
  () => store.state.plottingInquireData,
  (nVal, oVal) => {
    if(!nVal)return
    if (nVal.isshow == false) {
      //列表删除联动
      if (nVal.entitiesData != {} && nVal.entitiesData.name) {
@@ -274,6 +296,7 @@
            break;
          }
        }
        store.state.plottingInquireData = null
      }
    }
  },
@@ -344,8 +367,8 @@
          margin-right: 18px;
        }
        .btn_box_d {
          width: 17px;
          height: 18px;
          width: 30px;
          height: 30px;
          background: url("../../assets/img/d.png") no-repeat center;
          background-size: 100% 100%;
        }
@@ -354,8 +377,8 @@
          background-size: 100% 100%;
        }
        .btn_box_x {
          width: 26px;
          height: 27px;
          width: 30px;
          height: 30px;
          background: url("../../assets/img/x.png") no-repeat center;
          background-size: 100% 100%;
        }
@@ -364,8 +387,8 @@
          background-size: 100% 100%;
        }
        .btn_box_m {
          width: 22px;
          height: 20px;
          width: 30px;
          height: 30px;
          background: url("../../assets/img/m.png") no-repeat center;
          background-size: 100% 100%;
          margin-right: 0;