xushiting 2 yıl önce
ebeveyn
işleme
de89fa6d94

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

@@ -310,7 +310,9 @@ export default class HistoryUtil {
       crossPoint1.edgeInfo1.id == crossPoint2.edgeInfo1.id &&
       crossPoint1.edgeInfo1.dir == crossPoint2.edgeInfo1.dir &&
       crossPoint1.edgeInfo2.id == crossPoint2.edgeInfo2.id &&
-      crossPoint1.edgeInfo2.dir == crossPoint2.edgeInfo2.dir
+      crossPoint1.edgeInfo2.dir == crossPoint2.edgeInfo2.dir &&
+      crossPoint1.style == crossPoint2.style &&
+      crossPoint1.weight == crossPoint2.weight
     ) {
       return false;
     } else {
@@ -563,6 +565,8 @@ export default class HistoryUtil {
       x: crossPoint2.extremePoint.x,
       y: crossPoint2.extremePoint.y,
     };
+    crossPointInfo.style = crossPoint2.style;
+    crossPointInfo.weight = crossPoint2.weight;
     crossPointInfo.curves = JSON.parse(JSON.stringify(crossPoint2.curves));
     this.setCrossPointInfo(crossPointInfo);
   }
@@ -797,6 +801,8 @@ export default class HistoryUtil {
     data.edgeInfo1 = JSON.parse(JSON.stringify(crossPoint.edgeInfo1));
     data.edgeInfo2 = JSON.parse(JSON.stringify(crossPoint.edgeInfo2));
     data.curves = JSON.parse(JSON.stringify(crossPoint.curves));
+    data.style = crossPoint.style;
+    data.weight = crossPoint.weight;
     return data;
   }
 
@@ -1010,6 +1016,8 @@ export default class HistoryUtil {
     crossPoint.edgeInfo1 = JSON.parse(JSON.stringify(crossPointInfo.edgeInfo1));
     crossPoint.edgeInfo2 = JSON.parse(JSON.stringify(crossPointInfo.edgeInfo2));
     crossPoint.curves = JSON.parse(JSON.stringify(crossPointInfo.curves));
+    crossPoint.style = crossPointInfo.style;
+    crossPoint.weight = crossPointInfo.weight;
   }
 }
 

+ 46 - 2
src/graphic/Layer.js

@@ -36,6 +36,7 @@ import { roadService } from "./Service/RoadService";
 import { edgeService } from "./Service/EdgeService";
 import { roadPointService } from "./Service/RoadPointService";
 import { curveRoadService } from "./Service/CurveRoadService";
+import { curveRoadPointService } from "./Service/CurveRoadPointService";
 import VectorCategory from "./enum/VectorCategory";
 import Settings from "./Settings";
 import Constant from "./Constant";
@@ -769,12 +770,13 @@ export default class Layer {
         }
         point = dataService.getCurveRoadPoint(draggingItem.vectorId);
         listenLayer.start(position, {
-          exceptRoadPointId: draggingItem.vectorId,
+          exceptCurveRoadPointId: draggingItem.vectorId,
           exceptCurveRoadId: point.parent, //不会融合,所以parent只有一个
         });
         if (
           listenLayer.modifyPoint &&
-          (listenLayer.modifyPoint.linkedRoadPointId ||
+          (listenLayer.modifyPoint.linkedCurveRoadPointId ||
+            listenLayer.modifyPoint.linkedRoadPointId ||
             listenLayer.modifyPoint.linkedRoadId ||
             listenLayer.modifyPoint.linkedRoadPointIdX ||
             listenLayer.modifyPoint.linkedRoadPointIdY ||
@@ -847,6 +849,9 @@ export default class Layer {
           }
           movePoint.movePoint(position, draggingItem.vectorId);
           point = dataService.getPoint(draggingItem.vectorId);
+          if (point.getCategory() == VectorCategory.Point.FixPoint) {
+            moveText.moveFullText(position, point.linkedTextId);
+          }
           needAutoRedraw = true;
           if (!point) {
             stateService.clearEventName();
@@ -1149,6 +1154,26 @@ export default class Layer {
         break;
       case LayerEvents.MoveCurveRoadPoint:
         needAutoRedraw = true;
+        if (
+          listenLayer.modifyPoint &&
+          listenLayer.modifyPoint.linkedCurveRoadPointId
+        ) {
+          let curveRoadPoint1 = dataService.getCurveRoadPoint(
+            listenLayer.modifyPoint.linkedCurveRoadPointId
+          );
+          let curveRoadPoint2 = dataService.getCurveRoadPoint(
+            draggingItem.vectorId
+          );
+          if (
+            listenLayer.modifyPoint.linkedCurveRoadPointId !=
+              draggingItem.vectorId &&
+            curveRoadPoint1.getParent() == curveRoadPoint2.getParent()
+          ) {
+            curveRoadPointService.deleteCurveRoadPoint(
+              listenLayer.modifyPoint.linkedCurveRoadPointId
+            );
+          }
+        }
         this.history.save();
         break;
       case LayerEvents.MoveCrossPoint:
@@ -1179,6 +1204,25 @@ export default class Layer {
         break;
       case LayerEvents.MoveCurvePoint:
         needAutoRedraw = true;
+        if (
+          listenLayer.modifyPoint &&
+          listenLayer.modifyPoint.linkedCurvePointId
+        ) {
+          let curvePoint1 = dataService.getCurvePoint(
+            listenLayer.modifyPoint.linkedCurvePointId
+          );
+          let curvePoint2 = dataService.getCurvePoint(draggingItem.vectorId);
+          if (
+            listenLayer.modifyPoint.linkedCurvePointId !=
+              draggingItem.vectorId &&
+            curvePoint1.getParent() == curvePoint2.getParent()
+          ) {
+            lineService.deleteCrossPointForCurveLine(
+              listenLayer.modifyPoint.linkedCurvePointId,
+              curvePoint1.getParent()
+            );
+          }
+        }
         this.history.save();
         break;
       case LayerEvents.MoveCurveLine:

+ 2 - 0
src/graphic/Load.js

@@ -277,6 +277,8 @@ export default class Load {
           crossPoint.extremePoint = JSON.parse(
             JSON.stringify(crossPointData.extremePoint)
           );
+          crossPoint.style = crossPointData.style;
+          crossPoint.weight = crossPointData.weight;
           dataService.addCrossPoint(crossPoint);
         }
       }

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

@@ -104,6 +104,8 @@ export default class CurveRoadPointService {
       // road.setLeftLanes(curveRoad.leftLanes);
       // road.setRightLanes(curveRoad.rightLanes);
       // road.setSingleLanes(curveRoad.singleLanes);
+      road.setStyle(curveRoad.style);
+      road.setWeight(curveRoad.weight);
       dataService.addRoad(road);
       edgeService.computerDefaultEdge(road.vectorId);
       roadService.setLanes(road.vectorId);

+ 3 - 0
src/graphic/Service/CurveRoadService.js

@@ -806,6 +806,9 @@ export default class CurveRoadService extends RoadService {
       );
     }
 
+    if (!edgePoints) {
+      return;
+    }
     leftCurveEdge.points = edgePoints.leftEdgePoints;
     leftCurveEdge.start = leftCurveEdge.points[0];
     leftCurveEdge.end = leftCurveEdge.points[leftCurveEdge.points.length - 1];

+ 16 - 9
src/graphic/Service/PointService.js

@@ -11,7 +11,7 @@ export default class PointService {
   create(position, vectorId) {
     let point = new Point(position, vectorId);
     dataService.addPoint(point);
-    this.updateBasePointIds()
+    this.updateBasePointIds();
     return point;
   }
 
@@ -57,6 +57,10 @@ export default class PointService {
         category == VectorCategory.Point.TestBasePoint
       ) {
         this.deleteTestPoint(pointId);
+      } else if (category == VectorCategory.Point.FixPoint) {
+        let textId = point.linkedTextId;
+        dataService.deletePoint(pointId); //暂时简单粗暴
+        dataService.deleteText(textId);
       }
     }
   }
@@ -94,17 +98,16 @@ export default class PointService {
     if (Settings.selectBasePointId == basePointId) {
       Settings.selectBasePointId = null;
     }
-    this.updateBasePointIds()
+    this.updateBasePointIds();
   }
 
   deleteTestPoint(testPointId) {
     let points = dataService.getPoints();
     let needDeletePointIds = [];
     for (let key in points) {
-    
       let point = dataService.getPoint(key);
-      if(point.getCategory() == VectorCategory.Point.BasePoint){
-        continue
+      if (point.getCategory() == VectorCategory.Point.BasePoint) {
+        continue;
       }
       if (point.vectorId == testPointId) {
         needDeletePointIds.push(testPointId);
@@ -122,18 +125,22 @@ export default class PointService {
         needDeletePointIds.indexOf(line.endId) > -1
       ) {
         dataService.deleteLine(key);
-        if (needDeletePointIds.indexOf(line.startId) > -1&& endPoint.getCategory()!= VectorCategory.Point.BasePoint) {
+        if (
+          needDeletePointIds.indexOf(line.startId) > -1 &&
+          endPoint.getCategory() != VectorCategory.Point.BasePoint
+        ) {
           this.deleteTestPoint(line.endId);
         }
-        if (needDeletePointIds.indexOf(line.endId) > -1 && startPoint.getCategory()!= VectorCategory.Point.BasePoint) {
+        if (
+          needDeletePointIds.indexOf(line.endId) > -1 &&
+          startPoint.getCategory() != VectorCategory.Point.BasePoint
+        ) {
           this.deleteTestPoint(line.startId);
         }
       }
     }
     dataService.deletePoint(testPointId);
   }
-
-
 }
 
 const pointService = new PointService();

+ 12 - 0
src/graphic/Util/MathUtil.js

@@ -1725,6 +1725,9 @@ export default class MathUtil {
     let rightEdgePoints = [];
     for (let i = 0; i < points.length - 1; ++i) {
       if (dir == "left" || !dir) {
+        if (mathUtil.equalPoint(points[i], points[i + 1])) {
+          return null;
+        }
         let leftEdgePoins1 = this.RectangleVertex(
           points[i],
           points[i + 1],
@@ -1735,6 +1738,9 @@ export default class MathUtil {
           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],
@@ -1766,6 +1772,9 @@ export default class MathUtil {
       }
 
       if (dir == "right" || !dir) {
+        if (mathUtil.equalPoint(points[i], points[i + 1])) {
+          return null;
+        }
         let rightEdgePoins1 = this.RectangleVertex(
           points[i],
           points[i + 1],
@@ -1776,6 +1785,9 @@ export default class MathUtil {
           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],