xushiting 2 سال پیش
والد
کامیت
ea5c4ac152

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 1 - 1
server/test/a0k4xu045_202305311600080410/attach/sceneStore


+ 12 - 0
src/graphic/Geometry/CurveRoad.js

@@ -26,4 +26,16 @@ export default class CurveRoad extends Road {
     this.geoType = VectorType.CurveRoad;
     this.setId(vectorId);
   }
+
+  getLanesCount(dir) {
+    if (this.way == Constant.oneWay) {
+      return this.singleCurveRoadDrivewayCount;
+    } else if (this.way == Constant.twoWay) {
+      if (dir == "left") {
+        return this.leftDrivewayCount;
+      } else {
+        return this.rightDrivewayCount;
+      }
+    }
+  }
 }

+ 12 - 0
src/graphic/Geometry/Road.js

@@ -87,4 +87,16 @@ export default class Road extends Geometry {
   setWay(value) {
     this.way = value;
   }
+
+  getLanesCount(dir) {
+    if (this.way == Constant.oneWay) {
+      return this.singleRoadDrivewayCount;
+    } else if (this.way == Constant.twoWay) {
+      if (dir == "left") {
+        return this.leftDrivewayCount;
+      } else {
+        return this.rightDrivewayCount;
+      }
+    }
+  }
 }

+ 12 - 8
src/graphic/Layer.js

@@ -203,31 +203,33 @@ export default class Layer {
         if (selectItem && selectItem.dir && selectItem.vectorId) {
           let road = dataService.getRoad(selectItem.vectorId);
           if (road) {
+            let roadLanCount = road.getLanesCount(selectItem.dir);
             if (selectItem.dir == "left") {
               roadService.updateForAddSubtractLanesCount(
                 road.vectorId,
-                road.leftDrivewayCount + 1,
+                roadLanCount + 1,
                 selectItem.dir
               );
             } else {
               roadService.updateForAddSubtractLanesCount(
                 road.vectorId,
-                road.rightDrivewayCount + 1,
+                roadLanCount + 1,
                 selectItem.dir
               );
             }
           } else {
             road = dataService.getCurveRoad(selectItem.vectorId);
+            let curveRoadLanCount = road.getLanesCount(selectItem.dir);
             if (selectItem.dir == "left") {
               curveRoadService.updateForAddSubtractLanesCount(
                 road.vectorId,
-                road.leftDrivewayCount + 1,
+                curveRoadLanCount + 1,
                 selectItem.dir
               );
             } else {
               curveRoadService.updateForAddSubtractLanesCount(
                 road.vectorId,
-                road.rightDrivewayCount + 1,
+                curveRoadLanCount + 1,
                 selectItem.dir
               );
             }
@@ -241,31 +243,33 @@ export default class Layer {
         if (selectItem && selectItem.dir && selectItem.vectorId) {
           let road = dataService.getRoad(selectItem.vectorId);
           if (road) {
+            let roadLanCount = road.getLanesCount(selectItem.dir);
             if (selectItem.dir == "left") {
               roadService.updateForAddSubtractLanesCount(
                 road.vectorId,
-                road.leftDrivewayCount - 1,
+                roadLanCount - 1,
                 selectItem.dir
               );
             } else {
               roadService.updateForAddSubtractLanesCount(
                 road.vectorId,
-                road.rightDrivewayCount - 1,
+                roadLanCount - 1,
                 selectItem.dir
               );
             }
           } else {
             road = dataService.getCurveRoad(selectItem.vectorId);
+            let curveRoadLanCount = road.getLanesCount(selectItem.dir);
             if (selectItem.dir == "left") {
               curveRoadService.updateForAddSubtractLanesCount(
                 road.vectorId,
-                road.leftDrivewayCount - 1,
+                curveRoadLanCount - 1,
                 selectItem.dir
               );
             } else {
               curveRoadService.updateForAddSubtractLanesCount(
                 road.vectorId,
-                road.rightDrivewayCount - 1,
+                curveRoadLanCount - 1,
                 selectItem.dir
               );
             }

+ 2 - 0
src/graphic/Service/RoadService.js

@@ -1075,6 +1075,7 @@ export default class RoadService {
     let dx2 = (leftEdge.end.x - rightEdge.end.x) / drivewayCount;
     let dy2 = (leftEdge.end.y - rightEdge.end.y) / drivewayCount;
 
+    road.singleLanes = [];
     for (let i = 0; i < drivewayCount - 1; ++i) {
       if (!road.singleLanes[i]) {
         road.singleLanes[i] = {};
@@ -1385,6 +1386,7 @@ export default class RoadService {
       const line = mathUtil.createLine1(leftEdge.start, leftEdge.end);
       const singleRoadWidth = mathUtil.getDisForPoinLine(rightEdge.start, line);
       road.setWidth(singleRoadWidth);
+      road.singleRoadDrivewayCount = newCount;
     }
 
     edgeService.updateEdgeForMulRoad(road.startId);