Quellcode durchsuchen

解决高亮图斑不显示问题

maxiaoxiao vor 1 Woche
Ursprung
Commit
0ba8e99f2c
1 geänderte Dateien mit 19 neuen und 3 gelöschten Zeilen
  1. 19 3
      src/views/remote/farmland/index.vue

+ 19 - 3
src/views/remote/farmland/index.vue

@@ -168,6 +168,7 @@ export default {
       vectorLayer: {},
       nowObj: {},
       itemObj: {}, //用于存储分屏高亮的实体
+      itemObj2: {},
       dialogVisible: false,
       TableHeader: TableHeader,
       envelopegeomObj: {}, //用于存储进入页面飞入视角的对象
@@ -293,7 +294,7 @@ export default {
 
     test(item) {
       window.map["mapCon1"].removeLayer(this.itemObj);
-      window.map["mapCon2"].removeLayer(this.itemObj);
+      window.map["mapCon2"].removeLayer(this.itemObj2);
       if (item.geom && item.geom != "") {
         if (typeof item.geom === "string") {
           let geom = item.geom; // this.tableData[i].geom;
@@ -315,14 +316,29 @@ export default {
           },
           zIndex: 9999,
         });
+
         window.map["mapCon1"].getView().animate({
           center: [item["lzb"], item["bzb"]],
           zoom: 16.5,
           duration: 2000, // 动画持续时间,单位毫秒
         });
-
+        this.itemObj2 = new VectorLayer({
+          source: new VectorSource({
+            features: features,
+          }),
+          style: function (feature) {
+            return new Style({
+              stroke: new Stroke({
+                //边界样式
+                color: "rgba(255, 0, 0, 1)",
+                width: 2,
+              }),
+            });
+          },
+          zIndex: 9999,
+        });
         window.map["mapCon1"].addLayer(this.itemObj);
-        window.map["mapCon2"].addLayer(this.itemObj);
+        window.map["mapCon2"].addLayer(this.itemObj2);
       }
     },
     flyto(item) {