浏览代码

Merge branch 'dev' of http://192.168.0.115:3000/bill/traffic-laser into dev

jinx 1 年之前
父节点
当前提交
ba3f0fa5e6
共有 2 个文件被更改,包括 28 次插入1 次删除
  1. 26 1
      src/graphic/Renderer/Draw.js
  2. 2 0
      src/graphic/enum/VectorStyle.js

+ 26 - 1
src/graphic/Renderer/Draw.js

@@ -538,7 +538,31 @@ export default class Draw {
     }
   }
 
-  drawRoadTip() {}
+  drawRoadTip(vector) {
+    let width;
+    if (vector.way === "twoWay") {
+      width = vector.leftWidth / vector.leftDrivewayCount;
+    } else {
+      width = vector.singleRoadWidth / vector.singleRoadDrivewayCount;
+    }
+    width = width.toFixed(0);
+
+    vector.roadWidthTipsPos.forEach((line) => {
+      const width = help.getRealDistance(line.start, line.end);
+      const start = coordinate.getScreenXY(line.start);
+      const end = coordinate.getScreenXY(line.end);
+
+      const [style] = help.setVectorStyle(this.context, vector, ["NormalLine"]);
+      help.drawStyleLine(this.context, [start, end]);
+      help.drawLineText(this.context, start, end, width, {
+        fillColor: "#fff",
+        padding: 6,
+        fontSize: 12,
+        backColor: style.strokeStyle,
+      });
+      this.drawLineArrow([start, end], true);
+    });
+  }
 
   drawLan(lan, focus) {
     const ctx = this.context;
@@ -581,6 +605,7 @@ export default class Draw {
       if (flag) {
         const point1 = coordinate.getScreenXY(edgeVector.start);
         const point2 = coordinate.getScreenXY(edgeVector.end);
+
         help.drawStyleLine(
           ctx,
           [point1, point2],

+ 2 - 0
src/graphic/enum/VectorStyle.js

@@ -1,5 +1,7 @@
 import UIEvents from "./UIEvents";
 const VectorStyle = {
+  // 路沿线
+  AlongLine: "AlongLine",
   // 单实线
   SingleSolidLine: "SingleSolidLine",
   // 单虚线