Browse Source

修改需求

bill 1 năm trước cách đây
mục cha
commit
6ecb86d8ff
1 tập tin đã thay đổi với 14 bổ sung6 xóa
  1. 14 6
      src/graphic/Renderer/Draw.js

+ 14 - 6
src/graphic/Renderer/Draw.js

@@ -161,6 +161,9 @@ export const help = {
       (mathUtil.getDistance(p1, p2) * coordinate.res * 1000) / coordinate.ratio
     );
   },
+  getScreenDistance(dis) {
+    return (dis * coordinate.ratio) / (coordinate.res * 1000);
+  },
   getPerpendicularPoint(p1, p2, p3, d) {
     if (p1.x === p2.x) {
       return { x: p3.x + d, y: p3.y };
@@ -225,7 +228,6 @@ export const help = {
       ctx.strokeText(text, -textCenter.x, -textCenter.y);
       ctx.fillStyle = "#000";
       ctx.fillText(text, -textCenter.x, -textCenter.y);
-      console.error("????");
     } else {
       ctx.fillStyle = style.fillColor;
       ctx.fillText(text, -textCenter.x, -textCenter.y);
@@ -692,21 +694,20 @@ export default class Draw {
             targetLine[1] = temp;
           }
 
-          console.log(edgeVector.roadSide.width);
           const tstart = mathUtil.translate(
             targetLine[0],
             targetLine[1],
             targetLine[1],
-            edgeVector.roadSide.width / 100
+            help.getScreenDistance(edgeVector.roadSide.width * 1000)
           );
           const tend = mathUtil.translate(
             targetLine[0],
             targetLine[1],
             targetLine[1],
-            edgeVector.roadSide.width / 100 + 24
+            help.getScreenDistance(edgeVector.roadSide.width * 1000) + 4
           );
 
-          this.drawPoint(targetLine[1]);
+          // this.drawPoint(tstart);
           // this.drawPoint(tend);
           help.drawLineText(
             ctx,
@@ -1202,6 +1203,7 @@ export default class Draw {
         return;
       }
 
+      console.log(line);
       if (line.category !== "ZebraCrossing") {
         const [stylea, attr] = help.getVectorStyle(line, line.category);
         style = {
@@ -1223,6 +1225,10 @@ export default class Draw {
           strokeStyle: line.color,
         };
       }
+
+      if (line && ["MeasureLine", "FreeMeasureLine"].includes(line.category)) {
+        return;
+      }
     } else if (vector.category === VectorCategory.Point.FixPoint) {
       const text = dataService.getText(vector?.linkedTextId);
       if (text) {
@@ -1604,11 +1610,13 @@ export default class Draw {
 
         if (
           [
+            VectorCategory.Line.FreeMeasureLine,
+            VectorCategory.Line.MeasureLine,
             VectorCategory.Line.LocationLineByFixPoint,
             VectorCategory.Line.LocationLineByBasePoint,
           ].includes(vector.category)
         ) {
-          this.drawLineArrow([start, end], true, 10);
+          this.drawLineArrow([start, end], true, 20);
         }
         break;
     }