jinx 1 year ago
parent
commit
3d1d206df3

+ 2 - 76
src/graphic/CanvasStyle/ImageLabels/SVGIcons.js

@@ -1,75 +1,5 @@
 const SVGIcons = {
-  ZebraCrossing: {
-    text: "尸体",
-    draw: function (ctx, fillStyle, strokeStyle) {
-      ctx.save();
-      ctx.strokeStyle = "rgba(0,0,0,0)";
-      ctx.miterLimit = 4;
-      // ctx.font="15px ''";
-      ctx.fillStyle = "rgba(0,0,0,0)";
-      // ctx.font="   15px ''";
-      ctx.save();
-      ctx.fillStyle = fillStyle;
-      ctx.strokeStyle = strokeStyle;
-      // ctx.font="   15px ''";
-      ctx.beginPath();
-      ctx.arc(32, 13, 8, 0, 6.283185307179586, false);
-      ctx.closePath();
-      ctx.fill();
-      ctx.stroke();
-      ctx.restore();
-      ctx.save();
-      ctx.fillStyle = "rgba(0,0,0,0)";
-      ctx.strokeStyle = strokeStyle;
-      ctx.lineCap = "round";
-      ctx.lineJoin = "round";
-      // ctx.font="   15px ''";
-      ctx.beginPath();
-      ctx.moveTo(32, 44.5);
-      ctx.lineTo(24, 59.5);
-      ctx.fill();
-      ctx.stroke();
-      ctx.restore();
-      ctx.save();
-      ctx.fillStyle = "rgba(0,0,0,0)";
-      ctx.strokeStyle = strokeStyle;
-      ctx.lineCap = "round";
-      ctx.lineJoin = "round";
-      // ctx.font="   15px ''";
-      ctx.beginPath();
-      ctx.moveTo(32, 44.5);
-      ctx.lineTo(40, 59.5);
-      ctx.fill();
-      ctx.stroke();
-      ctx.restore();
-      ctx.save();
-      ctx.fillStyle = "rgba(0,0,0,0)";
-      ctx.strokeStyle = strokeStyle;
-      ctx.lineCap = "round";
-      ctx.lineJoin = "round";
-      // ctx.font="   15px ''";
-      ctx.beginPath();
-      ctx.moveTo(25, 33);
-      ctx.lineTo(32, 21);
-      ctx.lineTo(39, 33);
-      ctx.fill();
-      ctx.stroke();
-      ctx.restore();
-      ctx.save();
-      ctx.fillStyle = "rgba(0,0,0,0)";
-      ctx.strokeStyle = strokeStyle;
-      ctx.lineCap = "round";
-      ctx.lineJoin = "round";
-      // ctx.font="   15px ''";
-      ctx.beginPath();
-      ctx.moveTo(32, 21);
-      ctx.lineTo(32, 44.5);
-      ctx.fill();
-      ctx.stroke();
-      ctx.restore();
-      ctx.restore();
-    },
-  },
+ 
   "chemotuoche_p.svg": {
     text: "侧三轮平面",
     draw: function (ctx, fillStyle, strokeStyle) {
@@ -4280,11 +4210,7 @@ export const imageTypeKeys = [
     ],
   },
 
-  // 道路结构
-  {
-    type: "道路结构",
-    children: ["ZebraCrossing"],
-  },
+ 
 ];
 
 export default SVGIcons;

+ 1 - 1
src/graphic/Geometry/CurveRoadEdge.js

@@ -57,7 +57,7 @@ export default class CurveRoadEdge extends Geometry {
       this.curveRoadSide.points = [];
       this.curveRoadSide.curves = [];
       for (let i = 0; i < curveRoad.points.length; ++i) {
-        this.curveRoadSide.points[i] = mathUtil.getLinePointPos(
+        this.curveRoadSide.points[i] = mathUtil.getLineEndPointPos(
           curveRoad.points[i],
           this.points[i],
           this.curveRoadSide.width

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

@@ -658,7 +658,7 @@ export default class Draw {
           );
         }
 
-        console.log(edgeVector);
+        // console.log(edgeVector);
         edgeVector.style = VectorStyle.SingleSolidLine;
         help.drawStyleLine(
           ctx,

+ 21 - 7
src/graphic/Service/RoadService.js

@@ -1388,7 +1388,7 @@ export default class RoadService {
   initRoadWidthTipsPos(road) {
     let leftEdge = dataService.getRoadEdge(road.leftEdgeId);
     let rightEdge = dataService.getRoadEdge(road.rightEdgeId);
-    // let leftEdgePoint = mathUtil.getLinePointPos(leftEdge.start, leftEdge.end);
+    // let leftEdgePoint = mathUtil.getLineEndPointPos(leftEdge.start, leftEdge.end);
 
     let roadStartPoint = dataService.getRoadPoint(road.startId);
     let roadEndPoint = dataService.getRoadPoint(road.endId);
@@ -1403,15 +1403,29 @@ export default class RoadService {
       },
     };
 
-    // let roadLine = mathUtil.createLine1(road.startId, road.endId);
-    let roadLineCrossPoint = mathUtil.getLinePointPos(roadInfo.start, roadInfo.end);
-
+    let roadLine = mathUtil.createLine1(dataService.getRoadPoint(road.startId), dataService.getRoadPoint(road.endId));
+    let roadLineCrossPoint = mathUtil.getLineEndPointPos(roadInfo.start, roadInfo.end);
+    let CrossPointStartDistance = mathUtil.getDistance(roadStartPoint, roadLineCrossPoint);
+    let leftEdgeDistance = mathUtil.getDistance(leftEdge.start, leftEdge.end);
+    let righttEdgeDistance = mathUtil.getDistance(rightEdge.start, rightEdge.end);
+    if (CrossPointStartDistance > leftEdgeDistance && CrossPointStartDistance > righttEdgeDistance) {
+      let satrtEdgeLine = mathUtil.createLine1(leftEdge.start, rightEdge.start);
+      let endEdgeLine = mathUtil.createLine1(leftEdge.end, rightEdge.end);
+      let satrtEdgeCrossPoint = mathUtil.getIntersectionPoint(satrtEdgeLine, roadLine);
+      let endEdgeCrossPoint = mathUtil.getIntersectionPoint(endEdgeLine, roadLine);
+
+      console.log(satrtEdgeCrossPoint, endEdgeCrossPoint);
+      roadLineCrossPoint = mathUtil.getLineEndPointPos(satrtEdgeCrossPoint, endEdgeCrossPoint);
+    }
+    // if(roadLineCrossPoint){
+    //   let lineLength = this.getDistance(startPoint, endPoint);
+    // }
     let leftEdgeLine = mathUtil.createLine1(leftEdge.start, leftEdge.end);
     let rightEdgeLine = mathUtil.createLine1(rightEdge.start, rightEdge.end);
     let leftEdgePoint = mathUtil.getJoinLinePoint(roadLineCrossPoint, leftEdgeLine);
     let rightEdgePoint = mathUtil.getJoinLinePoint(roadLineCrossPoint, rightEdgeLine);
 
-    // let rightEdgePoint = mathUtil.getLinePointPos(rightEdge.start, rightEdge.end);
+    // let rightEdgePoint = mathUtil.getLineEndPointPos(rightEdge.start, rightEdge.end);
     let edgeLine = mathUtil.createLine1(leftEdgePoint, rightEdgePoint);
     let roadWidthTipsPos = [];
     if (road.way == Constant.oneWay) {
@@ -1465,8 +1479,8 @@ export default class RoadService {
       }
     } else if (road.way == Constant.twoWay) {
       //双单车道
-      // let leftMidDividePoint = mathUtil.getLinePointPos(road.midDivide.leftMidDivide.start, road.midDivide.leftMidDivide.end);
-      // let rightMidDividePoint = mathUtil.getLinePointPos(road.midDivide.rightMidDivide.start, road.midDivide.rightMidDivide.end);
+      // let leftMidDividePoint = mathUtil.getLineEndPointPos(road.midDivide.leftMidDivide.start, road.midDivide.leftMidDivide.end);
+      // let rightMidDividePoint = mathUtil.getLineEndPointPos(road.midDivide.rightMidDivide.start, road.midDivide.rightMidDivide.end);
 
       let leftMidDivideLine = mathUtil.createLine1(road.midDivide.leftMidDivide.start, road.midDivide.leftMidDivide.end);
       let rightMidDividePointLine = mathUtil.createLine1(road.midDivide.rightMidDivide.start, road.midDivide.rightMidDivide.end);

+ 62 - 250
src/graphic/Util/MathUtil.js

@@ -32,8 +32,7 @@ export default class MathUtil {
     }
 
     const parametera = (point1.y - point2.y) / (point1.x - point2.x);
-    const parameterb =
-      (point1.x * point2.y - point2.x * point1.y) / (point1.x - point2.x);
+    const parameterb = (point1.x * point2.y - point2.x * point1.y) / (point1.x - point2.x);
     if (this.getFixed(parametera) == 0) {
       return { y: this.getFixed(parameterb) };
     }
@@ -82,10 +81,7 @@ export default class MathUtil {
     var perpendicularVector = { x: -slope, y: 1 };
 
     // 将垂直向量归一化为单位向量
-    var length = Math.sqrt(
-      perpendicularVector.x * perpendicularVector.x +
-        perpendicularVector.y * perpendicularVector.y
-    );
+    var length = Math.sqrt(perpendicularVector.x * perpendicularVector.x + perpendicularVector.y * perpendicularVector.y);
     perpendicularVector.x /= length;
     perpendicularVector.y /= length;
 
@@ -113,9 +109,7 @@ export default class MathUtil {
   }
 
   distanceForPoints(point1, point2) {
-    return Math.sqrt(
-      Math.pow(point1.x - point2.x, 2) + Math.pow(point1.y - point2.y, 2)
-    );
+    return Math.sqrt(Math.pow(point1.x - point2.x, 2) + Math.pow(point1.y - point2.y, 2));
   }
 
   //与line平行且两条线直接的距离是distance的两条线
@@ -206,10 +200,7 @@ export default class MathUtil {
     if (angle > 180) {
       angle = 360 - angle;
     }
-    if (
-      Math.abs((angle1 + angle3) / 2 - angle) <
-      Math.abs((angle2 + angle4) / 2 - angle)
-    ) {
+    if (Math.abs((angle1 + angle3) / 2 - angle) < Math.abs((angle2 + angle4) / 2 - angle)) {
       return { p1: point1, p2: point3 };
     } else {
       return { p1: point2, p2: point4 };
@@ -247,10 +238,7 @@ export default class MathUtil {
     if (this.isParallel(parameter1, parameter2)) {
       return null;
     }
-    if (
-      typeof parameter1.a == "undefined" &&
-      typeof parameter2.a != "undefined"
-    ) {
+    if (typeof parameter1.a == "undefined" && typeof parameter2.a != "undefined") {
       if (parameter1.x) {
         return {
           x: parameter1.x,
@@ -262,10 +250,7 @@ export default class MathUtil {
           y: parameter1.y,
         };
       }
-    } else if (
-      typeof parameter2.a == "undefined" &&
-      typeof parameter1.a != "undefined"
-    ) {
+    } else if (typeof parameter2.a == "undefined" && typeof parameter1.a != "undefined") {
       if (parameter2.x) {
         return {
           x: parameter2.x,
@@ -277,16 +262,10 @@ export default class MathUtil {
           y: parameter2.y,
         };
       }
-    } else if (
-      typeof parameter2.a == "undefined" &&
-      typeof parameter1.a == "undefined"
-    ) {
+    } else if (typeof parameter2.a == "undefined" && typeof parameter1.a == "undefined") {
       if (parameter1.hasOwnProperty("x") && parameter2.hasOwnProperty("y")) {
         return { x: parameter1.x, y: parameter2.y };
-      } else if (
-        parameter1.hasOwnProperty("y") &&
-        parameter2.hasOwnProperty("x")
-      ) {
+      } else if (parameter1.hasOwnProperty("y") && parameter2.hasOwnProperty("x")) {
         return { x: parameter2.x, y: parameter1.y };
       } else {
         return null;
@@ -297,11 +276,8 @@ export default class MathUtil {
       return null;
     }
 
-    let joinpointx =
-      (parameter2.b - parameter1.b) / (parameter1.a - parameter2.a);
-    let joinpointy =
-      (parameter1.a * parameter2.b - parameter2.a * parameter1.b) /
-      (parameter1.a - parameter2.a);
+    let joinpointx = (parameter2.b - parameter1.b) / (parameter1.a - parameter2.a);
+    let joinpointy = (parameter1.a * parameter2.b - parameter2.a * parameter1.b) / (parameter1.a - parameter2.a);
 
     let point = { x: joinpointx, y: joinpointy };
     return point;
@@ -318,17 +294,8 @@ export default class MathUtil {
     }
 
     // 线段所在直线的交点坐标 (x , y)
-    const x =
-      ((b.x - a.x) * (d.x - c.x) * (c.y - a.y) +
-        (b.y - a.y) * (d.x - c.x) * a.x -
-        (d.y - c.y) * (b.x - a.x) * c.x) /
-      denominator;
-    const y =
-      -(
-        (b.y - a.y) * (d.y - c.y) * (c.x - a.x) +
-        (b.x - a.x) * (d.y - c.y) * a.y -
-        (d.x - c.x) * (b.y - a.y) * c.y
-      ) / denominator;
+    const x = ((b.x - a.x) * (d.x - c.x) * (c.y - a.y) + (b.y - a.y) * (d.x - c.x) * a.x - (d.y - c.y) * (b.x - a.x) * c.x) / denominator;
+    const y = -((b.y - a.y) * (d.y - c.y) * (c.x - a.x) + (b.x - a.x) * (d.y - c.y) * a.y - (d.x - c.x) * (b.y - a.y) * c.y) / denominator;
 
     return { x: x, y: y };
   }
@@ -340,12 +307,7 @@ export default class MathUtil {
       const x = join.x;
       const y = join.y; // 交点在线段1上 且交点也在线段2上
       /** 2 判断交点是否在两条线段上 **/
-      if (
-        (x - a.x) * (x - b.x) <= 0.001 &&
-        (y - a.y) * (y - b.y) <= 0.001 &&
-        (x - c.x) * (x - d.x) <= 0.001 &&
-        (y - c.y) * (y - d.y) <= 0.001
-      ) {
+      if ((x - a.x) * (x - b.x) <= 0.001 && (y - a.y) * (y - b.y) <= 0.001 && (x - c.x) * (x - d.x) <= 0.001 && (y - c.y) * (y - d.y) <= 0.001) {
         // 返回交点p
         return {
           x: x,
@@ -503,8 +465,7 @@ export default class MathUtil {
     if (!minDis) {
       minDis = Constant.minLen;
     }
-    let dis1 =
-      this.getDistance(startPoint, point) + this.getDistance(endPoint, point);
+    let dis1 = this.getDistance(startPoint, point) + this.getDistance(endPoint, point);
     let dis2 = this.getDistance(startPoint, endPoint);
     if (Math.abs(dis1 - dis2) < minDis) {
       return true;
@@ -572,8 +533,7 @@ export default class MathUtil {
       const xj = pt2.x;
       const yj = pt2.y;
 
-      const intersect =
-        yi > y != yj > y && x < ((xj - xi) * (y - yi)) / (yj - yi) + xi;
+      const intersect = yi > y != yj > y && x < ((xj - xi) * (y - yi)) / (yj - yi) + xi;
       if (intersect) inside = !inside;
     }
 
@@ -582,9 +542,7 @@ export default class MathUtil {
 
   //a表示横轴,b表示竖轴
   isPointInElliptic(point, center, a, b) {
-    let r =
-      Math.pow((point.x - center.x) / a, 2) +
-      Math.pow((point.y - center.y) / b, 2);
+    let r = Math.pow((point.x - center.x) / a, 2) + Math.pow((point.y - center.y) / b, 2);
 
     if (r <= 1) {
       return true;
@@ -602,10 +560,7 @@ export default class MathUtil {
     const dis = this.getDistance(point1, point2);
     const dis1 = this.getDistance(join, point1);
     const dis2 = this.getDistance(join, point2);
-    if (
-      this.getDistance(join, point1) > dis ||
-      this.getDistance(join, point2) > dis
-    ) {
+    if (this.getDistance(join, point1) > dis || this.getDistance(join, point2) > dis) {
       // 在线段外
       if (dis1 < dis2 && dis1 < minDistance) {
         return { type: 1, join: point1 };
@@ -626,10 +581,7 @@ export default class MathUtil {
   }
 
   PointInSegment(Q, pi, pj, minDis) {
-    if (
-      this.getDistance(Q, pi) < Constant.minAdsorbPix ||
-      this.getDistance(Q, pj) < Constant.minAdsorbPix
-    ) {
+    if (this.getDistance(Q, pi) < Constant.minAdsorbPix || this.getDistance(Q, pj) < Constant.minAdsorbPix) {
       return true;
     }
 
@@ -684,11 +636,7 @@ export default class MathUtil {
     const dot_product_AP = AP.x * AB_direction.x + AP.y * AB_direction.y;
     const dot_product_BP = BP.x * AB_direction.x + BP.y * AB_direction.y;
     //return dot_product_AP >= 0 && dot_product_BP <= 0 && Math.abs(AP.x * BP.y - AP.y * BP.x) <= AB_length * Number.EPSILON;
-    return (
-      dot_product_AP >= 0 &&
-      dot_product_BP <= 0 &&
-      Math.abs(AP.x * BP.y - AP.y * BP.x) <= 0.01
-    );
+    return dot_product_AP >= 0 && dot_product_BP <= 0 && Math.abs(AP.x * BP.y - AP.y * BP.x) <= 0.01;
   }
 
   clonePoint(p1, p2) {
@@ -747,12 +695,7 @@ export default class MathUtil {
     }
     const join = this.getIntersectionPoint2(point1, point2, point3, point4);
     if (join != null) {
-      if (
-        this.getDistance(point1, join) > dis &&
-        this.getDistance(point2, join) > dis &&
-        this.getDistance(point3, join) > dis &&
-        this.getDistance(point4, join) > dis
-      ) {
+      if (this.getDistance(point1, join) > dis && this.getDistance(point2, join) > dis && this.getDistance(point3, join) > dis && this.getDistance(point4, join) > dis) {
         if (
           this.getDistance(point1, join) < this.getDistance(point1, point2) &&
           this.getDistance(point2, join) < this.getDistance(point1, point2) &&
@@ -765,10 +708,7 @@ export default class MathUtil {
         }
       }
     } else {
-      if (
-        this.PointInSegment(point1, point3, point4) ||
-        this.PointInSegment(point2, point3, point4)
-      ) {
+      if (this.PointInSegment(point1, point3, point4) || this.PointInSegment(point2, point3, point4)) {
         return true;
       }
     }
@@ -874,8 +814,7 @@ export default class MathUtil {
       return 0;
     }
     let s = points[0].y * (points[point_num - 1].x - points[1].x);
-    for (let i = 1; i < point_num; ++i)
-      s += points[i].y * (points[i - 1].x - points[(i + 1) % point_num].x);
+    for (let i = 1; i < point_num; ++i) s += points[i].y * (points[i - 1].x - points[(i + 1) % point_num].x);
     return Math.abs(s / 2.0);
   }
 
@@ -883,13 +822,7 @@ export default class MathUtil {
   getPolygonCore(points) {
     function Area(p0, p1, p2) {
       let area = 0.0;
-      area =
-        p0.x * p1.y +
-        p1.x * p2.y +
-        p2.x * p0.y -
-        p1.x * p0.y -
-        p2.x * p1.y -
-        p0.x * p2.y;
+      area = p0.x * p1.y + p1.x * p2.y + p2.x * p0.y - p1.x * p0.y - p2.x * p1.y - p0.x * p2.y;
       return area / 2;
     }
 
@@ -1357,15 +1290,9 @@ export default class MathUtil {
 
     let delta;
     if (v > 1) {
-      delta = this.pointMinus(
-        p1,
-        this.pointPlus(pt, this.pointScale(this.pointMinus(p2, pt), 1 / v))
-      );
+      delta = this.pointMinus(p1, this.pointPlus(pt, this.pointScale(this.pointMinus(p2, pt), 1 / v)));
     } else {
-      delta = this.pointMinus(
-        this.pointPlus(pt, this.pointScale(this.pointMinus(p1, pt), v)),
-        p2
-      );
+      delta = this.pointMinus(this.pointPlus(pt, this.pointScale(this.pointMinus(p1, pt), v)), p2);
     }
     delta = this.pointScale(delta, scale);
 
@@ -1384,12 +1311,7 @@ export default class MathUtil {
     const curves = [];
     let preControl1, preControl2;
     for (let i = 0; i < points.length - 2; i++) {
-      const { control1, control2 } = this.getCurvesControls(
-        points[i],
-        points[i + 1],
-        points[i + 2],
-        scale
-      );
+      const { control1, control2 } = this.getCurvesControls(points[i], points[i + 1], points[i + 2], scale);
 
       curves.push({
         start: points[i],
@@ -1452,9 +1374,7 @@ export default class MathUtil {
       const xs1 = m1 < 0 ? -1 : 1;
       const xs2 = m2 < 0 ? -1 : 1;
 
-      t1 =
-        (-b - (m1 * xs1) ** (1 / 3) * xs1 - (m2 * xs2) ** (1 / 3) * xs2) /
-        (3 * a);
+      t1 = (-b - (m1 * xs1) ** (1 / 3) * xs1 - (m2 * xs2) ** (1 / 3) * xs2) / (3 * a);
       // 涉及虚数,可不考虑。i ** 2 = -1
     }
 
@@ -1473,16 +1393,8 @@ export default class MathUtil {
 
       if (A > 0 && T < 1 && T > -1) {
         t1 = (-b - 2 * A ** (1 / 2) * Math.cos(theta / 3)) / (3 * a);
-        t2 =
-          (-b +
-            A ** (1 / 2) *
-              (Math.cos(theta / 3) + 3 ** (1 / 2) * Math.sin(theta / 3))) /
-          (3 * a);
-        t3 =
-          (-b +
-            A ** (1 / 2) *
-              (Math.cos(theta / 3) - 3 ** (1 / 2) * Math.sin(theta / 3))) /
-          (3 * a);
+        t2 = (-b + A ** (1 / 2) * (Math.cos(theta / 3) + 3 ** (1 / 2) * Math.sin(theta / 3))) / (3 * a);
+        t3 = (-b + A ** (1 / 2) * (Math.cos(theta / 3) - 3 ** (1 / 2) * Math.sin(theta / 3))) / (3 * a);
       }
     }
     return [t1, t2, t3];
@@ -1503,16 +1415,8 @@ export default class MathUtil {
     const { x: cx1, y: cy1 } = cp1;
     const { x: cx2, y: cy2 } = cp2;
 
-    const x =
-      x1 * (1 - t) * (1 - t) * (1 - t) +
-      3 * cx1 * t * (1 - t) * (1 - t) +
-      3 * cx2 * t * t * (1 - t) +
-      x2 * t * t * t;
-    const y =
-      y1 * (1 - t) * (1 - t) * (1 - t) +
-      3 * cy1 * t * (1 - t) * (1 - t) +
-      3 * cy2 * t * t * (1 - t) +
-      y2 * t * t * t;
+    const x = x1 * (1 - t) * (1 - t) * (1 - t) + 3 * cx1 * t * (1 - t) * (1 - t) + 3 * cx2 * t * t * (1 - t) + x2 * t * t * t;
+    const y = y1 * (1 - t) * (1 - t) * (1 - t) + 3 * cy1 * t * (1 - t) * (1 - t) + 3 * cy2 * t * t * (1 - t) + y2 * t * t * t;
     return { x, y };
   }
 
@@ -1527,16 +1431,8 @@ export default class MathUtil {
     // 参数化方式在曲线上取一系列的点
     var pointsOnCurve = [];
     for (var t = 0; t <= 1; t += 0.01) {
-      var x =
-        Math.pow(1 - t, 3) * p0.x +
-        3 * Math.pow(1 - t, 2) * t * p1.x +
-        3 * (1 - t) * Math.pow(t, 2) * p2.x +
-        Math.pow(t, 3) * p3.x;
-      var y =
-        Math.pow(1 - t, 3) * p0.y +
-        3 * Math.pow(1 - t, 2) * t * p1.y +
-        3 * (1 - t) * Math.pow(t, 2) * p2.y +
-        Math.pow(t, 3) * p3.y;
+      var x = Math.pow(1 - t, 3) * p0.x + 3 * Math.pow(1 - t, 2) * t * p1.x + 3 * (1 - t) * Math.pow(t, 2) * p2.x + Math.pow(t, 3) * p3.x;
+      var y = Math.pow(1 - t, 3) * p0.y + 3 * Math.pow(1 - t, 2) * t * p1.y + 3 * (1 - t) * Math.pow(t, 2) * p2.y + Math.pow(t, 3) * p3.y;
       pointsOnCurve.push({ x: x, y: y });
     }
 
@@ -1544,10 +1440,7 @@ export default class MathUtil {
     var shortestDistance = Number.MAX_VALUE;
     var closestPoint;
     for (var i = 0; i < pointsOnCurve.length; i++) {
-      var distance = Math.sqrt(
-        Math.pow(pointsOnCurve[i].x - target.x, 2) +
-          Math.pow(pointsOnCurve[i].y - target.y, 2)
-      );
+      var distance = Math.sqrt(Math.pow(pointsOnCurve[i].x - target.x, 2) + Math.pow(pointsOnCurve[i].y - target.y, 2));
       if (distance < shortestDistance) {
         shortestDistance = distance;
         closestPoint = pointsOnCurve[i];
@@ -1564,23 +1457,11 @@ export default class MathUtil {
     const { x: offsetX, y: offsetY } = position;
     let results = [];
     // 用 x 求出对应的 t,用 t 求相应位置的 y,再比较得出的 y 与 offsetY 之间的差值
-    const tsx = this.getThreeBezierT(
-      curve.start.x,
-      curve.controls[0].x,
-      curve.controls[1].x,
-      curve.end.x,
-      offsetX
-    );
+    const tsx = this.getThreeBezierT(curve.start.x, curve.controls[0].x, curve.controls[1].x, curve.end.x, offsetX);
     console.log(tsx);
     for (let x = 0; x < 3; x++) {
       if (tsx[x] <= 1 && tsx[x] >= 0) {
-        const point = this.getThreeBezierPoint(
-          tsx[x],
-          curve.start,
-          curve.controls[0],
-          curve.controls[1],
-          curve.end
-        );
+        const point = this.getThreeBezierPoint(tsx[x], curve.start, curve.controls[0], curve.controls[1], curve.end);
         // if (Math.abs(point.y - offsetY) < rang) {
         results.push({
           position: point,
@@ -1590,22 +1471,10 @@ export default class MathUtil {
       }
     }
     // 如果上述没有结果,则用 y 求出对应的 t,再用 t 求出对应的 x,与 offsetX 进行匹配
-    const tsy = this.getThreeBezierT(
-      curve.start.y,
-      curve.controls[0].y,
-      curve.controls[1].y,
-      curve.end.y,
-      offsetY
-    );
+    const tsy = this.getThreeBezierT(curve.start.y, curve.controls[0].y, curve.controls[1].y, curve.end.y, offsetY);
     for (let y = 0; y < 3; y++) {
       if (tsy[y] <= 1 && tsy[y] >= 0) {
-        const point = this.getThreeBezierPoint(
-          tsy[y],
-          curve.start,
-          curve.controls[0],
-          curve.controls[1],
-          curve.end
-        );
+        const point = this.getThreeBezierPoint(tsy[y], curve.start, curve.controls[0], curve.controls[1], curve.end);
         // if (Math.abs(point.x - offsetX) < rang) {
         results.push({
           position: point,
@@ -1646,15 +1515,9 @@ export default class MathUtil {
   getHitInfoForCurves(pos, curves, roadWidth) {
     let joinInfo;
     for (const curve of curves) {
-      const tempJoinInfo =
-        curve.controls.length === 2
-          ? this.getHitInfoForThreeBezier(pos, curve, roadWidth / 2)
-          : this.getHitInfoForTwoBezier(pos, curve);
-
-      if (
-        !joinInfo ||
-        (tempJoinInfo && tempJoinInfo.distance < joinInfo.distance)
-      ) {
+      const tempJoinInfo = curve.controls.length === 2 ? this.getHitInfoForThreeBezier(pos, curve, roadWidth / 2) : this.getHitInfoForTwoBezier(pos, curve);
+
+      if (!joinInfo || (tempJoinInfo && tempJoinInfo.distance < joinInfo.distance)) {
         joinInfo = tempJoinInfo;
       }
     }
@@ -1663,15 +1526,9 @@ export default class MathUtil {
 
   getHitInfoForCurve(pos, curve, roadWidth) {
     let joinInfo;
-    const tempJoinInfo =
-      curve.controls.length === 2
-        ? this.getHitInfoForThreeBezier(pos, curve, roadWidth / 2)
-        : this.getHitInfoForTwoBezier(pos, curve);
+    const tempJoinInfo = curve.controls.length === 2 ? this.getHitInfoForThreeBezier(pos, curve, roadWidth / 2) : this.getHitInfoForTwoBezier(pos, curve);
 
-    if (
-      !joinInfo ||
-      (tempJoinInfo && tempJoinInfo.distance < joinInfo.distance)
-    ) {
+    if (!joinInfo || (tempJoinInfo && tempJoinInfo.distance < joinInfo.distance)) {
       joinInfo = tempJoinInfo;
     }
     return joinInfo;
@@ -1701,10 +1558,7 @@ export default class MathUtil {
       }
     }
     if (index == -1) {
-      if (
-        minDisToPoint >
-        mathUtil.getDistance(position, points[points.length - 1])
-      ) {
+      if (minDisToPoint > mathUtil.getDistance(position, points[points.length - 1])) {
         return points.length;
       } else {
         return minPointIndex;
@@ -1738,10 +1592,7 @@ export default class MathUtil {
       }
     }
     if ((index = -1)) {
-      if (
-        minDisToPoint >
-        mathUtil.getDistance(position, points[points.length - 1])
-      ) {
+      if (minDisToPoint > mathUtil.getDistance(position, points[points.length - 1])) {
         return points.length - 2;
       } else {
         return minPointIndex;
@@ -1794,43 +1645,23 @@ export default class MathUtil {
         if (mathUtil.equalPoint(points[i], points[i + 1])) {
           return null;
         }
-        let leftEdgePoins1 = this.RectangleVertex(
-          points[i],
-          points[i + 1],
-          leftWidth * 2
-        );
-        let leftLine1 = mathUtil.createLine1(
-          leftEdgePoins1.leftEdgeStart,
-          leftEdgePoins1.leftEdgeEnd
-        );
+        let leftEdgePoins1 = this.RectangleVertex(points[i], points[i + 1], leftWidth * 2);
+        let leftLine1 = mathUtil.createLine1(leftEdgePoins1.leftEdgeStart, leftEdgePoins1.leftEdgeEnd);
         if (i != points.length - 2) {
           if (mathUtil.equalPoint(points[i + 2], points[i + 1])) {
             return null;
           }
-          let leftEdgePoins2 = this.RectangleVertex(
-            points[i + 1],
-            points[i + 2],
-            leftWidth * 2
-          );
-
-          let leftLine2 = mathUtil.createLine1(
-            leftEdgePoins2.leftEdgeStart,
-            leftEdgePoins2.leftEdgeEnd
-          );
+          let leftEdgePoins2 = this.RectangleVertex(points[i + 1], points[i + 2], leftWidth * 2);
+
+          let leftLine2 = mathUtil.createLine1(leftEdgePoins2.leftEdgeStart, leftEdgePoins2.leftEdgeEnd);
           let join = mathUtil.getIntersectionPoint(leftLine1, leftLine2);
           if (join != null) {
             leftEdgePoints[i + 1] = join;
           } else {
-            leftEdgePoints[i + 1] = mathUtil.getJoinLinePoint(
-              points[i + 1],
-              leftLine1
-            );
+            leftEdgePoints[i + 1] = mathUtil.getJoinLinePoint(points[i + 1], leftLine1);
           }
         } else {
-          leftEdgePoints[i + 1] = mathUtil.getJoinLinePoint(
-            points[i + 1],
-            leftLine1
-          );
+          leftEdgePoints[i + 1] = mathUtil.getJoinLinePoint(points[i + 1], leftLine1);
         }
         if (!leftEdgePoints[0]) {
           leftEdgePoints[0] = mathUtil.getJoinLinePoint(points[0], leftLine1);
@@ -1841,43 +1672,23 @@ export default class MathUtil {
         if (mathUtil.equalPoint(points[i], points[i + 1])) {
           return null;
         }
-        let rightEdgePoins1 = this.RectangleVertex(
-          points[i],
-          points[i + 1],
-          rightWidth * 2
-        );
-        let rightLine1 = mathUtil.createLine1(
-          rightEdgePoins1.rightEdgeStart,
-          rightEdgePoins1.rightEdgeEnd
-        );
+        let rightEdgePoins1 = this.RectangleVertex(points[i], points[i + 1], rightWidth * 2);
+        let rightLine1 = mathUtil.createLine1(rightEdgePoins1.rightEdgeStart, rightEdgePoins1.rightEdgeEnd);
         if (i != points.length - 2) {
           if (mathUtil.equalPoint(points[i + 2], points[i + 1])) {
             return null;
           }
-          let rightEdgePoins2 = this.RectangleVertex(
-            points[i + 1],
-            points[i + 2],
-            rightWidth * 2
-          );
-
-          let rightLine2 = mathUtil.createLine1(
-            rightEdgePoins2.rightEdgeStart,
-            rightEdgePoins2.rightEdgeEnd
-          );
+          let rightEdgePoins2 = this.RectangleVertex(points[i + 1], points[i + 2], rightWidth * 2);
+
+          let rightLine2 = mathUtil.createLine1(rightEdgePoins2.rightEdgeStart, rightEdgePoins2.rightEdgeEnd);
           let join = mathUtil.getIntersectionPoint(rightLine1, rightLine2);
           if (join != null) {
             rightEdgePoints[i + 1] = join;
           } else {
-            rightEdgePoints[i + 1] = mathUtil.getJoinLinePoint(
-              points[i + 1],
-              rightLine1
-            );
+            rightEdgePoints[i + 1] = mathUtil.getJoinLinePoint(points[i + 1], rightLine1);
           }
         } else {
-          rightEdgePoints[i + 1] = mathUtil.getJoinLinePoint(
-            points[i + 1],
-            rightLine1
-          );
+          rightEdgePoints[i + 1] = mathUtil.getJoinLinePoint(points[i + 1], rightLine1);
         }
 
         if (!rightEdgePoints[0]) {
@@ -1937,7 +1748,7 @@ export default class MathUtil {
     return `rgb(${r},${g},${b})`;
   }
 
-  //获取选段内距离末端点某个位置点的坐标
+  //获取选段内距离末端点某个位置点的坐标
   /**
    *
    * @param {*} startPoint  //线段起点
@@ -1945,7 +1756,7 @@ export default class MathUtil {
    * @param {*} targetPointDistance  //目标点到终点的距离
    * @returns
    */
-  getLinePointPos(startPoint, endPoint, targetPointDistance) {
+  getLineEndPointPos(startPoint, endPoint, targetPointDistance) {
     if (!targetPointDistance) {
       targetPointDistance = Constant.roadWidthTipsDistance;
     }
@@ -1963,6 +1774,7 @@ export default class MathUtil {
     };
     return targetPoint;
   }
+
 }
 
 const mathUtil = new MathUtil();

+ 1 - 0
src/views/tables/ask.vue

@@ -274,6 +274,7 @@ onMounted(() => {
   display: flex;
   align-items: center;
   justify-content: center;
+  word-break: break-all;
   &.left {
     justify-content: flex-start;
   }

+ 16 - 16
src/views/tables/extract.vue

@@ -8,21 +8,21 @@
         <tr>
           <td width="12%" colspan="2">姓名</td>
           <td width="20%">
-            <div>
+            <div style="white-space: normal; line-height: 24px">
               <input v-model="data.name" />
               <div class="content-box">{{ data.name }}</div>
             </div>
           </td>
           <td width="10%">性别</td>
           <td width="8%">
-            <div>
+            <div style="white-space: normal; line-height: 24px">
               <input v-model="data.sex" />
               <div class="content-box">{{ data.sex }}</div>
             </div>
           </td>
           <td width="20%">身份证号码</td>
           <td width="30%" colspan="2">
-            <div>
+            <div style="white-space: normal; line-height: 24px">
               <input v-model="data.id" />
               <div class="content-box">{{ data.id }}</div>
             </div>
@@ -31,14 +31,14 @@
         <tr>
           <td width="15%" colspan="2">事故时间</td>
           <td width="35%" colspan="3">
-            <div>
+            <div style="white-space: normal; line-height: 24px">
               <input v-model="data.time" />
               <div class="content-box">{{ data.time }}</div>
             </div>
           </td>
           <td width="20%">地点</td>
           <td width="30%" colspan="2">
-            <div>
+            <div style="white-space: normal; line-height: 24px">
               <input v-model="data.address" />
               <div class="content-box">{{ data.address }}</div>
             </div>
@@ -67,7 +67,7 @@
           <td width="5%" rowspan="3">提取登记</td>
           <td colspan="3">A样本盛装容器编号</td>
           <td>
-            <div>
+            <div style="white-space: normal; line-height: 24px">
               <input v-model="data.aNumber" />
               <div class="content-box">{{ data.aNumber }}</div>
             </div>
@@ -75,7 +75,7 @@
           <td width="10%">提取量</td>
           <td>
             <div>
-              <div>
+              <div style="white-space: normal; line-height: 24px">
                 <input v-model="data.aVolume" />
                 <div class="content-box">{{ data.aVolume }}</div>
               </div>
@@ -86,7 +86,7 @@
         <tr>
           <td colspan="3">B样本盛装容器编号</td>
           <td>
-            <div>
+            <div style="white-space: normal; line-height: 24px">
               <input v-model="data.bNumber" />
               <div class="content-box">{{ data.bNumber }}</div>
             </div>
@@ -94,7 +94,7 @@
           <td>提取量</td>
           <td>
             <div>
-              <div>
+              <div style="white-space: normal; line-height: 24px">
                 <input v-model="data.bVolume" />
                 <div class="content-box">{{ data.bVolume }}</div>
               </div>
@@ -105,14 +105,14 @@
         <tr>
           <td colspan="1">消毒名称</td>
           <td colspan="2">
-            <div>
+            <div style="white-space: normal; line-height: 24px">
               <input v-model="data.disinfect" />
               <div class="content-box">{{ data.disinfect }}</div>
             </div>
           </td>
           <td>密封方式</td>
           <td colspan="2">
-            <div>
+            <div style="white-space: normal; line-height: 24px">
               <input v-model="data.sealing" />
               <div class="content-box">{{ data.sealing }}</div>
             </div>
@@ -121,14 +121,14 @@
         <tr>
           <td width="10%" colspan="2">提取人员单位</td>
           <td colspan="2">
-            <div>
+            <div style="white-space: normal; line-height: 24px">
               <input v-model="data.extractUnit" />
               <div class="content-box">{{ data.extractUnit }}</div>
             </div>
           </td>
           <td>提取人员(签名)</td>
           <td colspan="2">
-            <div>
+            <div style="white-space: normal; line-height: 24px">
               <input v-model="data.extractMumber" />
               <div class="content-box">{{ data.extractMumber }}</div>
             </div>
@@ -146,21 +146,21 @@
         <tr>
           <td>被提取人(签名)</td>
           <td colspan="2">
-            <div>
+            <div style="white-space: normal; line-height: 24px">
               <input v-model="data.extractBySign" />
               <div class="content-box">{{ data.extractBySign }}</div>
             </div>
           </td>
           <td>见证人(签名)</td>
           <td colspan="2">
-            <div>
+            <div style="white-space: normal; line-height: 24px">
               <input v-model="data.witnessSign" />
               <div class="content-box">{{ data.witnessSign }}</div>
             </div>
           </td>
           <td>交通警察(签名)</td>
           <td colspan="2">
-            <div>
+            <div style="white-space: normal; line-height: 24px">
               <input v-model="data.policeSign" />
               <div class="content-box">{{ data.policeSign }}</div>
             </div>

+ 1 - 1
src/views/tables/index.vue

@@ -330,7 +330,7 @@ onDeactivated(() => {
         &.downMode {
           padding: 125px 100px 75px;
           width: 1050px;
-          height: 1485px;
+          min-height: 1485px;
           box-sizing: border-box;
 
           // transform: scale(.5) translateY(-52%);