Kaynağa Gözat

添加运行轨迹

Renxy 2 yıl önce
ebeveyn
işleme
5ffd4d5471

+ 2 - 0
src/components/FloodControl/indexCenter.js

@@ -41,6 +41,8 @@ class index extends PureComponent {
             ShowIconType.Car,
             ShowIconType.Waterlogging,
             ShowIconType.Video,
+            ShowIconType.Rainfall,
+            ShowIconType.Flow,
             ShowIconType.All,
           ]}
         />

+ 19 - 0
src/components/Map/Project.js

@@ -75,9 +75,27 @@ class Project extends PureComponent {
       this.icon = new BMapGL.Icon(imgWaterPump, new BMapGL.Size(30, 30));
     }
   }
+  polyline = null;
+
+  showLine(show) {
+    const { points, map } = this.props;
+    if (show) {
+      this.polyline = new BMapGL.Polyline(points, {
+        strokeColor: "#fff",
+        strokeWeight: 3,
+        strokeOpacity: 0.5,
+        strokeStyle: "dashed",
+      });
+      map.addOverlay(this.polyline);
+    } else {
+      map.removeOverlay(this.polyline);
+      this.polyline = null;
+    }
+  }
 
   startLushu() {
     const { points, map } = this.props;
+    this.showLine(true);
     // 删除历史的路书动画
     if (this.lushu) {
       this.lushu.clear();
@@ -94,6 +112,7 @@ class Project extends PureComponent {
       enableRotation: false,
       onComplete: () => {
         this.clearLushu();
+        this.showLine(false);
       },
     });
     this.lushu = lushu;