xushiting 2 lat temu
rodzic
commit
6b5bebbf75
2 zmienionych plików z 26 dodań i 16 usunięć
  1. 1 1
      src/graphic/Controls/AddRoad.js
  2. 25 15
      src/graphic/Controls/MoveRoad.js

+ 1 - 1
src/graphic/Controls/AddRoad.js

@@ -72,7 +72,7 @@ export default class AddRoad {
       let pointId2 = splitPointIds[i + 1];
       let roadId = roadService.getRoadId(pointId1, pointId2);
       if (!roadId) {
-        //let road = roadService.create(pointId1, pointId2);
+        roadService.create(pointId1, pointId2);
         edgeService.updateEdgeForMulRoad(pointId1);
         edgeService.updateEdgeForMulRoad(pointId2);
       }

+ 25 - 15
src/graphic/Controls/MoveRoad.js

@@ -995,17 +995,24 @@ export default class MoveRoad {
     for (let i = 0; i < curveRoad.points.length; ++i) {
       curveRoad.points[i].x += dx;
       curveRoad.points[i].y += dy;
+
       leftCurveEdge.points[i].x += dx;
       leftCurveEdge.points[i].y += dy;
       rightCurveEdge.points[i].x += dx;
       rightCurveEdge.points[i].y += dy;
     }
+    curveRoad.curves = mathUtil.getCurvesByPoints(curveRoad.points);
+    leftCurveEdge.curves = mathUtil.getCurvesByPoints(leftCurveEdge.points);
+    rightCurveEdge.curves = mathUtil.getCurvesByPoints(rightCurveEdge.points);
 
     for (let i = 0; i < curveRoad.leftLanes.length; ++i) {
       for (let j = 0; j < curveRoad.leftLanes[i].length; ++j) {
         curveRoad.leftLanes[i][j].x += dx;
         curveRoad.leftLanes[i][j].y += dy;
       }
+      curveRoad.leftLanesCurves[i] = mathUtil.getCurvesByPoints(
+        curveRoad.leftLanes[i]
+      );
     }
 
     for (let i = 0; i < curveRoad.rightLanes.length; ++i) {
@@ -1013,6 +1020,9 @@ export default class MoveRoad {
         curveRoad.rightLanes[i][j].x += dx;
         curveRoad.rightLanes[i][j].y += dy;
       }
+      curveRoad.rightLanesCurves[i] = mathUtil.getCurvesByPoints(
+        curveRoad.rightLanes[i]
+      );
     }
   }
 
@@ -1092,21 +1102,21 @@ export default class MoveRoad {
     return true;
   }
 
-  //
-  createRoadForMoveRoad(pointId, roadId, newPosition) {
-    const road = dataService.getRoad(roadId);
-    const dir = roadService.getDirction(pointId, roadId);
-
-    // 第一步是断开连接
-    roadService.subtraRoadFromIntersect(pointId, roadId);
-    // 第二步更新端点坐标
-    const newPointId = road.getPointId(dir);
-    const newPoint = dataService.getPoint(newPointId);
-    newPoint.setPosition(newPosition);
-    // 第三步先新建墙
-    roadService.create(pointId, newPointId);
-    // 还缺少road和newRoad相交,这需要等另一头的point完成后最后处理
-  }
+  // //
+  // createRoadForMoveRoad(pointId, roadId, newPosition) {
+  //   const road = dataService.getRoad(roadId);
+  //   const dir = roadService.getDirction(pointId, roadId);
+
+  //   // 第一步是断开连接
+  //   roadService.subtraRoadFromIntersect(pointId, roadId);
+  //   // 第二步更新端点坐标
+  //   const newPointId = road.getPointId(dir);
+  //   const newPoint = dataService.getPoint(newPointId);
+  //   newPoint.setPosition(newPosition);
+  //   // 第三步先新建墙
+  //   roadService.create(pointId, newPointId);
+  //   // 还缺少road和newRoad相交,这需要等另一头的point完成后最后处理
+  // }
 
   deleteRoadForLinked(roadId) {
     const road = dataService.getRoad(roadId);