浏览代码

fix:删除测试数据

wangsisi 1 周之前
父节点
当前提交
ffab0d9829
共有 2 个文件被更改,包括 0 次插入52 次删除
  1. 0 2
      src/views/warningHome/index.vue
  2. 0 50
      src/views/warningHome/warningMap.js

+ 0 - 2
src/views/warningHome/index.vue

@@ -247,8 +247,6 @@ onMounted(() => {
     alarmLayer = new AlarmLayer(warningMap.kmap);
     staticMapLayers = new StaticMapLayers(warningMap.kmap);
     staticMapPointLayers = new StaticMapPointLayers(warningMap.kmap);
-    // 添加 10 个测试点位(从 warningMap 中调用)
-    warningMap.addTestPointsAroundCenter();
     // setTimeout(() => {
     //   staticMapLayers.show("testpng")
     // },2000)

+ 0 - 50
src/views/warningHome/warningMap.js

@@ -1,17 +1,10 @@
-import config from "@/api/config.js";
 import * as KMap from "@/utils/ol-map/KMap";
 import * as util from "@/common/ol_common.js";
-import Point from "ol/geom/Point.js";
-import Feature from "ol/Feature";
 import VectorLayer from "ol/layer/Vector.js";
-import WKT from "ol/format/WKT.js";
 import ScaleLine from "ol/control/ScaleLine";
-import { useRouter } from "vue-router";
 import Overlay from "ol/Overlay";
 import eventBus from "@/api/eventBus";
 import Style from "ol/style/Style";
-import Icon from "ol/style/Icon";
-import { newPoint } from "@/utils/map.js";
 /**
  * @description 地图层对象
  */
@@ -21,7 +14,6 @@ class HomeMap {
     let vectorStyle = new KMap.VectorStyle();
     this.vectorStyle = vectorStyle;
     that.address = "";
-    this.testPointLayer = null;
   }
 
   initMap(location, target) {
@@ -36,48 +28,6 @@ class HomeMap {
     this.kmap.addControl(scaleLine);
   }
 
-  /**
-   * 在当前地图中心生成并展示 10 个测试点位
-   */
-  addTestPointsAroundCenter() {
-    if (!this.kmap || !this.kmap.map) return;
-    const center = this.kmap.map.getView().getCenter();
-    if (!center || center.length < 2) return;
-    const [lon, lat] = center;
-
-    // 首次创建测试点图层
-    if (!this.testPointLayer) {
-      const vecLayer = new KMap.VectorLayer("testPointLayer", 1200, {
-        visible: true,
-        style: () =>
-          new Style({
-            image: new Icon({
-              src: "/src/assets/images/warningHome/chat/fly-point.png",
-              scale: 0.6,
-            }),
-          }),
-      });
-      this.kmap.addLayer(vecLayer.layer);
-      this.testPointLayer = vecLayer;
-    }
-
-    // 以当前中心为基准生成 10 个随机偏移点位(小范围散点)
-    const points = [];
-    for (let i = 0; i < 10; i++) {
-      const dx = (Math.random() - 0.5) * 0.2;
-      const dy = (Math.random() - 0.5) * 0.2;
-      points.push({
-        id: `test-${i + 1}`,
-        wkt: `POINT(${lon + dx} ${lat + dy})`,
-      });
-    }
-
-    points.forEach((item) => {
-      const feature = newPoint(item);
-      this.testPointLayer.addFeature(feature);
-    });
-  }
-
   addMapListen() {
     let that = this
     // 监听地图点击事件