Переглянути джерело

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

xzw 1 рік тому
батько
коміт
704dff9c0f

+ 5 - 5
src/graphic/Controls/MoveRoad.js

@@ -1033,10 +1033,10 @@ export default class MoveRoad {
     //   );
     // }
     curveRoadService.setLanes(curveRoadId);
-    if (leftCurveEdge.curveRoadSide) {
+    if (leftCurveEdge.roadSide) {
       leftCurveEdge.initCurveRoadSide();
     }
-    if (rightCurveEdge.curveRoadSide) {
+    if (rightCurveEdge.roadSide) {
       rightCurveEdge.initCurveRoadSide();
     }
   }
@@ -1125,10 +1125,10 @@ export default class MoveRoad {
 
     const leftCurveEdge = dataService.getCurveRoadEdge(curveRoad.leftEdgeId);
     const rightCurveEdge = dataService.getCurveRoadEdge(curveRoad.rightEdgeId);
-    if (leftCurveEdge.curveRoadSide) {
+    if (leftCurveEdge.roadSide) {
       leftCurveEdge.initCurveRoadSide();
     }
-    if (rightCurveEdge.curveRoadSide) {
+    if (rightCurveEdge.roadSide) {
       rightCurveEdge.initCurveRoadSide();
     }
   }
@@ -1273,7 +1273,7 @@ export default class MoveRoad {
     if (newWidth > Constant.minRoadSideWidth && newWidth < Constant.maxRoadSideWidth) {
       curveRoadService.updateForWidth(parent, newWidth, dir);
     }
-    if (curveEdge.curveRoadSide) {
+    if (curveEdge.roadSide) {
       curveEdge.initCurveRoadSide();
     }
   }

+ 31 - 29
src/graphic/Geometry/CurveRoadEdge.js

@@ -20,7 +20,7 @@ export default class CurveRoadEdge extends Geometry {
     this.weight = VectorWight.Thinning;
     this.points = points || [];
     this.curves = [];
-    this.curveRoadSide = null;
+    this.roadSide = null;
     this.geoType = VectorType.CurveRoadEdge;
     this.setId(vectorId);
     this.setPositions(start, end);
@@ -53,26 +53,26 @@ export default class CurveRoadEdge extends Geometry {
   }
 
   initCurveRoadSide() {
-    if (!this.curveRoadSide) {
-      this.curveRoadSide = {};
-      this.curveRoadSide["width"] = Constant.roadSideWidth;
+    if (!this.roadSide) {
+      this.roadSide = {};
+      this.roadSide["width"] = Constant.roadSideWidth;
     }
 
     let startPoint = this.start;
     let curveRoad = dataService.getCurveRoad(this.parent);
 
     let endPoint = this.end;
-    // this.setStyle("curveRoadSide");
-    let curveRoadSidePoints = mathUtil.RectangleVertex(startPoint, endPoint, (this.curveRoadSide.width * 2 * window.devicePixelRatio) / coordinate.res);
+    // this.setStyle("roadSide");
+    let curveRoadSidePoints = mathUtil.RectangleVertex(startPoint, endPoint, (this.roadSide.width * 2 * window.devicePixelRatio) / coordinate.res);
 
     for (let key in curveRoad) {
       if (this.vectorId == curveRoad[key]) {
-        this.curveRoadSide.points = [];
+        this.roadSide.points = [];
         if (key == "rightEdgeId") {
-          this.curveRoadSide["start"] = curveRoadSidePoints.rightEdgeStart;
-          this.curveRoadSide["end"] = curveRoadSidePoints.rightEdgeEnd;
-          this.curveRoadSide.points.push(curveRoadSidePoints.rightEdgeStart);
-          this.curveRoadSide.points.push(curveRoadSidePoints.rightEdgeEnd);
+          this.roadSide["start"] = curveRoadSidePoints.rightEdgeStart;
+          this.roadSide["end"] = curveRoadSidePoints.rightEdgeEnd;
+          this.roadSide.points.push(curveRoadSidePoints.rightEdgeStart);
+          this.roadSide.points.push(curveRoadSidePoints.rightEdgeEnd);
 
           const midPoint = {
             x: (curveRoadSidePoints.rightEdgeStart.x + curveRoadSidePoints.rightEdgeEnd.x) / 2,
@@ -83,12 +83,12 @@ export default class CurveRoadEdge extends Geometry {
           const join = mathUtil.getJoinLinePoint(midPoint, parallelLines.line1);
           // let point = curveRoadPointService.create(join);
           // let curveRoadSideMidPoint = { x: point.x, y: point.y };
-          this.curveRoadSide.points.splice(1, 0, join);
+          this.roadSide.points.splice(1, 0, join);
         } else if (key == "leftEdgeId") {
-          this.curveRoadSide["start"] = curveRoadSidePoints.leftEdgeStart;
-          this.curveRoadSide["end"] = curveRoadSidePoints.leftEdgeEnd;
-          this.curveRoadSide.points.push(curveRoadSidePoints.leftEdgeStart);
-          this.curveRoadSide.points.push(curveRoadSidePoints.leftEdgeEnd);
+          this.roadSide["start"] = curveRoadSidePoints.leftEdgeStart;
+          this.roadSide["end"] = curveRoadSidePoints.leftEdgeEnd;
+          this.roadSide.points.push(curveRoadSidePoints.leftEdgeStart);
+          this.roadSide.points.push(curveRoadSidePoints.leftEdgeEnd);
           const midPoint = {
             x: (curveRoadSidePoints.leftEdgeStart.x + curveRoadSidePoints.leftEdgeEnd.x) / 2,
             y: (curveRoadSidePoints.leftEdgeStart.y + curveRoadSidePoints.leftEdgeEnd.y) / 2,
@@ -101,13 +101,12 @@ export default class CurveRoadEdge extends Geometry {
           // console.error(join)
           // console.error(point)
           // let curveRoadSideMidPoint = { x: point.x, y: point.y };
-          this.curveRoadSide.points.splice(1, 0, join);
+          this.roadSide.points.splice(1, 0, join);
         }
       }
     }
-    let curves = mathUtil.getCurvesByPoints(this.curveRoadSide.points);
-    this.curveRoadSide.curves = curves;
-    // console.error(this.curveRoadSide);
+    let curves = mathUtil.getCurvesByPoints(this.roadSide.points);
+    this.roadSide.curves = curves;
     // const midPoint = {
     //   x: (startPoint.x + endPoint.x) / 2,
     //   y: (startPoint.y + endPoint.y) / 2,
@@ -118,27 +117,30 @@ export default class CurveRoadEdge extends Geometry {
 
     // this.addCPoint(curveRoad, join, 1);
 
-    // if (this.curveRoadSide.width) {
+    // if (this.roadSide.width) {
     //   let curveRoad = dataService.getCurveRoad(this.parent);
-    //   this.curveRoadSide.points = [];
-    //   this.curveRoadSide.curves = [];
+    //   this.roadSide.points = [];
+    //   this.roadSide.curves = [];
     //   for (let i = 0; i < curveRoad.points.length; ++i) {
-    //     this.curveRoadSide.points[i] = mathUtil.getLineEndPointPos(
+    //     this.roadSide.points[i] = mathUtil.getLineEndPointPos(
     //       curveRoad.points[i],
     //       this.points[i],
-    //       this.curveRoadSide.width
+    //       this.roadSide.width
     //     );
     //   }
-    //   this.curveRoadSide.curves = mathUtil.getCurvesByPoints(
-    //     this.curveRoadSide.points
+    //   this.roadSide.curves = mathUtil.getCurvesByPoints(
+    //     this.roadSide.points
     //   );
     // }
   }
   setCurveRoadSideWidth(width) {
-    this.curveRoadSide.width = width;
+    this.roadSide.width = width;
     this.initCurveRoadSide();
   }
+  setCurveRoadSide(roadSide) {
+    this.roadSide =JSON.parse(JSON.stringify(roadSide))
+  }
   removeCurveRoadSide() {
-    this.curveRoadSide = null;
+    this.roadSide = null;
   }
 }

+ 5 - 1
src/graphic/History/HistoryUtil.js

@@ -262,7 +262,8 @@ export default class HistoryUtil {
       mathUtil.equalPoints(curveRoadEdge1.points, curveRoadEdge2.points) &&
       curveRoadEdge1.parent == curveRoadEdge2.parent &&
       curveRoadEdge1.style == curveRoadEdge2.style &&
-      curveRoadEdge1.weight == curveRoadEdge2.weight
+      curveRoadEdge1.weight == curveRoadEdge2.weight &&
+      curveRoadEdge1.roadSide == curveRoadEdge2.roadSide 
     ) {
       return false;
     } else {
@@ -515,6 +516,7 @@ export default class HistoryUtil {
     curveRoadEdgeInfo.parent = curveRoadEdge2.parent;
     curveRoadEdgeInfo.style = curveRoadEdge2.style;
     curveRoadEdgeInfo.weight = curveRoadEdge2.weight;
+    curveRoadPointInfo.roadSide == curveRoadEdge2.roadSide 
     this.setCurveRoadEdgeInfo(curveRoadEdgeInfo);
   }
 
@@ -784,6 +786,7 @@ export default class HistoryUtil {
     data.curves = JSON.parse(JSON.stringify(curveRoadEdge.curves));
     data.style = curveRoadEdge.style;
     data.weight = curveRoadEdge.weight;
+    data.roadSide == curveRoadEdge.roadSide 
     return data;
   }
 
@@ -1010,6 +1013,7 @@ export default class HistoryUtil {
     curveRoadEdge.type = curveRoadEdgeInfo.type;
     curveRoadEdge.style = curveRoadEdgeInfo.style;
     curveRoadEdge.weight = curveRoadEdgeInfo.weight;
+    curveRoadEdge.roadSide == curveRoadEdgeInfo.roadSide 
   }
 
   setCurveRoadInfo(curveRoadInfo) {

+ 4 - 4
src/graphic/Layer.js

@@ -222,10 +222,10 @@ export default class Layer {
               }
               let leftEdge = dataService.getCurveRoadEdge(road.leftEdgeId);
               let rightEdge = dataService.getCurveRoadEdge(road.rightEdgeId);
-              if (leftEdge.curveRoadSide) {
+              if (leftEdge.roadSide) {
                 leftEdge.initCurveRoadSide();
               }
-              if (rightEdge.curveRoadSide) {
+              if (rightEdge.roadSide) {
                 rightEdge.initCurveRoadSide();
               }
             }
@@ -272,10 +272,10 @@ export default class Layer {
               let leftEdge = dataService.getCurveRoadEdge(road.leftEdgeId);
               let rightEdge = dataService.getCurveRoadEdge(road.rightEdgeId);
               // 暂时屏蔽 曲路暂时还没有 会报错
-              if (leftEdge.curveRoadSide) {
+              if (leftEdge.roadSide) {
                 leftEdge.initCurveRoadSide();
               }
-              if (rightEdge.curveRoadSide) {
+              if (rightEdge.roadSide) {
                 rightEdge.initCurveRoadSide();
               }
             }

+ 3 - 0
src/graphic/Load.js

@@ -305,6 +305,9 @@ export default class Load {
           curveRoadEdge.setStyle(curveRoadEdgeData.style);
           curveRoadEdge.setWeight(curveRoadEdgeData.weight);
           curveRoadEdge.setParent(curveRoadEdgeData.parent);
+          if(curveRoadEdgeData.roadSide){
+            curveRoadEdge.setCurveRoadSideWidth(curveRoadEdgeData.roadSide)
+          }
           curveEdgeService.setCurves(curveRoadEdge);
         }
       }

+ 1 - 1
src/views/graphic/geos/roadEdge.vue

@@ -116,7 +116,7 @@ watchEffect(() => {
   if (style.value === VectorStyle.RoadSide) {
     if (vector.value.geoType == VectorType.CurveRoadEdge) {
       menus.value[1] = lineWidthMenu[2];
-      lineWidthMenu[2].desc = vector.value.curveRoadSide.width * 1000;
+      lineWidthMenu[2].desc = vector.value.roadSide.width * 1000;
     } else {
       menus.value[1] = lineWidthMenu[2];
       lineWidthMenu[2].desc = vector.value.roadSide.width * 1000;