浏览代码

需要支持画线段

xushiting 2 年之前
父节点
当前提交
cdb1f3419e

+ 37 - 38
src/graphic/CanvasStyle/default.js

@@ -5,31 +5,30 @@ const Road = {
     strokeStyle: "rgba(255,0,0,0.5)",
     fillStyle: "rgba(255,0,0,0.8)",
   },
-}
+};
 
-const Edge = {
+const RoadEdge = {
   ...Road,
   lineWidth: 1,
   // globalAlpha: 0.3
-}
+};
 
 const Lane = {
-  ...Edge,
-  dash: [15, 15]
-}
+  ...RoadEdge,
+  dash: [15, 15],
+};
 
-const CurveRoad = { ...Road }
+const CurveRoad = { ...Road };
 
-const CurveEdge = {
+const CurveRoadEdge = {
   ...CurveRoad,
-  ...Edge
-}
+  ...RoadEdge,
+};
 
 const CurveLan = {
   ...Lane,
-  ...CurveEdge
-}
-
+  ...CurveRoadEdge,
+};
 
 const Tag = {
   strokeStyle: "rgb(255,255,255,1)",
@@ -37,7 +36,7 @@ const Tag = {
   strokeStyle_adding: "rgba(243, 255, 0, 0.8)",
   fillStyle_adding: "rgba(243, 255, 0, 0.8)",
   lineWidth: 1,
-}
+};
 
 const CanvasFont = {
   font: "14px Microsoft YaHei",
@@ -47,75 +46,75 @@ const CanvasFont = {
   textBaseline: "middle",
   miterLimit: 10,
   direction: "ltr",
-}
+};
 
 const Point = {
   strokeStyle: "green",
   fillStyle: "rgb(0, 200, 175)",
   radius: 4,
-}
+};
 
 const RoadPoint = {
-  ...Point
-}
+  ...Point,
+};
 
 const CurvePoint = {
-  ...Point
-}
+  ...Point,
+};
 
 const ControlPoint = {
   ...Point,
-  radius: 8
-}
+  radius: 8,
+};
 
 const Text = {
   ...Tag,
   ...CanvasFont,
-  font: "12px Microsoft YaHei"
-}
+  font: "12px Microsoft YaHei",
+};
 
 const Measure = {
   txt: "rgba(255,255,255,1)", //画墙/选墙的时候 测量值的颜色
   strokeStyle: "rgba(255,255,255,1)",
   lineWidth: 1,
-}
+};
 
 const Element = {
   AddingPoint: {
     radius: 4,
-      fillStyle: "yellow",
-      strokeStyle: "green",
+    fillStyle: "yellow",
+    strokeStyle: "green",
   },
   NewRoad: {
     lineWidth: 4,
-      strokeStyle: "rgba(100,100,100,0.3)",
-      errorStrokeStyle: "rgb(250,63,72,0.3)",
+    strokeStyle: "rgba(100,100,100,0.3)",
+    errorStrokeStyle: "rgb(250,63,72,0.3)",
   },
   CheckLinesX: {
     lineWidth: 2,
-      strokeStyle: "#CED806",
+    strokeStyle: "#CED806",
   },
   CheckLinesY: {
     lineWidth: 2,
-      strokeStyle: "#CED806",
+    strokeStyle: "#CED806",
   },
   VCheckLinesX: {
     lineWidth: 2,
-      strokeStyle: "#CED806",
+    strokeStyle: "#CED806",
     //strokeStyle: 'rgba(100,149,237,0.5)',
   },
   VCheckLinesY: {
     lineWidth: 2,
-      strokeStyle: "#CED806",
+    strokeStyle: "#CED806",
     //strokeStyle: 'rgba(100,149,237,0.5)',
   },
-}
+};
 
 export default {
   Road,
   CurveRoad,
-  Edge,
-  CurveEdge,
+  RoadEdge,
+  CurveRoadEdge,
   Lane,
   CurveLan,
   Point,
@@ -126,5 +125,5 @@ export default {
   Font: CanvasFont,
   Measure,
   Element,
-  RoadPoint
-}
+  RoadPoint,
+};

+ 17 - 19
src/graphic/CanvasStyle/focus.js

@@ -1,53 +1,51 @@
-import def from './default.js'
+import def from "./default.js";
 
 const Road = {
   ...def.Road,
   strokeStyle: "rgba(243, 255, 0, 1)",
-}
+};
 
 const CurveRoad = {
   ...def.CurveRoad,
-  ...Road
-}
+  ...Road,
+};
 
 const Tag = {
   ...def.Tag,
   strokeStyle: "#00C8AF",
   fillStyle: "#00C8AF",
-}
+};
 
 const Point = {
   ...def.Point,
   lineWidth: 2,
   fillStyle: "rgba(245, 255, 0, 1)",
   strokeStyle: "rgba(245, 255, 255, 1)",
-}
+};
 
 const RoadPoint = {
   ...Point,
-}
+};
 
 const CurvePoint = {
   ...def.CurvePoint,
-  ...Point
-}
+  ...Point,
+};
 
 const ControlPoint = {
   ...def.ControlPoint,
   ...Point,
-}
-
+};
 
 const Edg = {
-  ...def.Edge,
+  ...def.RoadEdge,
   strokeStyle: "rgba(243, 255, 0, 1)",
-}
+};
 
-const CurveEdge = {
-  ...def.CurveEdge,
+const CurveRoadEdge = {
+  ...def.CurveRoadEdge,
   strokeStyle: "rgba(243, 255, 0, 1)",
-}
-
+};
 
 export default {
   Road,
@@ -58,5 +56,5 @@ export default {
   ControlPoint,
   CurveRoad,
   Edg,
-  CurveEdge
-}
+  CurveRoadEdge,
+};

+ 20 - 20
src/graphic/CanvasStyle/select.js

@@ -1,51 +1,51 @@
-import def from './default.js'
+import def from "./default.js";
 
 const Road = {
   ...def.Road,
   strokeStyle: "rgba(243, 255, 0, 1)",
-}
+};
 
 const CurveRoad = {
   ...def.CurveRoad,
-  ...Road
-}
+  ...Road,
+};
 
 const Tag = {
   ...def.Tag,
   strokeStyle: "#00C8AF",
   fillStyle: "#00C8AF",
-}
+};
 
-const Edge = {
-  ...def.Edge,
+const RoadEdge = {
+  ...def.RoadEdge,
   strokeStyle: "rgba(243, 255, 0, 1)",
-}
+};
 
-const CurveEdge = {
-  ...def.CurveEdge,
+const CurveRoadEdge = {
+  ...def.CurveRoadEdge,
   strokeStyle: "rgba(243, 255, 0, 1)",
-}
+};
 
 const Point = {
   ...def.Point,
   lineWidth: 2,
   fillStyle: "rgba(245, 255, 0, 1)",
   strokeStyle: "rgba(245, 255, 255, 1)",
-}
+};
 
 const RoadPoint = {
-  ...Point
-}
+  ...Point,
+};
 
 const CurvePoint = {
   ...def.CurvePoint,
-  ...Point
-}
+  ...Point,
+};
 
 const ControlPoint = {
   ...def.ControlPoint,
   ...Point,
-}
+};
 
 export default {
   Road,
@@ -55,6 +55,6 @@ export default {
   CurvePoint,
   ControlPoint,
   CurveRoad,
-  Edge,
-  CurveEdge
-}
+  RoadEdge,
+  CurveRoadEdge,
+};

+ 68 - 0
src/graphic/Controls/AddLine.js

@@ -0,0 +1,68 @@
+import { dataService } from "../Service/DataService";
+import { lineService } from "../Service/LineService";
+import { listenLayer } from "../ListenLayer";
+
+export default class AddLine {
+  constructor() {
+    this.startInfo = {};
+    this.endInfo = {};
+  }
+
+  setPointInfo(dir, pointInfo) {
+    if (dir == "start") {
+      this.startInfo = {
+        position: {
+          x: pointInfo.x,
+          y: pointInfo.y,
+        },
+        linkedRoadPointId: pointInfo.linkedRoadPointId,
+        linkedRoadId: pointInfo.linkedRoadId,
+      };
+    } else if (dir == "end") {
+      this.endInfo = {
+        position: {
+          x: pointInfo.x,
+          y: pointInfo.y,
+        },
+        linkedRoadPointId: pointInfo.linkedRoadPointId,
+        linkedRoadId: pointInfo.linkedRoadId,
+      };
+    }
+  }
+
+  setNewLinePoint(dir, position) {
+    if (dir == "start") {
+      if (listenLayer.modifyPoint) {
+        this.setPointInfo(dir, listenLayer.modifyPoint);
+      } else {
+        this.setPointInfo(dir, position);
+      }
+      return true;
+    } else if (dir == "end") {
+      if (listenLayer.modifyPoint) {
+        this.setPointInfo(dir, listenLayer.modifyPoint);
+      } else {
+        this.setPointInfo(dir, position);
+      }
+      return true;
+    }
+    return false;
+  }
+
+  buildLine() {
+    lineService.create(
+      this.startInfo.position,
+      this.endInfo.position,
+      vectorId
+    );
+    listenLayer.clear();
+  }
+
+  clear() {
+    this.startInfo = {};
+    this.endInfo = {};
+  }
+}
+
+const addLine = new AddLine();
+export { addLine };

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

@@ -3,7 +3,7 @@ import Constant from "../Constant";
 import { mathUtil } from "../Util/MathUtil";
 import { dataService } from "../Service/DataService";
 import { roadPointService } from "../Service/RoadPointService";
-import { curvePointService } from "../Service/CurvePointService";
+import { curveRoadPointService } from "../Service/CurveRoadPointService";
 import { curveRoadService } from "../Service/CurveRoadService";
 import { stateService } from "../Service/StateService";
 import VectorType from "../enum/VectorType";
@@ -24,7 +24,7 @@ export default class AddRoad {
           x: pointInfo.x,
           y: pointInfo.y,
         },
-        linkedPointId: pointInfo.linkedPointId,
+        linkedRoadPointId: pointInfo.linkedRoadPointId,
         linkedRoadId: pointInfo.linkedRoadId,
       };
     } else if (dir == "end") {
@@ -33,7 +33,7 @@ export default class AddRoad {
           x: pointInfo.x,
           y: pointInfo.y,
         },
-        linkedPointId: pointInfo.linkedPointId,
+        linkedRoadPointId: pointInfo.linkedRoadPointId,
         linkedRoadId: pointInfo.linkedRoadId,
       };
     }
@@ -104,12 +104,12 @@ export default class AddRoad {
     let hasComputerPointIds = [];
     let hasExitPointIds = [];
 
-    if (this.startInfo.linkedPointId) {
-      hasComputerPointIds.push(this.startInfo.linkedPointId);
-      hasExitPointIds.push(this.startInfo.linkedPointId);
+    if (this.startInfo.linkedRoadPointId) {
+      hasComputerPointIds.push(this.startInfo.linkedRoadPointId);
+      hasExitPointIds.push(this.startInfo.linkedRoadPointId);
       result.push({
         join: { x: this.startInfo.position.x, y: this.startInfo.position.y },
-        pointId: this.startInfo.linkedPointId,
+        pointId: this.startInfo.linkedRoadPointId,
       });
     } else if (this.startInfo.linkedRoadId) {
       result.push({
@@ -122,12 +122,12 @@ export default class AddRoad {
       });
     }
 
-    if (this.endInfo.linkedPointId) {
-      hasComputerPointIds.push(this.endInfo.linkedPointId);
-      hasExitPointIds.push(this.endInfo.linkedPointId);
+    if (this.endInfo.linkedRoadPointId) {
+      hasComputerPointIds.push(this.endInfo.linkedRoadPointId);
+      hasExitPointIds.push(this.endInfo.linkedRoadPointId);
       result.push({
         join: { x: this.endInfo.position.x, y: this.endInfo.position.y },
-        pointId: this.endInfo.linkedPointId,
+        pointId: this.endInfo.linkedRoadPointId,
       });
     } else if (this.endInfo.linkedRoadId) {
       result.push({
@@ -289,9 +289,9 @@ export default class AddRoad {
     return splitPointIds;
   }
 
-  updateStart(position, linkedPointId) {
+  updateStart(position, linkedRoadPointId) {
     mathUtil.clonePoint(this.startInfo.position, position);
-    this.startInfo.linkedPointId = linkedPointId;
+    this.startInfo.linkedRoadPointId = linkedRoadPointId;
   }
 
   setNewRoadPoint(dir, position) {
@@ -316,8 +316,8 @@ export default class AddRoad {
   /******************************************************************************************************************************************************************************/
   buildCurveRoad() {
     console.log("添加曲线路段!");
-    const start = curvePointService.create(this.startInfo.position);
-    const end = curvePointService.create(this.endInfo.position);
+    const start = curveRoadPointService.create(this.startInfo.position);
+    const end = curveRoadPointService.create(this.endInfo.position);
     curveRoadService.create(start.vectorId, end.vectorId);
     listenLayer.clear();
   }

+ 36 - 29
src/graphic/Controls/MoveRoad.js

@@ -22,7 +22,7 @@ export default class MoveRoad {
   // 这个函数不会删除/拆分/合并墙或者点
   moveingRoadPoint(pointId, position, modifyPoint) {
     let point = dataService.getRoadPoint(pointId);
-    let linkedPointId = null;
+    let linkedRoadPointId = null;
     let linkedRoadId = null;
 
     if (modifyPoint != null) {
@@ -30,7 +30,7 @@ export default class MoveRoad {
         x: modifyPoint.x,
         y: modifyPoint.y,
       };
-      linkedPointId = modifyPoint.linkedPointId;
+      linkedRoadPointId = modifyPoint.linkedRoadPointId;
       linkedRoadId = modifyPoint.linkedRoadId;
     }
     if (point.x == position.x && point.y == position.y) {
@@ -41,7 +41,7 @@ export default class MoveRoad {
     let flag = this.canMoveForPoint(
       pointId,
       position,
-      linkedPointId,
+      linkedRoadPointId,
       linkedRoadId
     );
 
@@ -70,10 +70,13 @@ export default class MoveRoad {
     }
     // 与别的墙角重合
     else if (
-      modifyPoint.hasOwnProperty("linkedPointId") &&
-      modifyPoint.linkedPointId != null
+      modifyPoint.hasOwnProperty("linkedRoadPointId") &&
+      modifyPoint.linkedRoadPointId != null
     ) {
-      const roadId = roadService.getRoadId(pointId, modifyPoint.linkedPointId);
+      const roadId = roadService.getRoadId(
+        pointId,
+        modifyPoint.linkedRoadPointId
+      );
       // pointId与linkedPointId属于同一堵墙,不允许,所以不移动
       if (roadId != null) {
         return false;
@@ -98,15 +101,15 @@ export default class MoveRoad {
       point.setPosition(modifyPoint);
     } else {
       if (
-        modifyPoint.hasOwnProperty("linkedPointIdX") &&
-        modifyPoint.linkedPointIdX
+        modifyPoint.hasOwnProperty("linkedRoadPointIdX") &&
+        modifyPoint.linkedRoadPointIdX
       ) {
         point.setPosition(position);
       }
 
       if (
-        modifyPoint.hasOwnProperty("linkedPointIdY") &&
-        modifyPoint.linkedPointIdY
+        modifyPoint.hasOwnProperty("linkedRoadPointIdY") &&
+        modifyPoint.linkedRoadPointIdY
       ) {
         point.setPosition(position);
       }
@@ -366,7 +369,7 @@ export default class MoveRoad {
 
   // 是否可以移动point
   // 两个判断:拖拽的墙(可能是多个),一方面不能与其他墙相交,另一方面这些墙之间或者与别的墙之间的角度必须大于Constant.minAngle
-  canMoveForPoint(pointId, position, linkedPointId, linkedRoadId) {
+  canMoveForPoint(pointId, position, linkedRoadPointId, linkedRoadId) {
     const point = dataService.getRoadPoint(pointId);
     // 先判断第二点(这些墙之间或者与别的墙之间的角度必须大于MinAngle)
     let flag = this.isOKForMinAngleRoad(pointId, position);
@@ -377,7 +380,7 @@ export default class MoveRoad {
         pointId,
         position,
         point.parent,
-        linkedPointId,
+        linkedRoadPointId,
         linkedRoadId
       );
     }
@@ -515,9 +518,9 @@ export default class MoveRoad {
     return result;
   }
 
-  // linkedPointId,linkedRoadId表示吸附
+  // linkedRoadPointId,linkedRoadId表示吸附
   // roadIds是pointId的parent
-  isOKForCross(pointId, position, roadIds, linkedPointId, linkedRoadId) {
+  isOKForCross(pointId, position, roadIds, linkedRoadPointId, linkedRoadId) {
     const roads = dataService.getRoads();
     for (const key in roads) {
       if (roadIds.hasOwnProperty(key)) {
@@ -539,7 +542,7 @@ export default class MoveRoad {
           position,
           otherPoint,
           key,
-          linkedPointId,
+          linkedRoadPointId,
           linkedRoadId,
           _road.vectorId
         );
@@ -567,7 +570,7 @@ export default class MoveRoad {
     position1,
     position2,
     roadId,
-    linkedPointId,
+    linkedRoadPointId,
     linkedRoadId,
     dragRoadId
   ) {
@@ -580,7 +583,11 @@ export default class MoveRoad {
       startPoint,
       endPoint
     );
-    if (join && road.startId != linkedPointId && road.endId != linkedPointId) {
+    if (
+      join &&
+      road.startId != linkedRoadPointId &&
+      road.endId != linkedRoadPointId
+    ) {
       // 交叉了
       this.splitRoadId = roadId;
       return true;
@@ -596,7 +603,7 @@ export default class MoveRoad {
         mathUtil.getDistance(join1, startPoint) < Constant.minRealDis &&
         mathUtil.PointInSegment(join1, position1, position2)
       ) {
-        if (road.startId != linkedPointId) {
+        if (road.startId != linkedRoadPointId) {
           // 交叉了
           this.adsorbPointRoads[startPoint.vectorId] = dragRoadId;
           //为了找到全部的吸附点,暂时返回true,在外面一层再做判断
@@ -606,7 +613,7 @@ export default class MoveRoad {
         mathUtil.getDistance(join2, endPoint) < Constant.minRealDis &&
         mathUtil.PointInSegment(join2, position1, position2)
       ) {
-        if (road.endId != linkedPointId) {
+        if (road.endId != linkedRoadPointId) {
           // 交叉了
           this.adsorbPointRoads[endPoint.vectorId] = dragRoadId;
           //为了找到全部的吸附点,暂时返回true,在外面一层再做判断
@@ -622,8 +629,8 @@ export default class MoveRoad {
         mathUtil.PointInSegment(join1, startPoint, endPoint)
       ) {
         if (
-          road.startId != linkedPointId &&
-          road.endId != linkedPointId &&
+          road.startId != linkedRoadPointId &&
+          road.endId != linkedRoadPointId &&
           roadId != linkedRoadId
         ) {
           // 交叉了
@@ -635,8 +642,8 @@ export default class MoveRoad {
         mathUtil.PointInSegment(join2, startPoint, endPoint)
       ) {
         if (
-          road.startId != linkedPointId &&
-          road.endId != linkedPointId &&
+          road.startId != linkedRoadPointId &&
+          road.endId != linkedRoadPointId &&
           roadId != linkedRoadId
         ) {
           // 交叉了
@@ -971,13 +978,13 @@ export default class MoveRoad {
       startPoint.setPosition(p1);
       endPoint.setPosition(p2);
 
-      let leftEdge = dataService.getEdge(road.leftEdgeId);
+      let leftEdge = dataService.getRoadEdge(road.leftEdgeId);
       leftEdge.start.x += dx;
       leftEdge.start.y += dy;
       leftEdge.end.x += dx;
       leftEdge.end.y += dy;
 
-      let rightEdge = dataService.getEdge(road.rightEdgeId);
+      let rightEdge = dataService.getRoadEdge(road.rightEdgeId);
       rightEdge.start.x += dx;
       rightEdge.start.y += dy;
       rightEdge.end.x += dx;
@@ -993,8 +1000,8 @@ export default class MoveRoad {
     dx = dx;
     dy = -dy;
     const curveRoad = dataService.getCurveRoad(curveRoadId);
-    const leftCurveEdge = dataService.getCurveEdge(curveRoad.leftEdgeId);
-    const rightCurveEdge = dataService.getCurveEdge(curveRoad.rightEdgeId);
+    const leftCurveEdge = dataService.getCurveRoadEdge(curveRoad.leftEdgeId);
+    const rightCurveEdge = dataService.getCurveRoadEdge(curveRoad.rightEdgeId);
 
     for (let i = 0; i < curveRoad.points.length; ++i) {
       curveRoad.points[i].x += dx;
@@ -1144,7 +1151,7 @@ export default class MoveRoad {
   }
 
   moveEdge(edgeId, position) {
-    const edge = dataService.getEdge(edgeId);
+    const edge = dataService.getRoadEdge(edgeId);
     const parent = edge.getParent();
     const road = dataService.getRoad(parent);
     const line = roadService.getMidLine(road);
@@ -1164,7 +1171,7 @@ export default class MoveRoad {
   }
 
   moveCurveEdge(curveEdgeId, index, position) {
-    const curveEdge = dataService.getCurveEdge(curveEdgeId);
+    const curveEdge = dataService.getCurveRoadEdge(curveEdgeId);
     const parent = curveEdge.getParent();
     const curveRoad = dataService.getCurveRoad(parent);
     let joinInfo = null;

+ 3 - 3
src/graphic/Geometry/CurveEdge.js

@@ -1,9 +1,9 @@
 //墙的边缘线
 import Geometry from "./Geometry.js";
 import VectorType from "../enum/VectorType.js";
-import { mathUtil } from "../Util/MathUtil";
+import { mathUtil } from "../Util/MathUtil.js";
 
-export default class CurveEdge extends Geometry {
+export default class CurveRoadEdge extends Geometry {
   constructor(start, end, vectorId, parentId) {
     super();
     this.parent = parentId;
@@ -12,7 +12,7 @@ export default class CurveEdge extends Geometry {
     this.vectorId = null;
     this.points = [];
     this.curves = [];
-    this.geoType = VectorType.CurveEdge;
+    this.geoType = VectorType.CurveRoadEdge;
     this.setId(vectorId);
     this.setPositions(start, end);
   }

+ 36 - 0
src/graphic/Geometry/CurveRoadPoint.js

@@ -0,0 +1,36 @@
+import VectorType from "../enum/VectorType.js";
+import Geometry from "./Geometry";
+
+export default class CurveRoadPoint extends Geometry {
+  constructor(position, vectorId) {
+    super();
+    this.x = null;
+    this.y = null;
+    this.parent = null;
+    this.index = -1;
+    this.geoType = VectorType.CurveRoadPoint;
+    this.setId(vectorId);
+    this.setPosition(position);
+  }
+
+  getIndex() {
+    return this.index;
+  }
+
+  setIndex(index) {
+    this.index = index;
+  }
+
+  setPointParent(parentId) {
+    this.parent = parentId;
+  }
+
+  getParent() {
+    return this.parent;
+  }
+
+  setPosition(position) {
+    this.x = position.x;
+    this.y = position.y;
+  }
+}

+ 21 - 0
src/graphic/Geometry/GuideLine.js

@@ -0,0 +1,21 @@
+import VectorType from "../enum/VectorType.js";
+import Geometry from "./Geometry";
+export default class GuideLine extends Geometry {
+  constructor(start, end, vectorId) {
+    super();
+    this.start = {};
+    this.end = {};
+    this.geoType = VectorType.Line;
+    this.setId(vectorId);
+
+    this.setPositions(start, end);
+  }
+
+  setPositions(point1, point2) {
+    this.start.x = point1.x;
+    this.start.y = point1.y;
+
+    this.end.x = point2.x;
+    this.end.y = point2.y;
+  }
+}

+ 3 - 13
src/graphic/Geometry/Line.js

@@ -4,21 +4,11 @@ import Geometry from "./Geometry";
 import Constant from "../Constant.js";
 
 export default class Line extends Geometry {
-  constructor(start, end, vectorId) {
+  constructor(startId, endId, vectorId) {
     super();
-    this.start = {};
-    this.end = {};
+    this.startId = startId;
+    this.endId = endId;
     this.geoType = VectorType.Line;
     this.setId(vectorId);
-
-    this.setPositions(start, end);
-  }
-
-  setPositions(point1, point2) {
-    this.start.x = point1.x;
-    this.start.y = point1.y;
-
-    this.end.x = point2.x;
-    this.end.y = point2.y;
   }
 }

+ 3 - 3
src/graphic/Geometry/Edge.js

@@ -1,16 +1,16 @@
 //墙的边缘线
 import Geometry from "./Geometry.js";
 import VectorType from "../enum/VectorType.js";
-import { mathUtil } from "../Util/MathUtil";
+import { mathUtil } from "../Util/MathUtil.js";
 
-export default class Edge extends Geometry {
+export default class RoadEdge extends Geometry {
   constructor(start, end, vectorId, parentId) {
     super();
     this.parent = parentId;
     this.start = {};
     this.end = {};
     this.vectorId = null;
-    this.geoType = VectorType.Edge;
+    this.geoType = VectorType.RoadEdge;
     this.setId(vectorId);
 
     this.setPositions(start, end);

+ 92 - 52
src/graphic/Layer.js

@@ -9,6 +9,7 @@ import UIControl from "./Controls/UIControl";
 // import { moveRectangle } from "./Controls/MoveRectangle";
 import { moveTag } from "./Controls/MoveTag";
 import { addRoad } from "./Controls/AddRoad";
+import { addLine } from "./Controls/AddLine";
 import { moveRoad } from "./Controls/MoveRoad";
 import { coordinate } from "./Coordinate";
 import Render from "./Renderer/Render";
@@ -100,6 +101,13 @@ export default class Layer {
     const selectItem = stateService.getSelectItem();
     const eventName = stateService.getEventName();
     switch (eventName) {
+      //用于支持平板电脑
+      case null:
+        needAutoRedraw = listenLayer.start(position);
+        stateService.getSelectItem();
+        if (needAutoRedraw) {
+          this.renderer.autoRedraw();
+        }
       case LayerEvents.AddRoad:
         stateService.setEventName(LayerEvents.AddingRoad);
         addRoad.setNewRoadPoint("start", position);
@@ -108,6 +116,10 @@ export default class Layer {
         stateService.setEventName(LayerEvents.AddingCurveRoad);
         addRoad.setNewRoadPoint("start", position);
         break;
+      case LayerEvents.AddLine:
+        stateService.setEventName(LayerEvents.AddingLine);
+        addLine.setNewLinePoint("start", position);
+        break;
     }
     stateService.setDraggingItem(selectItem);
     // 清除上一个状态
@@ -189,6 +201,23 @@ export default class Layer {
           elementService.execute(listenLayer.modifyPoint, position);
         }
         break;
+      case LayerEvents.AddLine:
+        needAutoRedraw = true;
+        listenLayer.start(position);
+        if (listenLayer.modifyPoint) {
+          position = {
+            x: listenLayer.modifyPoint.x,
+            y: listenLayer.modifyPoint.y,
+          };
+        }
+
+        elementService.hideAll();
+        elementService.setPoint(position);
+        elementService.showPoint();
+        if (listenLayer.modifyPoint) {
+          elementService.execute(listenLayer.modifyPoint, position);
+        }
+        break;
       case LayerEvents.AddingRoad:
         needAutoRedraw = true;
         listenLayer.start(position);
@@ -203,7 +232,6 @@ export default class Layer {
         elementService.setPoint(position);
         elementService.setNewRoad(addRoad.startInfo.position, position);
         elementService.showNewRoad();
-        elementService.setNewRoadGeoType(VectorType.Road);
 
         addRoad.setNewRoadPoint("end", position);
         addRoad.canAdd = addRoad.canAddRoadForEnd(position);
@@ -213,6 +241,21 @@ export default class Layer {
           elementService.setNewRoadState("normal");
         }
         break;
+      case LayerEvents.AddingLine:
+        needAutoRedraw = true;
+        listenLayer.start(position);
+        if (listenLayer.modifyPoint) {
+          position = {
+            x: listenLayer.modifyPoint.x,
+            y: listenLayer.modifyPoint.y,
+          };
+        }
+        elementService.execute(addLine.startInfo.position, position);
+        elementService.setPoint(position);
+        elementService.setNewLine(addLine.startInfo.position, position);
+        elementService.showNewLine();
+        addLine.setNewLinePoint("end", position);
+        break;
       case LayerEvents.MoveRoad:
         needAutoRedraw = true;
         //只允许拖拽一条公路
@@ -235,7 +278,10 @@ export default class Layer {
         break;
       case LayerEvents.MoveRoadPoint:
         point = dataService.getRoadPoint(draggingItem.vectorId);
-        listenLayer.start(position, draggingItem.vectorId, point.parent);
+        listenLayer.start(position, {
+          exceptRoadPointId: draggingItem.vectorId,
+          exceptRoadIds: point.parent,
+        });
         if (listenLayer.modifyPoint) {
           position = {
             x: listenLayer.modifyPoint.x,
@@ -251,29 +297,32 @@ export default class Layer {
         if (!flag) {
           elementService.hideAll();
         } else {
-          point = dataService.getRoadPoint(draggingItem.vectorId);
-          listenLayer.start(point, draggingItem.vectorId, point.parent);
+          // point = dataService.getRoadPoint(draggingItem.vectorId);
+          // listenLayer.start(point, {
+          //   exceptRoadPointId: draggingItem.vectorId,
+          //   exceptRoadIds: point.parent,
+          // });
           let otherPoint = null;
           if (
             listenLayer.modifyPoint &&
-            listenLayer.modifyPoint.linkedPointId
+            listenLayer.modifyPoint.linkedRoadPointId
           ) {
             otherPoint = dataService.getRoadPoint(
-              listenLayer.modifyPoint.linkedPointId
+              listenLayer.modifyPoint.linkedRoadPointId
             );
           } else if (
             listenLayer.modifyPoint &&
-            listenLayer.modifyPoint.linkedPointIdX
+            listenLayer.modifyPoint.linkedRoadPointIdX
           ) {
             otherPoint = dataService.getRoadPoint(
-              listenLayer.modifyPoint.linkedPointIdX
+              listenLayer.modifyPoint.linkedRoadPointIdX
             );
           } else if (
             listenLayer.modifyPoint &&
-            listenLayer.modifyPoint.linkedPointIdY
+            listenLayer.modifyPoint.linkedRoadPointIdY
           ) {
             otherPoint = dataService.getRoadPoint(
-              listenLayer.modifyPoint.linkedPointIdY
+              listenLayer.modifyPoint.linkedRoadPointIdY
             );
           }
 
@@ -312,7 +361,6 @@ export default class Layer {
         elementService.setPoint(position);
         elementService.setNewRoad(addRoad.startInfo.position, position);
         elementService.showNewRoad();
-        elementService.setNewRoadGeoType(VectorType.Road);
 
         addRoad.setNewRoadPoint("end", position);
         addRoad.canAdd = addRoad.canAddRoadForEnd(position);
@@ -322,21 +370,6 @@ export default class Layer {
           elementService.setNewRoadState("normal");
         }
         break;
-      case LayerEvents.AddMeasureLine:
-        needAutoRedraw = true;
-        listenLayer.start(position);
-        if (listenLayer.modifyPoint) {
-          position = {
-            x: listenLayer.modifyPoint.x,
-            y: listenLayer.modifyPoint.y,
-          };
-        }
-
-        elementService.setPoint(position);
-        elementService.showPoint();
-
-        addRoad.setNewRoadPoint("start", position);
-        break;
       case LayerEvents.MoveCurveRoad:
         needAutoRedraw = true;
         moveRoad.moveCurveRoad(
@@ -351,14 +384,11 @@ export default class Layer {
         if (!draggingItem || !draggingItem.vectorId) {
           return;
         }
-        point = dataService.getCurvePoint(draggingItem.vectorId);
-        listenLayer.start(
-          position,
-          draggingItem.vectorId,
-          null,
-          null,
-          point.parent
-        );
+        point = dataService.getCurveRoadPoint(draggingItem.vectorId);
+        listenLayer.start(position, {
+          exceptRoadPointId: draggingItem.vectorId,
+          exceptCurveRoadId: point.parent, //不会融合,所以parent只有一个
+        });
         if (listenLayer.modifyPoint) {
           position = {
             x: listenLayer.modifyPoint.x,
@@ -465,19 +495,22 @@ export default class Layer {
         elementService.hideAll();
         let point = dataService.getRoadPoint(draggingItem.vectorId);
         if (point) {
-          listenLayer.start(point, draggingItem.vectorId, point.parent);
+          listenLayer.start(point, {
+            exceptPointId: draggingItem.vectorId,
+            exceptRoadIds: point.parent,
+          });
           if (
             listenLayer.modifyPoint &&
-            listenLayer.modifyPoint.hasOwnProperty("linkedPointId")
+            listenLayer.modifyPoint.hasOwnProperty("linkedRoadPointId")
           ) {
             moveRoad.moveTo(
               draggingItem.vectorId,
-              listenLayer.modifyPoint.linkedPointId
+              listenLayer.modifyPoint.linkedRoadPointId
             );
           } else if (
             listenLayer.modifyPoint &&
-            (listenLayer.modifyPoint.linkedPointIdX ||
-              listenLayer.modifyPoint.linkedPointIdY)
+            (listenLayer.modifyPoint.linkedRoadPointIdX ||
+              listenLayer.modifyPoint.linkedRoadPointIdY)
           ) {
             mathUtil.clonePoint(point, listenLayer.modifyPoint);
           } else if (
@@ -523,6 +556,13 @@ export default class Layer {
           elementService.hideAll();
         }
         break;
+      case LayerEvents.AddingLine:
+        needAutoRedraw = true;
+        addLine.buildLine();
+        addLine.clear();
+        this.history.save();
+        elementService.hideAll();
+        break;
       // case LayerEvents.AddCurveRoad:
       //   addRoad.setNewRoadPoint("start", position);
       //   break;
@@ -758,7 +798,7 @@ export default class Layer {
       }
       //弯路删除控制点
       else if (e.code == "KeyY") {
-        const curvePoint = dataService.getCurvePoint(focusItem.vectorId);
+        const curvePoint = dataService.getCurveRoadPoint(focusItem.vectorId);
         const curveRoad = dataService.getCurveRoad(curvePoint.parent);
         curveRoadService.subCPoint(curveRoad, curvePoint.getIndex());
         this.renderer.autoRedraw();
@@ -783,13 +823,13 @@ export default class Layer {
           stateService.setEventName(LayerEvents.MoveRoadPoint);
         } else if (selectItem.type == VectorType.CurveRoad) {
           stateService.setEventName(LayerEvents.MoveCurveRoad);
-        } else if (selectItem.type == VectorType.CurvePoint) {
+        } else if (selectItem.type == VectorType.CurveRoadPoint) {
           stateService.setEventName(LayerEvents.MoveCurveRoadPoint);
         } else if (selectItem.type == VectorType.ControlPoint) {
           stateService.setEventName(LayerEvents.MoveControlPoint);
-        } else if (selectItem.type == VectorType.Edge) {
+        } else if (selectItem.type == VectorType.RoadEdge) {
           stateService.setEventName(LayerEvents.MoveEdge);
-        } else if (selectItem.type == VectorType.CurveEdge) {
+        } else if (selectItem.type == VectorType.CurveRoadEdge) {
           stateService.setEventName(LayerEvents.MoveCurveEdge);
         } else if (selectItem.type == VectorType.Line) {
           stateService.setEventName(LayerEvents.MoveLine);
@@ -807,6 +847,8 @@ export default class Layer {
       // }
       else if (eventName == LayerEvents.AddingRoad) {
         stateService.setEventName(LayerEvents.AddRoad);
+      } else if (eventName == LayerEvents.AddingLine) {
+        stateService.setEventName(LayerEvents.AddLine);
       }
       // else if (eventName == LayerEvents.AddCurveRoad) {
       //   stateService.setEventName(LayerEvents.AddingCurveRoad);
@@ -831,17 +873,15 @@ export default class Layer {
 
   stopAddVector() {
     let eventName = stateService.getEventName();
-    if (eventName != LayerEvents.AddingRoad) {
+    if (
+      eventName != LayerEvents.AddingRoad &&
+      eventName != LayerEvents.AddingLine
+    ) {
       stateService.clearEventName();
-      const draggingItem = stateService.getDraggingItem();
-      if (eventName == LayerEvents.AddTag) {
-        if (draggingItem && draggingItem.vectorId) {
-          dataService.deleteTag(draggingItem.vectorId);
-          this.uiControl.currentUI = null;
-        }
-      }
-    } else {
+    } else if (eventName == LayerEvents.AddingRoad) {
       stateService.setEventName(LayerEvents.AddRoad);
+    } else if (eventName == LayerEvents.AddingLine) {
+      stateService.setEventName(LayerEvents.AddLine);
     }
 
     this.uiControl.clearUI();

+ 534 - 175
src/graphic/ListenLayer.js

@@ -16,35 +16,64 @@ export default class ListenLayer {
     this.modifyPoint = null;
   }
 
-  //开始监听,exceptPointId表示不考虑的点,exceptRoadIds表示不考虑的墙
-  start(
-    position,
-    exceptPointId,
-    exceptRoadIds,
-    exceptCurvePointId,
-    exceptCurveRoadId,
-    exceptCrossControlPointId
-  ) {
+  //开始监听,exceptVectorIds表示不考虑的元素
+  /**
+   * 
+   * @param exceptVectorIds:{
+          exceptPointId,
+          exceptLineId,
+          exceptRoadPointId,
+          exceptRoadIds,
+          exceptCurveRoadPointId,
+          exceptCurveRoadId,
+          exceptCrossControlPointId
+  }  
+   * @returns 
+   */
+  start(position, exceptVectorIds) {
     let flag = false;
+    let selectInfo = {};
+    if (!exceptVectorIds) {
+      exceptVectorIds = {};
+    }
     this.clear();
-    let curveRoadEdgeInfo = this.isSelectCurveRoad(position, exceptCurveRoadId);
-    let roadEdgeInfo = this.isSelectRoad(position, exceptRoadIds);
-    let curvePointInfo = this.isSelectCurvePoint(position, exceptCurvePointId);
-    let pointInfo = this.isSelectPoint(position, exceptPointId);
-    //交叉口拐弯处的控制点
-    let controlPointInfo = this.isSelectCrossControlPoint(
+    selectInfo.curveRoadEdgeInfo = this.isSelectCurveRoad(
+      position,
+      exceptVectorIds.exceptCurveRoadId
+    ); //包括edge
+    selectInfo.roadEdgeInfo = this.isSelectRoad(
+      position,
+      exceptVectorIds.exceptRoadIds
+    ); //包括edge
+    selectInfo.curveRoadPointInfo = this.isSelectCurveRoadPoint(
       position,
-      exceptCrossControlPointId
+      exceptVectorIds.exceptCurveRoadPointId
     );
-
-    this.setModifyPoint(
+    selectInfo.roadPointInfo = this.isSelectRoadPoint(
+      position,
+      exceptVectorIds.exceptRoadPointId
+    );
+    selectInfo.pointInfo = this.isSelectPoint(
+      position,
+      exceptVectorIds.exceptPointId
+    );
+    selectInfo.lineInfo = this.isSelectLine(
+      position,
+      exceptVectorIds.exceptLineId
+    );
+    // selectInfo.curveLineInfo = this.isSelectCurveLine(
+    //   position,
+    //   exceptVectorIds.exceptCurveLineId
+    // );
+    selectInfo.curveLineInfo = {};
+    selectInfo.curvePointInfo = {};
+    //交叉口拐弯处的控制点
+    selectInfo.controlPointInfo = this.isSelectCrossControlPoint(
       position,
-      pointInfo,
-      curvePointInfo,
-      roadEdgeInfo,
-      curveRoadEdgeInfo,
-      controlPointInfo
+      exceptVectorIds.exceptCrossControlPointId
     );
+
+    this.setModifyPoint(position, selectInfo);
     flag = this.updateSelectItem();
     return flag;
   }
@@ -57,25 +86,25 @@ export default class ListenLayer {
     };
 
     let seqInfo = {};
-    const points = dataService.getRoadPoints();
+    const points = dataService.getPoints();
     for (const pointId in points) {
       if (pointId == exceptPointId) {
         continue;
       }
-      const point = dataService.getRoadPoint(pointId);
+      const point = dataService.getPoint(pointId);
       const distance = mathUtil.getDistance(position, point);
       if (distance < Constant.minAdsorbPix) {
         if (pointInfo.pointId == null) {
           pointInfo = {
             pointId: pointId,
-            type: VectorType.RoadPoint,
+            type: VectorType.Point,
             distance: distance,
           };
-        } else if (pointInfo.pointId != null) {
+        } else {
           if (distance < pointInfo.distance) {
             pointInfo = {
               pointId: pointId,
-              type: VectorType.RoadPoint,
+              type: VectorType.Point,
               distance: distance,
             };
           }
@@ -92,21 +121,18 @@ export default class ListenLayer {
     }
 
     if (pointInfo.pointId) {
-      const linkedPoint = dataService.getRoadPoint(pointInfo.pointId);
+      pointInfo.linkedPointId = pointInfo.pointId;
+      const linkedPoint = dataService.getPoint(pointInfo.pointId);
       pointInfo.x = linkedPoint.x;
       pointInfo.y = linkedPoint.y;
-    }
-    //因为这种纠正的权限最低
-    else {
+    } else {
       if (seqInfo.hasOwnProperty("linkedPointIdX")) {
-        pointInfo.linkedPointIdX = seqInfo.linkedPointIdX;
+        pointInfo.linkedPointIdX = seqInfo.linkedPointIdY;
         pointInfo.x = seqInfo.x;
-      }
-      if (seqInfo.hasOwnProperty("linkedPointIdY")) {
+      } else if (seqInfo.hasOwnProperty("linkedPointIdY")) {
         pointInfo.linkedPointIdY = seqInfo.linkedPointIdY;
         pointInfo.y = seqInfo.y;
       }
-
       if (pointInfo.hasOwnProperty("y") && !pointInfo.hasOwnProperty("x")) {
         pointInfo.x = position.x;
       }
@@ -114,83 +140,318 @@ export default class ListenLayer {
         pointInfo.y = position.y;
       }
     }
-
     return pointInfo;
   }
 
-  isSelectCurvePoint(position, exceptCurvePointId) {
-    let curvePointInfo = {
-      curvePointId: null,
+  isSelectLine(position, exceptLineIds) {
+    let lineInfo = {
+      lineId: null,
+      type: null,
+      distance: null,
+    };
+    const lines = dataService.getLines();
+    for (const lineId in lines) {
+      if (exceptLineId != null && exceptLineIds.hasOwnProperty(lineId)) {
+        continue;
+      }
+      const line = dataService.getLine(lineId);
+      let startPoint = dataService.getPoint(line.startId);
+      let endPoint = dataService.getPoint(line.endId);
+      const comLine = mathUtil.createLine1(startPoint, endPoint);
+      const join = mathUtil.getJoinLinePoint(position, comLine);
+      const distance = mathUtil.getDistance(position, join);
+      if (!mathUtil.isContainForSegment(join, startPoint, endPoint)) {
+        continue;
+      }
+      if (distance < Constant.minAdsorbPix / 2) {
+        lineInfo = {
+          lineId: lineId,
+          type: VectorType.Line,
+          distance: distance,
+        };
+      }
+    }
+
+    if (lineInfo.lineId) {
+      const linkedLine = dataService.getLine(lineInfo.lineId);
+      let startPoint = dataService.getPoint(linkedLine.startId);
+      let endPoint = dataService.getPoint(linkedLine.endId);
+      const linkedComLine = mathUtil.createLine1(startPoint, endPoint);
+      const linkedPosition = mathUtil.getJoinLinePoint(position, linkedComLine);
+      lineInfo.x = linkedPosition.x;
+      lineInfo.y = linkedPosition.y;
+      return lineInfo;
+    }
+    return lineInfo;
+  }
+
+  // isSelectCurveLine(position, exceptCurveLineId) {
+  //   let curveLineInfo = {
+  //     curveLineId: null,
+  //     type: null,
+  //     distance: null,
+  //   };
+  //   let seqInfo = {};
+  //   const curveLines = dataService.getCurveLines();
+
+  //   for (const curveLineId in curveLines) {
+  //     if (curveLineId == exceptCurveLineId) {
+  //       continue;
+  //     }
+  //     const curveLine = dataService.getCurveLine(curveLineId);
+  //     let joinInfo = this.distanceForBezier(
+  //       position,
+  //       curveRoad.curves,
+  //       Constant.minAdsorbPix / 2
+  //     );
+
+  //     if (
+  //       mathUtil.isClockwise([curveRoad.points[0], joinInfo.position, position])
+  //     ) {
+  //       //选中了路
+  //       if (joinInfo.distance < curveRoad.leftWidth - Constant.minAdsorbPix) {
+  //         curveRoadInfo = {
+  //           curveRoadId: curveRoadId,
+  //           type: VectorType.CurveRoad,
+  //           distance: joinInfo.distance,
+  //           x: joinInfo.position.x,
+  //           y: joinInfo.position.y,
+  //         };
+  //       }
+  //       //选中了edge
+  //       else if (
+  //         joinInfo.distance <
+  //         curveRoad.leftWidth + Constant.minAdsorbPix
+  //       ) {
+  //         const leftCurveEdge = dataService.getCurveRoadEdge(
+  //           curveRoad.leftEdgeId
+  //         );
+  //         joinInfo = this.distanceForBezier(
+  //           position,
+  //           leftCurveEdge.curves,
+  //           curveRoad.leftWidth
+  //         );
+  //         const index = mathUtil.getIndexForCurvesPoints(
+  //           joinInfo.position,
+  //           curveRoad.points
+  //         );
+  //         curveEdgeInfo = {
+  //           curveEdgeId: curveRoad.leftEdgeId,
+  //           type: VectorType.CurveRoadEdge,
+  //           distance: joinInfo.distance,
+  //           selectIndex: index,
+  //           x: joinInfo.position.x,
+  //           y: joinInfo.position.y,
+  //         };
+  //       }
+  //     } else if (
+  //       !mathUtil.isClockwise([
+  //         curveRoad.points[0],
+  //         joinInfo.position,
+  //         position,
+  //       ])
+  //     ) {
+  //       //选中了路
+  //       if (joinInfo.distance < curveRoad.rightWidth - Constant.minAdsorbPix) {
+  //         curveRoadInfo = {
+  //           curveRoadId: curveRoadId,
+  //           type: VectorType.CurveRoad,
+  //           distance: joinInfo.distance,
+  //           x: joinInfo.position.x,
+  //           y: joinInfo.position.y,
+  //         };
+  //       }
+  //       //选中了edge
+  //       else if (
+  //         joinInfo.distance <
+  //         curveRoad.rightWidth + Constant.minAdsorbPix
+  //       ) {
+  //         const rightCurveEdge = dataService.getCurveRoadEdge(
+  //           curveRoad.rightEdgeId
+  //         );
+  //         joinInfo = this.distanceForBezier(
+  //           position,
+  //           rightCurveEdge.curves,
+  //           curveRoad.rightWidth
+  //         );
+  //         const index = mathUtil.getIndexForCurvesPoints(
+  //           joinInfo.position,
+  //           curveRoad.points
+  //         );
+  //         curveEdgeInfo = {
+  //           curveEdgeId: curveRoad.rightEdgeId,
+  //           type: VectorType.CurveRoadEdge,
+  //           distance: joinInfo.distance,
+  //           selectIndex: index,
+  //           x: joinInfo.position.x,
+  //           y: joinInfo.position.y,
+  //         };
+  //       }
+  //     }
+  //   }
+  //   if (curveRoadInfo.curveRoadId) {
+  //     return curveRoadInfo;
+  //   } else if (curveEdgeInfo.curveEdgeId) {
+  //     return curveEdgeInfo;
+  //   } else {
+  //     return {
+  //       curveRoadId: null,
+  //       curveEdgeId: null,
+  //     };
+  //   }
+  // }
+
+  isSelectRoadPoint(position, exceptRoadPointId) {
+    let roadPointInfo = {
+      roadPointId: null,
       type: null,
       distance: null,
     };
 
     let seqInfo = {};
-    const curvePoints = dataService.getCurvePoints();
-    for (const curvePointId in curvePoints) {
-      if (curvePointId == exceptCurvePointId) {
+    const roadPoints = dataService.getRoadPoints();
+    for (const roadPointId in roadPoints) {
+      if (roadPointId == exceptRoadPointId) {
         continue;
       }
-      const curvePoint = dataService.getCurvePoint(curvePointId);
-      const distance = mathUtil.getDistance(position, curvePoint);
+      const roadPoint = dataService.getRoadPoint(roadPointId);
+      const distance = mathUtil.getDistance(position, roadPoint);
       if (distance < Constant.minAdsorbPix) {
-        if (curvePointInfo.curvePointId == null) {
-          curvePointInfo = {
-            curvePointId: curvePointId,
-            type: VectorType.CurvePoint,
+        if (roadPointInfo.roadPointId == null) {
+          roadPointInfo = {
+            roadPointId: roadPointId,
+            type: VectorType.RoadPoint,
             distance: distance,
           };
-        } else if (curvePointInfo.pointId != null) {
-          if (distance < curvePointInfo.distance) {
-            curvePointInfo = {
-              curvePointId: curvePointId,
-              type: VectorType.CurvePoint,
+        } else if (roadPointInfo.roadPointId != null) {
+          if (distance < roadPointInfo.distance) {
+            roadPointInfo = {
+              roadPointId: roadPointId,
+              type: VectorType.RoadPoint,
               distance: distance,
             };
           }
         }
       } else {
-        if (Math.abs(position.x - curvePoint.x) < Constant.minAdsorbPix) {
-          seqInfo.linkedPointIdX = curvePointId;
-          seqInfo.x = curvePoint.x;
+        if (Math.abs(position.x - roadPoint.x) < Constant.minAdsorbPix) {
+          seqInfo.linkedRoadPointIdX = roadPointId;
+          seqInfo.x = roadPoint.x;
+        } else if (Math.abs(position.y - roadPoint.y) < Constant.minAdsorbPix) {
+          seqInfo.linkedRoadPointIdY = roadPointId;
+          seqInfo.y = roadPoint.y;
+        }
+      }
+    }
+
+    if (roadPointInfo.roadPointId) {
+      const linkedPoint = dataService.getRoadPoint(roadPointInfo.roadPointId);
+      roadPointInfo.x = linkedPoint.x;
+      roadPointInfo.y = linkedPoint.y;
+    }
+    //因为这种纠正的权限最低
+    else {
+      if (seqInfo.hasOwnProperty("linkedRoadPointIdX")) {
+        roadPointInfo.linkedRoadPointIdX = seqInfo.linkedRoadPointIdX;
+        roadPointInfo.x = seqInfo.x;
+      }
+      if (seqInfo.hasOwnProperty("linkedRoadPointIdY")) {
+        roadPointInfo.linkedRoadPointIdY = seqInfo.linkedRoadPointIdY;
+        roadPointInfo.y = seqInfo.y;
+      }
+
+      if (
+        roadPointInfo.hasOwnProperty("y") &&
+        !roadPointInfo.hasOwnProperty("x")
+      ) {
+        roadPointInfo.x = position.x;
+      }
+      if (
+        roadPointInfo.hasOwnProperty("x") &&
+        !roadPointInfo.hasOwnProperty("y")
+      ) {
+        roadPointInfo.y = position.y;
+      }
+    }
+
+    return roadPointInfo;
+  }
+
+  isSelectCurveRoadPoint(position, exceptCurveRoadPointId) {
+    let curveRoadPointInfo = {
+      curveRoadPointId: null,
+      type: null,
+      distance: null,
+    };
+
+    let seqInfo = {};
+    const curveRoadPoints = dataService.getCurveRoadPoints();
+    for (const curveRoadPointId in curveRoadPoints) {
+      if (curveRoadPointId == exceptCurveRoadPointId) {
+        continue;
+      }
+      const curveRoadPoint = dataService.getCurveRoadPoint(curveRoadPointId);
+      const distance = mathUtil.getDistance(position, curveRoadPoint);
+      if (distance < Constant.minAdsorbPix) {
+        if (curveRoadPointInfo.curveRoadPointId == null) {
+          curveRoadPointInfo = {
+            curveRoadPointId: curveRoadPointId,
+            type: VectorType.CurveRoadPoint,
+            distance: distance,
+          };
+        } else {
+          if (distance < curveRoadPointInfo.distance) {
+            curveRoadPointInfo = {
+              curveRoadPointId: curveRoadPointId,
+              type: VectorType.CurveRoadPoint,
+              distance: distance,
+            };
+          }
+        }
+      } else {
+        if (Math.abs(position.x - curveRoadPoint.x) < Constant.minAdsorbPix) {
+          seqInfo.linkedCurveRoadPointIdX = curveRoadPointId;
+          seqInfo.x = curveRoadPoint.x;
         } else if (
-          Math.abs(position.y - curvePoint.y) < Constant.minAdsorbPix
+          Math.abs(position.y - curveRoadPoint.y) < Constant.minAdsorbPix
         ) {
-          seqInfo.linkedPointIdY = curvePointId;
-          seqInfo.y = curvePoint.y;
+          seqInfo.linkedCurveRoadPointIdY = curveRoadPointId;
+          seqInfo.y = curveRoadPoint.y;
         }
       }
     }
 
-    if (curvePointInfo.curvePointId) {
-      curvePointInfo.linkedCurvePointId = curvePointInfo.curvePointId;
-      const linkedCurvePoint = dataService.getCurvePoint(
-        curvePointInfo.curvePointId
+    if (curveRoadPointInfo.curveRoadPointId) {
+      curveRoadPointInfo.linkedCurveRoadPointId =
+        curveRoadPointInfo.curveRoadPointId;
+      const linkedCurvePoint = dataService.getCurveRoadPoint(
+        curveRoadPointInfo.curveRoadPointId
       );
-      curvePointInfo.x = linkedCurvePoint.x;
-      curvePointInfo.y = linkedCurvePoint.y;
+      curveRoadPointInfo.x = linkedCurvePoint.x;
+      curveRoadPointInfo.y = linkedCurvePoint.y;
     } else {
-      if (seqInfo.hasOwnProperty("linkedPointIdX")) {
-        curvePointInfo.linkedPointIdX = seqInfo.linkedPointIdX;
-        curvePointInfo.x = seqInfo.x;
-      } else if (seqInfo.hasOwnProperty("linkedPointIdY")) {
-        curvePointInfo.linkedPointIdY = seqInfo.linkedPointIdY;
-        curvePointInfo.y = seqInfo.y;
+      if (seqInfo.hasOwnProperty("linkedCurveRoadPointIdX")) {
+        curveRoadPointInfo.linkedCurveRoadPointIdX =
+          seqInfo.linkedCurveRoadPointIdX;
+        curveRoadPointInfo.x = seqInfo.x;
+      } else if (seqInfo.hasOwnProperty("linkedCurveRoadPointIdY")) {
+        curveRoadPointInfo.linkedCurveRoadPointIdY =
+          seqInfo.linkedCurveRoadPointIdY;
+        curveRoadPointInfo.y = seqInfo.y;
       }
       if (
-        curvePointInfo.hasOwnProperty("y") &&
-        !curvePointInfo.hasOwnProperty("x")
+        curveRoadPointInfo.hasOwnProperty("y") &&
+        !curveRoadPointInfo.hasOwnProperty("x")
       ) {
-        curvePointInfo.x = position.x;
+        curveRoadPointInfo.x = position.x;
       }
       if (
-        curvePointInfo.hasOwnProperty("x") &&
-        !curvePointInfo.hasOwnProperty("y")
+        curveRoadPointInfo.hasOwnProperty("x") &&
+        !curveRoadPointInfo.hasOwnProperty("y")
       ) {
-        curvePointInfo.y = position.y;
+        curveRoadPointInfo.y = position.y;
       }
     }
-    return curvePointInfo;
+    return curveRoadPointInfo;
   }
 
   isSelectRoad(position, exceptRoadIds) {
@@ -237,7 +498,7 @@ export default class ListenLayer {
         } else if (distance < road.leftWidth + Constant.minAdsorbPix) {
           edgeInfo = {
             edgeId: road.leftEdgeId,
-            type: VectorType.Edge,
+            type: VectorType.RoadEdge,
             distance: distance,
             dir: "left",
           };
@@ -254,7 +515,7 @@ export default class ListenLayer {
         } else if (distance < road.rightWidth + Constant.minAdsorbPix) {
           edgeInfo = {
             edgeId: road.rightEdgeId,
-            type: VectorType.Edge,
+            type: VectorType.RoadEdge,
             distance: distance,
             dir: "right",
           };
@@ -274,13 +535,13 @@ export default class ListenLayer {
       return roadInfo;
     } else if (edgeInfo.edgeId) {
       if (edgeInfo.dir == "left") {
-        const leftEdge = dataService.getEdge(edgeInfo.edgeId);
+        const leftEdge = dataService.getRoadEdge(edgeInfo.edgeId);
         const leftLine = edgeService.getLine(leftEdge);
         const linkedPosition = mathUtil.getJoinLinePoint(position, leftLine);
         edgeInfo.x = linkedPosition.x;
         edgeInfo.y = linkedPosition.y;
       } else {
-        const rightEdge = dataService.getEdge(edgeInfo.edgeId);
+        const rightEdge = dataService.getRoadEdge(edgeInfo.edgeId);
         const rightLine = edgeService.getLine(rightEdge);
         const linkedPosition = mathUtil.getJoinLinePoint(position, rightLine);
         edgeInfo.x = linkedPosition.x;
@@ -336,7 +597,9 @@ export default class ListenLayer {
           joinInfo.distance <
           curveRoad.leftWidth + Constant.minAdsorbPix
         ) {
-          const leftCurveEdge = dataService.getCurveEdge(curveRoad.leftEdgeId);
+          const leftCurveEdge = dataService.getCurveRoadEdge(
+            curveRoad.leftEdgeId
+          );
           joinInfo = this.distanceForBezier(
             position,
             leftCurveEdge.curves,
@@ -348,7 +611,7 @@ export default class ListenLayer {
           );
           curveEdgeInfo = {
             curveEdgeId: curveRoad.leftEdgeId,
-            type: VectorType.CurveEdge,
+            type: VectorType.CurveRoadEdge,
             distance: joinInfo.distance,
             selectIndex: index,
             x: joinInfo.position.x,
@@ -377,7 +640,7 @@ export default class ListenLayer {
           joinInfo.distance <
           curveRoad.rightWidth + Constant.minAdsorbPix
         ) {
-          const rightCurveEdge = dataService.getCurveEdge(
+          const rightCurveEdge = dataService.getCurveRoadEdge(
             curveRoad.rightEdgeId
           );
           joinInfo = this.distanceForBezier(
@@ -391,7 +654,7 @@ export default class ListenLayer {
           );
           curveEdgeInfo = {
             curveEdgeId: curveRoad.rightEdgeId,
-            type: VectorType.CurveEdge,
+            type: VectorType.CurveRoadEdge,
             distance: joinInfo.distance,
             selectIndex: index,
             x: joinInfo.position.x,
@@ -439,105 +702,177 @@ export default class ListenLayer {
     return crossControlPointInfo;
   }
 
-  setModifyPoint(
-    position,
-    pointInfo,
-    curvePointInfo,
-    roadEdgeInfo,
-    curveRoadEdgeInfo,
-    controlPointInfo
-  ) {
+  /**
+    * 
+    * @param info:{ 
+        roadPointInfo,
+        curveRoadPointInfo,
+        roadEdgeInfo,
+        curveRoadEdgeInfo,
+        controlPointInfo,
+        pointInfo,
+        roadPointInfo
+      }  
+    */
+  setModifyPoint(position, info) {
     //优先级最高
-    if (pointInfo.pointId || curvePointInfo.curvePointId) {
+    if (
+      info &&
+      (info.roadPointInfo.roadPointId ||
+        info.curveRoadPointInfo.curveRoadPointId)
+    ) {
       this.modifyPoint = {};
-      if (pointInfo.pointId && curvePointInfo.curvePointId) {
-        if (pointInfo.distance < curvePointInfo.distance) {
-          this.modifyPoint.linkedPointId = pointInfo.pointId;
-          this.modifyPoint.x = pointInfo.x;
-          this.modifyPoint.y = pointInfo.y;
+      if (
+        info.roadPointInfo.roadPointId &&
+        info.curveRoadPointInfo.curveRoadPointId
+      ) {
+        if (info.roadPointInfo.distance < info.curveRoadPointInfo.distance) {
+          this.modifyPoint.linkedRoadPointId = info.roadPointInfo.roadPointId;
+          this.modifyPoint.x = info.roadPointInfo.x;
+          this.modifyPoint.y = info.roadPointInfo.y;
         } else {
-          this.modifyPoint.linkedCurvePointId = curvePointInfo.curvePointId;
-          this.modifyPoint.x = curvePointInfo.x;
-          this.modifyPoint.y = curvePointInfo.y;
+          this.modifyPoint.linkedCurveRoadPointId =
+            info.curveRoadPointInfo.curveRoadPointId;
+          this.modifyPoint.x = info.curveRoadPointInfo.x;
+          this.modifyPoint.y = info.curveRoadPointInfo.y;
         }
-      } else if (pointInfo.pointId) {
-        this.modifyPoint.linkedPointId = pointInfo.pointId;
-        this.modifyPoint.x = pointInfo.x;
-        this.modifyPoint.y = pointInfo.y;
-      } else if (curvePointInfo.curvePointId) {
-        this.modifyPoint.linkedCurvePointId = curvePointInfo.curvePointId;
-        this.modifyPoint.x = curvePointInfo.x;
-        this.modifyPoint.y = curvePointInfo.y;
-      }
-    } else if (roadEdgeInfo.roadId || curveRoadEdgeInfo.curveRoadId) {
+      } else if (info.roadPointInfo.roadPointId) {
+        this.modifyPoint.linkedRoadPointId = info.roadPointInfo.roadPointId;
+        this.modifyPoint.x = info.roadPointInfo.x;
+        this.modifyPoint.y = info.roadPointInfo.y;
+      } else if (info.curveRoadPointInfo.curveRoadPointId) {
+        this.modifyPoint.linkedCurveRoadPointId =
+          info.curveRoadPointInfo.curveRoadPointId;
+        this.modifyPoint.x = info.curveRoadPointInfo.x;
+        this.modifyPoint.y = info.curveRoadPointInfo.y;
+      }
+    } else if (
+      info &&
+      (info.pointInfo.pointId || info.curvePointInfo.curvePointId)
+    ) {
+      this.modifyPoint = {};
+      if (info.pointInfo.pointId && info.curvePointInfo.curvePointId) {
+        if (info.pointInfo.distance < info.curvePointInfo.distance) {
+          this.modifyPoint.linkedPointId = info.pointInfo.pointId;
+          this.modifyPoint.x = info.pointInfo.x;
+          this.modifyPoint.y = info.pointInfo.y;
+        } else {
+          this.modifyPoint.linkedCurvePointId =
+            info.curvePointInfo.curvePointId;
+          this.modifyPoint.x = info.curvePointInfo.x;
+          this.modifyPoint.y = info.curvePointInfo.y;
+        }
+      } else if (info.pointInfo.pointId) {
+        this.modifyPoint.linkedPointId = info.pointInfo.pointId;
+        this.modifyPoint.x = info.pointInfo.x;
+        this.modifyPoint.y = info.pointInfo.y;
+      } else if (info.curvePointInfo.curvePointId) {
+        this.modifyPoint.linkedCurvePointId = info.curvePointInfo.curvePointId;
+        this.modifyPoint.x = info.curvePointInfo.x;
+        this.modifyPoint.y = info.curvePointInfo.y;
+      }
+    } else if (
+      info &&
+      (info.roadEdgeInfo.roadId || info.curveRoadEdgeInfo.curveRoadId)
+    ) {
       this.modifyPoint = {};
-      if (roadEdgeInfo.roadId && curveRoadEdgeInfo.curveRoadId) {
-        if (roadEdgeInfo.distance < curveRoadEdgeInfo.distance) {
-          this.modifyPoint.linkedRoadId = roadEdgeInfo.roadId;
-          this.modifyPoint.x = roadEdgeInfo.x;
-          this.modifyPoint.y = roadEdgeInfo.y;
+      if (info.roadEdgeInfo.roadId && info.curveRoadEdgeInfo.curveRoadId) {
+        if (roadEdgeInfo.distance < info.curveRoadEdgeInfo.distance) {
+          this.modifyPoint.linkedRoadId = info.roadEdgeInfo.roadId;
+          this.modifyPoint.x = info.roadEdgeInfo.x;
+          this.modifyPoint.y = info.roadEdgeInfo.y;
         } else {
           this.modifyPoint.linkedCurveRoadId = curveRoadEdgeInfo.curveRoadId;
-          this.modifyPoint.x = curveRoadEdgeInfo.x;
-          this.modifyPoint.y = curveRoadEdgeInfo.y;
+          this.modifyPoint.x = info.curveRoadEdgeInfo.x;
+          this.modifyPoint.y = info.curveRoadEdgeInfo.y;
         }
-      } else if (roadEdgeInfo.roadId) {
-        this.modifyPoint.linkedRoadId = roadEdgeInfo.roadId;
-        this.modifyPoint.x = roadEdgeInfo.x;
-        this.modifyPoint.y = roadEdgeInfo.y;
-      } else if (curveRoadEdgeInfo.curveRoadId) {
-        this.modifyPoint.linkedCurveRoadId = curveRoadEdgeInfo.curveRoadId;
-        this.modifyPoint.x = curveRoadEdgeInfo.x;
-        this.modifyPoint.y = curveRoadEdgeInfo.y;
-      }
-    } else if (controlPointInfo.crossControlPointId) {
+      } else if (info.roadEdgeInfo.roadId) {
+        this.modifyPoint.linkedRoadId = info.roadEdgeInfo.roadId;
+        this.modifyPoint.x = info.roadEdgeInfo.x;
+        this.modifyPoint.y = info.roadEdgeInfo.y;
+      } else if (info.curveRoadEdgeInfo.curveRoadId) {
+        this.modifyPoint.linkedCurveRoadId = info.curveRoadEdgeInfo.curveRoadId;
+        this.modifyPoint.x = info.curveRoadEdgeInfo.x;
+        this.modifyPoint.y = info.curveRoadEdgeInfo.y;
+      }
+    } else if (info && info.controlPointInfo.crossControlPointId) {
       this.modifyPoint = {};
       this.modifyPoint.linkedCrossControlPointId =
-        controlPointInfo.crossControlPointId;
-      this.modifyPoint.x = controlPointInfo.x;
-      this.modifyPoint.y = controlPointInfo.y;
-    } else if (roadEdgeInfo.edgeId || curveRoadEdgeInfo.curveEdgeId) {
+        info.controlPointInfo.crossControlPointId;
+      this.modifyPoint.x = info.controlPointInfo.x;
+      this.modifyPoint.y = info.controlPointInfo.y;
+    } else if (
+      info &&
+      (info.roadEdgeInfo.edgeId || info.curveRoadEdgeInfo.curveEdgeId)
+    ) {
       this.modifyPoint = {};
-      if (roadEdgeInfo.edgeId && curveRoadEdgeInfo.curveEdgeId) {
-        if (roadEdgeInfo.distance < curveRoadEdgeInfo.distance) {
-          this.modifyPoint.linkedEdgeId = roadEdgeInfo.edgeId;
-          this.modifyPoint.x = roadEdgeInfo.x;
-          this.modifyPoint.y = roadEdgeInfo.y;
+      if (info.roadEdgeInfo.edgeId && info.curveRoadEdgeInfo.curveEdgeId) {
+        if (info.roadEdgeInfo.distance < info.curveRoadEdgeInfo.distance) {
+          this.modifyPoint.linkedEdgeId = info.roadEdgeInfo.edgeId;
+          this.modifyPoint.x = info.roadEdgeInfo.x;
+          this.modifyPoint.y = info.roadEdgeInfo.y;
         } else {
-          this.modifyPoint.linkedCurveEdgeId = curveRoadEdgeInfo.curveEdgeId;
-          this.modifyPoint.selectIndex = curveRoadEdgeInfo.selectIndex;
-          this.modifyPoint.x = curveRoadEdgeInfo.x;
-          this.modifyPoint.y = curveRoadEdgeInfo.y;
+          this.modifyPoint.linkedCurveEdgeId =
+            info.curveRoadEdgeInfo.curveEdgeId;
+          this.modifyPoint.selectIndex = info.curveRoadEdgeInfo.selectIndex;
+          this.modifyPoint.x = info.curveRoadEdgeInfo.x;
+          this.modifyPoint.y = info.curveRoadEdgeInfo.y;
         }
-      } else if (roadEdgeInfo.edgeId) {
-        this.modifyPoint.linkedEdgeId = roadEdgeInfo.edgeId;
-        this.modifyPoint.x = roadEdgeInfo.x;
-        this.modifyPoint.y = roadEdgeInfo.y;
-      } else if (curveRoadEdgeInfo.curveEdgeId) {
-        this.modifyPoint.linkedCurveEdgeId = curveRoadEdgeInfo.curveEdgeId;
-        this.modifyPoint.selectIndex = curveRoadEdgeInfo.selectIndex;
-        this.modifyPoint.x = curveRoadEdgeInfo.x;
-        this.modifyPoint.y = curveRoadEdgeInfo.y;
-      }
-    } else if (pointInfo.linkedPointIdX) {
+      } else if (info.roadEdgeInfo.edgeId) {
+        this.modifyPoint.linkedEdgeId = info.roadEdgeInfo.edgeId;
+        this.modifyPoint.x = info.roadEdgeInfo.x;
+        this.modifyPoint.y = info.roadEdgeInfo.y;
+      } else if (info.curveRoadEdgeInfo.curveEdgeId) {
+        this.modifyPoint.linkedCurveEdgeId = info.curveRoadEdgeInfo.curveEdgeId;
+        this.modifyPoint.selectIndex = info.curveRoadEdgeInfo.selectIndex;
+        this.modifyPoint.x = info.curveRoadEdgeInfo.x;
+        this.modifyPoint.y = info.curveRoadEdgeInfo.y;
+      }
+    } else if (
+      info &&
+      (info.lineInfo.lineId || info.curveLineInfo.curveLineId)
+    ) {
       this.modifyPoint = {};
-      this.modifyPoint.linkedPointIdX = pointInfo.linkedPointIdX;
-      this.modifyPoint.x = pointInfo.x;
-      this.modifyPoint.y = position.y;
-    } else if (pointInfo.linkedPointIdY) {
+      if (info.lineInfo.lineId && info.curveLineInfo.curveLineId) {
+        if (info.lineInfo.distance < info.curveLineInfo.distance) {
+          this.modifyPoint.linkedLineId = info.lineInfo.lineId;
+          this.modifyPoint.x = info.lineInfo.x;
+          this.modifyPoint.y = info.lineInfo.y;
+        } else {
+          this.modifyPoint.linkedCurveLineId = info.curveLineInfo.curveLineId;
+          this.modifyPoint.x = info.curveLineInfo.x;
+          this.modifyPoint.y = info.curveLineInfo.y;
+        }
+      } else if (info.lineInfo.lineId) {
+        this.modifyPoint.linkedLineId = info.lineInfo.lineId;
+        this.modifyPoint.x = info.lineInfo.x;
+        this.modifyPoint.y = info.lineInfo.y;
+      } else if (info.curveLineInfo.curveLineId) {
+        this.modifyPoint.linkedCurveLineId = info.curveLineInfo.curveLineId;
+        this.modifyPoint.x = info.curveLineInfo.x;
+        this.modifyPoint.y = info.curveLineInfo.y;
+      }
+    } else if (info && info.pointInfo.linkedRoadPointIdX) {
       this.modifyPoint = {};
-      this.modifyPoint.linkedPointIdY = pointInfo.linkedPointIdY;
-      this.modifyPoint.y = pointInfo.y;
-      this.modifyPoint.x = position.x;
-    } else if (curvePointInfo.linkedPointIdX) {
+      this.modifyPoint.linkedPointIdX = info.pointInfo.linkedRoadPointIdX;
+      this.modifyPoint.x = info.pointInfo.x;
+      this.modifyPoint.y = info.pointInfo.y;
+    } else if (info && info.pointInfo.linkedRoadPointIdY) {
+      this.modifyPoint = {};
+      this.modifyPoint.linkedPointIdY = info.pointInfo.linkedRoadPointIdY;
+      this.modifyPoint.y = info.pointInfo.y;
+      this.modifyPoint.x = info.pointInfo.x;
+    } else if (info && info.curvePointInfo.linkedRoadPointIdX) {
       this.modifyPoint = {};
-      this.modifyPoint.linkedPointIdX = curvePointInfo.linkedPointIdX;
-      this.modifyPoint.x = curvePointInfo.x;
+      this.modifyPoint.linkedRoadPointIdX =
+        info.curvePointInfo.linkedRoadPointIdX;
+      this.modifyPoint.x = info.curvePointInfo.x;
       this.modifyPoint.y = position.y;
-    } else if (curvePointInfo.linkedPointIdY) {
+    } else if (info && info.curvePointInfo.linkedRoadPointIdY) {
       this.modifyPoint = {};
-      this.modifyPoint.linkedPointIdY = curvePointInfo.linkedPointIdY;
-      this.modifyPoint.y = curvePointInfo.y;
+      this.modifyPoint.linkedRoadPointIdY =
+        info.curvePointInfo.linkedRoadPointIdY;
+      this.modifyPoint.y = info.curvePointInfo.y;
       this.modifyPoint.x = position.x;
     } else {
       this.modifyPoint = null;
@@ -553,16 +888,16 @@ export default class ListenLayer {
       } else {
         return false;
       }
-    } else if (this.modifyPoint.linkedPointId) {
+    } else if (this.modifyPoint.linkedRoadPointId) {
       stateService.setSelectItem(
-        this.modifyPoint.linkedPointId,
+        this.modifyPoint.linkedRoadPointId,
         VectorType.RoadPoint,
         SelectState.Select
       );
-    } else if (this.modifyPoint.linkedCurvePointId) {
+    } else if (this.modifyPoint.linkedCurveRoadPointId) {
       stateService.setSelectItem(
-        this.modifyPoint.linkedCurvePointId,
-        VectorType.CurvePoint,
+        this.modifyPoint.linkedCurveRoadPointId,
+        VectorType.CurveRoadPoint,
         SelectState.Select
       );
     } else if (this.modifyPoint.linkedRoadId) {
@@ -586,13 +921,37 @@ export default class ListenLayer {
     } else if (this.modifyPoint.linkedEdgeId) {
       stateService.setSelectItem(
         this.modifyPoint.linkedEdgeId,
-        VectorType.Edge,
+        VectorType.RoadEdge,
         SelectState.Select
       );
     } else if (this.modifyPoint.linkedCurveEdgeId) {
       stateService.setSelectItem(
         this.modifyPoint.linkedCurveEdgeId,
-        VectorType.CurveEdge,
+        VectorType.CurveRoadEdge,
+        SelectState.Select
+      );
+    } else if (this.modifyPoint.linkedPointId) {
+      stateService.setSelectItem(
+        this.modifyPoint.linkedPointId,
+        VectorType.Point,
+        SelectState.Select
+      );
+    } else if (this.modifyPoint.linkedCurvePointId) {
+      stateService.setSelectItem(
+        this.modifyPoint.linkedCurvePointId,
+        VectorType.CurvePoint,
+        SelectState.Select
+      );
+    } else if (this.modifyPoint.linkedLineId) {
+      stateService.setSelectItem(
+        this.modifyPoint.linkedLineId,
+        VectorType.Line,
+        SelectState.Select
+      );
+    } else if (this.modifyPoint.linkedCurveLineId) {
+      stateService.setSelectItem(
+        this.modifyPoint.linkedCurveLineId,
+        VectorType.CurveLine,
         SelectState.Select
       );
     }

+ 13 - 9
src/graphic/Renderer/Draw.js

@@ -222,10 +222,10 @@ export default class Draw {
 
     const leftEdge = isTemp
       ? vector.leftEdge
-      : dataService.getEdge(vector.leftEdgeId);
+      : dataService.getRoadEdge(vector.leftEdgeId);
     const rightEdge = isTemp
       ? vector.rightEdge
-      : dataService.getEdge(vector.rightEdgeId);
+      : dataService.getRoadEdge(vector.rightEdgeId);
     const ctx = this.context;
     ctx.save();
     isTemp && (ctx.globalAlpha = 0.3);
@@ -245,10 +245,14 @@ export default class Draw {
 
   drawControlPoint(vector) {
     const start = coordinate.getScreenXY(
-      dataService.getEdge(vector.edgeInfo1.id).getPosition(vector.edgeInfo1.dir)
+      dataService
+        .getRoadEdge(vector.edgeInfo1.id)
+        .getPosition(vector.edgeInfo1.dir)
     );
     const end = coordinate.getScreenXY(
-      dataService.getEdge(vector.edgeInfo2.id).getPosition(vector.edgeInfo2.dir)
+      dataService
+        .getRoadEdge(vector.edgeInfo2.id)
+        .getPosition(vector.edgeInfo2.dir)
     );
     const pt2 = this.twoOrderBezier(
       0.5,
@@ -260,7 +264,7 @@ export default class Draw {
 
     const ctx = this.context;
     ctx.save();
-    help.setVectorStyle(ctx, null, "Edge");
+    help.setVectorStyle(ctx, null, "RoadEdge");
     //曲线
     ctx.moveTo(start.x, start.y);
     ctx.quadraticCurveTo(pt.x, pt.y, end.x, end.y);
@@ -269,7 +273,7 @@ export default class Draw {
 
     ctx.save();
     ctx.beginPath();
-    console.log(vector)
+    console.log(vector);
     help.setVectorStyle(ctx, vector);
 
     ctx.arc(
@@ -294,8 +298,8 @@ export default class Draw {
     help.drawCoves(ctx, coves);
     ctx.restore();
 
-    this.drawCurveEdge(dataService.getCurveEdge(vector.rightEdgeId));
-    this.drawCurveEdge(dataService.getCurveEdge(vector.leftEdgeId));
+    this.drawCurveEdge(dataService.getCurveRoadEdge(vector.rightEdgeId));
+    this.drawCurveEdge(dataService.getCurveRoadEdge(vector.leftEdgeId));
     vector.leftLanesCurves &&
       vector.leftLanesCurves.forEach(this.drawCurveLan.bind(this));
     vector.rightLanesCurves &&
@@ -337,7 +341,7 @@ export default class Draw {
   }
 
   drawRoadPoint(vector) {
-    this.drawPoint(vector)
+    this.drawPoint(vector);
   }
   drawPoint(vector) {
     const pt = coordinate.getScreenXY({ x: vector.x, y: vector.y });

+ 3 - 0
src/graphic/Renderer/Render.js

@@ -47,6 +47,9 @@ export default class Render {
       return;
     }
     switch (vector.geoType) {
+      case VectorType.Point:
+        draw.drawCircle(vector);
+        break;
       case VectorType.RoadPoint:
         draw.drawCircle(vector);
         break;

+ 3 - 3
src/graphic/Service/CurveEdgeService.js

@@ -1,4 +1,4 @@
-import CurveEdge from "../Geometry/CurveEdge.js";
+import CurveRoadEdge from "../Geometry/CurveRoadEdge.js";
 import Constant from "../Constant.js";
 import { dataService } from "./DataService.js";
 import { roadService } from "./RoadService.js";
@@ -9,9 +9,9 @@ export default class CurveEdgeService {
   constructor() {}
 
   create(start, end, vectorId, parentId) {
-    let curveEdge = new CurveEdge(start, end, vectorId, parentId);
+    let curveEdge = new CurveRoadEdge(start, end, vectorId, parentId);
     this.setCurves(curveEdge);
-    dataService.addCurveEdge(curveEdge);
+    dataService.addCurveRoadEdge(curveEdge);
     return curveEdge;
   }
 

+ 0 - 16
src/graphic/Service/CurvePointService.js

@@ -1,16 +0,0 @@
-import CurvePoint from "../Geometry/CurvePoint.js";
-import { dataService } from "./DataService.js";
-import { mathUtil } from "../Util/MathUtil";
-
-export default class CurvePointService {
-  constructor() {}
-
-  create(position, vectorId) {
-    let point = new CurvePoint(position, vectorId);
-    dataService.addCurvePoint(point);
-    return point;
-  }
-}
-
-const curvePointService = new CurvePointService();
-export { curvePointService };

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

@@ -0,0 +1,16 @@
+import CurveRoadPoint from "../Geometry/CurveRoadPoint.js";
+import { dataService } from "./DataService.js";
+import { mathUtil } from "../Util/MathUtil.js";
+
+export default class CurveRoadPointService {
+  constructor() {}
+
+  create(position, vectorId) {
+    let point = new CurveRoadPoint(position, vectorId);
+    dataService.addCurveRoadPoint(point);
+    return point;
+  }
+}
+
+const curveRoadPointService = new CurveRoadPointService();
+export { curveRoadPointService };

+ 27 - 202
src/graphic/Service/CurveRoadService.js

@@ -1,5 +1,5 @@
 import { dataService } from "./DataService";
-import { curvePointService } from "./CurvePointService";
+import { curveRoadPointService } from "./CurveRoadPointService";
 import { curveEdgeService } from "./CurveEdgeService";
 import { mathUtil } from "../Util/MathUtil.js";
 import CurveRoad from "../Geometry/CurveRoad.js";
@@ -16,10 +16,10 @@ export default class CurveRoadService extends RoadService {
     let curveRoad = new CurveRoad(startId, endId, vectorId);
     dataService.addCurveRoad(curveRoad);
 
-    let startPoint = dataService.getCurvePoint(startId);
+    let startPoint = dataService.getCurveRoadPoint(startId);
     startPoint.setPointParent(curveRoad.vectorId);
     startPoint.setIndex(0);
-    let endPoint = dataService.getCurvePoint(endId);
+    let endPoint = dataService.getCurveRoadPoint(endId);
     endPoint.setPointParent(curveRoad.vectorId);
     endPoint.setIndex(2);
 
@@ -73,7 +73,7 @@ export default class CurveRoadService extends RoadService {
 
   //不能加首尾,只能加中间
   addCPoint(curveRoad, position, startIndex) {
-    let point = curvePointService.create(position);
+    let point = curveRoadPointService.create(position);
     curveRoad.points.splice(startIndex + 1, 0, point);
     point.setPointParent(curveRoad.vectorId, startIndex);
     point.setIndex(startIndex + 1);
@@ -85,8 +85,8 @@ export default class CurveRoadService extends RoadService {
     let rightCount = curveRoad.rightDrivewayCount;
     let leftJoin = null;
     let rightJoin = null;
-    const leftCurveEdge = dataService.getCurveEdge(curveRoad.leftEdgeId);
-    const rightCurveEdge = dataService.getCurveEdge(curveRoad.rightEdgeId);
+    const leftCurveEdge = dataService.getCurveRoadEdge(curveRoad.leftEdgeId);
+    const rightCurveEdge = dataService.getCurveRoadEdge(curveRoad.rightEdgeId);
     let line1 = mathUtil.createLine1(
       curveRoad.points[startIndex],
       curveRoad.points[startIndex + 1]
@@ -222,18 +222,18 @@ export default class CurveRoadService extends RoadService {
   }
 
   subCPoint(curveRoad, index) {
-    dataService.deleteCurvePoint(curveRoad.points[index].vectorId);
+    dataService.deleteCurveRoadPoint(curveRoad.points[index].vectorId);
     curveRoad.points.splice(index, 1);
     for (let i = index; i < curveRoad.points.length; ++i) {
       curveRoad.points[i].setIndex(i);
     }
     this.setCurves(curveRoad);
 
-    const leftCurveEdge = dataService.getCurveEdge(curveRoad.leftEdgeId);
+    const leftCurveEdge = dataService.getCurveRoadEdge(curveRoad.leftEdgeId);
     leftCurveEdge.points.splice(index, 1);
     curveEdgeService.setCurves(leftCurveEdge);
 
-    const rightCurveEdge = dataService.getCurveEdge(curveRoad.rightEdgeId);
+    const rightCurveEdge = dataService.getCurveRoadEdge(curveRoad.rightEdgeId);
     rightCurveEdge.points.splice(index, 1);
     curveEdgeService.setCurves(rightCurveEdge);
 
@@ -260,7 +260,7 @@ export default class CurveRoadService extends RoadService {
     let startPoint = dataService.getRoadPoint(curveRoad.startId);
     let endPoint = dataService.getRoadPoint(curveRoad.endId);
 
-    let midPoint = curvePointService.create({
+    let midPoint = curveRoadPointService.create({
       x: (startPoint.x + endPoint.x) / 2,
       y: (startPoint.y + endPoint.y) / 2,
     });
@@ -275,8 +275,8 @@ export default class CurveRoadService extends RoadService {
   //points的第一个元素是start,最后一个是end
   setLanes(curveRoad, dir) {
     let points = curveRoad.points;
-    const leftEdge = dataService.getCurveEdge(curveRoad.leftEdgeId);
-    const rightEdge = dataService.getCurveEdge(curveRoad.rightEdgeId);
+    const leftEdge = dataService.getCurveRoadEdge(curveRoad.leftEdgeId);
+    const rightEdge = dataService.getCurveRoadEdge(curveRoad.rightEdgeId);
     const leftEdgePoints = leftEdge.points;
     const rightEdgePoints = rightEdge.points;
     const leftCount = curveRoad.leftDrivewayCount;
@@ -333,12 +333,12 @@ export default class CurveRoadService extends RoadService {
     }
 
     if (dir == "left") {
-      curveEdge = dataService.getCurveEdge(curveRoad.leftEdgeId);
+      curveEdge = dataService.getCurveRoadEdge(curveRoad.leftEdgeId);
       oldCount = curveRoad.leftDrivewayCount;
       curveRoad.leftDrivewayCount = newCount;
       lanes = curveRoad.leftLanes;
     } else if (dir == "right") {
-      curveEdge = dataService.getCurveEdge(curveRoad.rightEdgeId);
+      curveEdge = dataService.getCurveRoadEdge(curveRoad.rightEdgeId);
       oldCount = curveRoad.rightDrivewayCount;
       curveRoad.rightDrivewayCount = newCount;
       lanes = curveRoad.rightLanes;
@@ -371,11 +371,13 @@ export default class CurveRoadService extends RoadService {
 
     const line = mathUtil.createLine1(curveRoad.points[0], curveRoad.points[1]);
     if (dir == "left") {
-      const leftCurveEdge = dataService.getCurveEdge(curveRoad.leftEdgeId);
+      const leftCurveEdge = dataService.getCurveRoadEdge(curveRoad.leftEdgeId);
       const leftWidth = mathUtil.getDisForPoinLine(leftCurveEdge.start, line);
       curveRoad.setWidth(leftWidth, "left");
     } else if (dir == "right") {
-      const rightCurveEdge = dataService.getCurveEdge(curveRoad.rightEdgeId);
+      const rightCurveEdge = dataService.getCurveRoadEdge(
+        curveRoad.rightEdgeId
+      );
       const rightWidth = mathUtil.getDisForPoinLine(rightCurveEdge.start, line);
       curveRoad.setWidth(rightWidth, "right");
     }
@@ -405,189 +407,12 @@ export default class CurveRoadService extends RoadService {
     curveRoad.rightLanes = [];
   }
 
-  // updateForMovePoint(pointId, position) {
-  //   let curvePoint = dataService.getCurvePoint(pointId);
-  //   let curveRoadId = curvePoint.getParent();
-  //   let curveRoad = dataService.getCurveRoad(curveRoadId);
-
-  //   let index = curvePoint.getIndex();
-  //   let dx = position.x - curvePoint.x;
-  //   let dy = position.y - curvePoint.y;
-
-  //   curvePoint.setPosition(position);
-
-  //   let line = null;
-  //   let join = null;
-  //   let len = curveRoad.points.length;
-
-  //   const leftCurveEdge = dataService.getCurveEdge(curveRoad.leftEdgeId);
-  //   leftCurveEdge.points[index].x += dx;
-  //   leftCurveEdge.points[index].y += dy;
-
-  //   const rightCurveEdge = dataService.getCurveEdge(curveRoad.rightEdgeId);
-  //   rightCurveEdge.points[index].x += dx;
-  //   rightCurveEdge.points[index].y += dy;
-
-  //   if (index == 0 || index == 1) {
-  //     line = mathUtil.createLine1(curveRoad.points[0], curveRoad.points[1]);
-  //     if (
-  //       line != null &&
-  //       !line.hasOwnProperty("x") &&
-  //       !line.hasOwnProperty("y")
-  //     ) {
-  //       let line1 = mathUtil.createLine3(line, leftCurveEdge.points[index]);
-  //       join = mathUtil.getJoinLinePoint(curveRoad.points[0], line1);
-  //       leftCurveEdge.points[0].x = join.x;
-  //       leftCurveEdge.points[0].y = join.y;
-  //       leftCurveEdge.start.x = join.x;
-  //       leftCurveEdge.start.y = join.y;
-
-  //       let line2 = mathUtil.createLine3(line, rightCurveEdge.points[index]);
-  //       join = mathUtil.getJoinLinePoint(curveRoad.points[0], line2);
-  //       rightCurveEdge.points[0].x = join.x;
-  //       rightCurveEdge.points[0].y = join.y;
-  //       rightCurveEdge.start.x = join.x;
-  //       rightCurveEdge.start.y = join.y;
-  //     }
-  //   }
-
-  //   if (
-  //     index == curveRoad.points.length - 1 ||
-  //     index == curveRoad.points.length - 2
-  //   ) {
-  //     line = mathUtil.createLine1(
-  //       curveRoad.points[len - 2],
-  //       curveRoad.points[len - 1]
-  //     );
-  //     if (
-  //       line != null &&
-  //       !line.hasOwnProperty("x") &&
-  //       !line.hasOwnProperty("y")
-  //     ) {
-  //       let line1 = mathUtil.createLine3(line, leftCurveEdge.points[index]);
-  //       join = mathUtil.getJoinLinePoint(curveRoad.points[len - 1], line1);
-  //       leftCurveEdge.points[len - 1].x = join.x;
-  //       leftCurveEdge.points[len - 1].y = join.y;
-  //       leftCurveEdge.end.x = join.x;
-  //       leftCurveEdge.end.y = join.y;
-  //       let line2 = mathUtil.createLine3(line, rightCurveEdge.points[index]);
-  //       join = mathUtil.getJoinLinePoint(curveRoad.points[len - 1], line2);
-  //       rightCurveEdge.points[len - 1].x = join.x;
-  //       rightCurveEdge.points[len - 1].y = join.y;
-  //       rightCurveEdge.end.x = join.x;
-  //       rightCurveEdge.end.y = join.y;
-  //     }
-  //   }
-
-  //   for (let i = 0; i < curveRoad.leftLanes.length; ++i) {
-  //     curveRoad.leftLanes[i][index].x += dx;
-  //     curveRoad.leftLanes[i][index].y += dy;
-  //     //需要修改端点
-  //     if (
-  //       index == 0 ||
-  //       index == 1 ||
-  //       index == curveRoad.points.length - 1 ||
-  //       index == curveRoad.points.length - 2
-  //     ) {
-  //       if (index == 0 || index == 1) {
-  //         line = mathUtil.createLine1(curveRoad.points[0], curveRoad.points[1]);
-  //         if (
-  //           line != null &&
-  //           !line.hasOwnProperty("x") &&
-  //           !line.hasOwnProperty("y")
-  //         ) {
-  //           line = mathUtil.createLine3(line, curveRoad.leftLanes[i][index]);
-  //           join = mathUtil.getJoinLinePoint(curveRoad.points[0], line);
-  //           curveRoad.leftLanes[i][0].x = join.x;
-  //           curveRoad.leftLanes[i][0].y = join.y;
-  //         }
-  //       }
-
-  //       if (
-  //         index == curveRoad.points.length - 1 ||
-  //         index == curveRoad.points.length - 2
-  //       ) {
-  //         line = mathUtil.createLine1(
-  //           curveRoad.points[len - 2],
-  //           curveRoad.points[len - 1]
-  //         );
-  //         if (
-  //           line != null &&
-  //           !line.hasOwnProperty("x") &&
-  //           !line.hasOwnProperty("y")
-  //         ) {
-  //           line = mathUtil.createLine3(line, curveRoad.leftLanes[i][index]);
-  //           join = mathUtil.getJoinLinePoint(curveRoad.points[len - 1], line);
-  //           curveRoad.leftLanes[i][len - 1].x = join.x;
-  //           curveRoad.leftLanes[i][len - 1].y = join.y;
-  //         }
-  //       }
-  //     }
-
-  //     curveRoad.leftLanesCurves[i] = mathUtil.getCurvesByPoints(
-  //       curveRoad.leftLanes[i]
-  //     );
-  //   }
-  //   for (let i = 0; i < curveRoad.rightLanes.length; ++i) {
-  //     curveRoad.rightLanes[i][index].x += dx;
-  //     curveRoad.rightLanes[i][index].y += dy;
-  //     //需要修改端点
-  //     if (
-  //       index == 0 ||
-  //       index == 1 ||
-  //       index == curveRoad.points.length - 1 ||
-  //       index == curveRoad.points.length - 2
-  //     ) {
-  //       if (index == 0 || index == 1) {
-  //         line = mathUtil.createLine1(curveRoad.points[0], curveRoad.points[1]);
-  //         if (
-  //           line != null &&
-  //           !line.hasOwnProperty("x") &&
-  //           !line.hasOwnProperty("y")
-  //         ) {
-  //           line = mathUtil.createLine3(line, curveRoad.rightLanes[i][index]);
-  //           join = mathUtil.getJoinLinePoint(curveRoad.points[0], line);
-  //           curveRoad.rightLanes[i][0].x = join.x;
-  //           curveRoad.rightLanes[i][0].y = join.y;
-  //         }
-  //       }
-  //       if (
-  //         index == curveRoad.points.length - 1 ||
-  //         index == curveRoad.points.length - 2
-  //       ) {
-  //         line = mathUtil.createLine1(
-  //           curveRoad.points[len - 2],
-  //           curveRoad.points[len - 1]
-  //         );
-  //         if (
-  //           line != null &&
-  //           !line.hasOwnProperty("x") &&
-  //           !line.hasOwnProperty("y")
-  //         ) {
-  //           line = mathUtil.createLine3(line, curveRoad.rightLanes[i][index]);
-  //           join = mathUtil.getJoinLinePoint(curveRoad.points[len - 1], line);
-  //           curveRoad.rightLanes[i][len - 1].x = join.x;
-  //           curveRoad.rightLanes[i][len - 1].y = join.y;
-  //         }
-  //       }
-  //     }
-
-  //     curveRoad.rightLanesCurves[i] = mathUtil.getCurvesByPoints(
-  //       curveRoad.rightLanes[i]
-  //     );
-  //   }
-
-  //   this.setCurves(curveRoad);
-  //   curveEdgeService.setCurves(leftCurveEdge);
-  //   curveEdgeService.setCurves(rightCurveEdge);
-  // }
-
   updateForMovePoint(pointId, position) {
-    let curvePoint = dataService.getCurvePoint(pointId);
+    let curvePoint = dataService.getCurveRoadPoint(pointId);
     let curveRoadId = curvePoint.getParent();
     let curveRoad = dataService.getCurveRoad(curveRoadId);
-    let startPoint = dataService.getCurvePoint(curveRoad.startId);
-    let endPoint = dataService.getCurvePoint(curveRoad.endId);
+    let startPoint = dataService.getCurveRoadPoint(curveRoad.startId);
+    let endPoint = dataService.getCurveRoadPoint(curveRoad.endId);
     let index = curvePoint.getIndex();
     mathUtil.clonePoint(curveRoad.points[index], position);
     if (index == 0) {
@@ -601,11 +426,11 @@ export default class CurveRoadService extends RoadService {
       curveRoad.rightWidth
     );
 
-    const leftCurveEdge = dataService.getCurveEdge(curveRoad.leftEdgeId);
+    const leftCurveEdge = dataService.getCurveRoadEdge(curveRoad.leftEdgeId);
     leftCurveEdge.points = edgePoints.leftEdgePoints;
     leftCurveEdge.start = leftCurveEdge.points[0];
     leftCurveEdge.end = leftCurveEdge.points[leftCurveEdge.points.length - 1];
-    const rightCurveEdge = dataService.getCurveEdge(curveRoad.rightEdgeId);
+    const rightCurveEdge = dataService.getCurveRoadEdge(curveRoad.rightEdgeId);
     rightCurveEdge.points = edgePoints.rightEdgePoints;
     rightCurveEdge.start = rightCurveEdge.points[0];
     rightCurveEdge.end =
@@ -620,8 +445,8 @@ export default class CurveRoadService extends RoadService {
   //变宽或者变窄(车道数据不变)
   updateForWidth(curveRoadId, newWidth, dir) {
     let curveRoad = dataService.getCurveRoad(curveRoadId);
-    let leftCurveEdge = dataService.getCurveEdge(curveRoad.leftEdgeId);
-    let rightCurveEdge = dataService.getCurveEdge(curveRoad.rightEdgeId);
+    let leftCurveEdge = dataService.getCurveRoadEdge(curveRoad.leftEdgeId);
+    let rightCurveEdge = dataService.getCurveRoadEdge(curveRoad.rightEdgeId);
 
     let ratio = null;
     let dx = null;
@@ -661,8 +486,8 @@ export default class CurveRoadService extends RoadService {
 
   unlock(curveRoadId) {
     let curveRoad = dataService.getCurveRoad(curveRoadId);
-    let leftCurveEdge = dataService.getCurveEdge(curveRoad.leftEdgeId);
-    let rightCurveEdge = dataService.getCurveEdge(curveRoad.rightEdgeId);
+    let leftCurveEdge = dataService.getCurveRoadEdge(curveRoad.leftEdgeId);
+    let rightCurveEdge = dataService.getCurveRoadEdge(curveRoad.rightEdgeId);
     let lanes = curveRoad.lanes;
 
     for (let i = 0; i < curveRoad.curves.length; ++i) {

+ 143 - 99
src/graphic/Service/DataService.js

@@ -16,6 +16,43 @@ export class DataService {
     this.currentId = 0; // 当前可用id
   }
 
+  setCurrentId(id) {
+    this.currentId = id;
+  }
+
+  getCurrentId() {
+    return this.currentId;
+  }
+
+  updateCurrentId() {
+    ++this.currentId;
+  }
+
+  getVectorData() {
+    return this.vectorData;
+  }
+
+  initVectorData() {
+    this.vectorData.backgroundImg = null;
+    //直路
+    this.vectorData.roadPoints = {};
+    this.vectorData.roads = {};
+    this.vectorData.roadEdges = {};
+    //弯路
+    this.vectorData.curveRoadPoints = {};
+    this.vectorData.curveRoads = {};
+    this.vectorData.curveRoadEdges = {};
+    //直路交叉的时候,产生的曲线控制点
+    this.vectorData.controlPoints = {};
+    //直线
+    this.vectorData.lines = {};
+    //弯曲线条
+    this.vectorData.curvelines = {};
+    //线段(完全或者直线)上的端点
+    this.vectorData.points = {};
+  }
+
+  //网格
   getGrid() {
     return this.grid;
   }
@@ -47,53 +84,53 @@ export class DataService {
     return this.grid.display;
   }
 
-  setCurrentId(id) {
-    this.currentId = id;
+  //背景图片
+  addBackgroundImg(img) {
+    this.vectorData.backgroundImg = img;
   }
 
-  getCurrentId() {
-    return this.currentId;
+  getBackgroundImg() {
+    return this.vectorData.backgroundImg;
   }
 
-  updateCurrentId() {
-    ++this.currentId;
+  setAngle(angle) {
+    this.vectorData.backgroundImg.angle = angle;
   }
 
-  getVectorData() {
-    return this.vectorData;
+  //直线
+  addLine(line) {
+    this.vectorData.lines[line.vectorId] = line;
   }
 
-  initVectorData() {
-    this.vectorData.backgroundImg = null;
-    this.vectorData.roadPoints = {};
-    this.vectorData.roads = {};
-    this.vectorData.edges = {};
-    this.vectorData.curvePoints = {};
-    this.vectorData.curveRoads = {};
-    this.vectorData.curveEdges = {};
-    this.vectorData.controlPoints = {};
-    this.vectorData.lines = {};
-    this.vectorData.curvelines = {};
+  addPoint(point) {
+    this.vectorData.points[point.vectorId] = point;
   }
 
-  createLine(start, end) {
-    let line = new Line(start, end);
-    this.addLine(line);
+  getLines() {
+    return this.vectorData.lines;
   }
 
-  createCurveLine(points) {
-    let curveLine = new CurveLine(points);
-    this.addCurveLine(curveLine);
+  getLine(lineId) {
+    return this.vectorData.lines[lineId];
   }
 
-  addLine(line) {
-    this.vectorData.lines[line.vectorId] = line;
+  getPoints() {
+    return this.vectorData.points;
   }
 
+  getPoint(pointId) {
+    return this.vectorData.points[pointId];
+  }
+
+  //弯曲线条
   addCurveLine(curveLine) {
     this.vectorData.curvelines[curveLine.vectorId] = curveLine;
   }
 
+  addCurvePoint(curvePoint) {
+    this.vectorData.curvePoints[curvePoint.vectorId] = curvePoint;
+  }
+
   getCurvePoints() {
     return this.vectorData.curvePoints;
   }
@@ -109,9 +146,46 @@ export class DataService {
   deleteCurvePoint(curvePointId) {
     delete this.vectorData.curvePoints[curvePointId];
   }
+
+  getCurveLines() {
+    return this.vectorData.curvelines;
+  }
+
+  getCurveLine(curveLineId) {
+    if (curveLineId) {
+      return this.vectorData.curvelines[curveLineId];
+    } else {
+      return null;
+    }
+  }
+
   /**
-   * 对公路的操作
+   * 对路的操作
    */
+  addCurveRoadPoint(curveRoadPoint) {
+    this.vectorData.curveRoadPoints[curveRoadPoint.vectorId] = curveRoadPoint;
+  }
+
+  getCurveRoadPoints() {
+    return this.vectorData.curveRoadPoints;
+  }
+
+  getCurveRoadPoint(curveRoadPointId) {
+    if (curveRoadPointId) {
+      return this.vectorData.curveRoadPoints[curveRoadPointId];
+    } else {
+      return null;
+    }
+  }
+
+  deleteCurveRoadPoint(curveRoadPointId) {
+    delete this.vectorData.curveRoadPoints[curveRoadPointId];
+  }
+
+  addCurveRoad(curveRoad) {
+    this.vectorData.curveRoads[curveRoad.vectorId] = curveRoad;
+  }
+
   getCurveRoads() {
     return this.vectorData.curveRoads;
   }
@@ -124,36 +198,29 @@ export class DataService {
     }
   }
 
-  addCurveRoad(curveRoad) {
-    this.vectorData.curveRoads[curveRoad.vectorId] = curveRoad;
-  }
-
   deleteCurveRoad(curveRoadId) {
     let curveRoad = this.getCurveRoad(curveRoadId);
     for (let i = 0; i < curveRoad.points.length; ++i) {
-      this.deleteCurvePoint(curveRoad.points[i].vectorId);
+      this.deleteCurveRoadPoint(curveRoad.points[i].vectorId);
     }
-    this.deleteCurveEdge(curveRoad.leftEdgeId);
-    this.deleteCurveEdge(curveRoad.rightEdgeId);
+    this.deleteCurveRoadEdge(curveRoad.leftEdgeId);
+    this.deleteCurveRoadEdge(curveRoad.rightEdgeId);
     delete this.vectorData.curveRoads[curveRoadId];
   }
 
-  getCurveEdge(curveEdgeId) {
-    return this.vectorData.curveEdges[curveEdgeId];
+  getCurveRoadEdge(curveRoadEdgeId) {
+    return this.vectorData.curveRoadEdges[curveRoadEdgeId];
   }
 
-  addCurveEdge(curveEdge) {
-    this.vectorData.curveEdges[curveEdge.vectorId] = curveEdge;
+  addCurveRoadEdge(curveRoadEdge) {
+    this.vectorData.curveRoadEdges[curveRoadEdge.vectorId] = curveRoadEdge;
   }
 
-  deleteCurveEdge(curveEdgeId) {
-    delete this.vectorData.curveEdges[curveEdgeId];
-  }
-
-  addCurvePoint(curvePoint) {
-    this.vectorData.curvePoints[curvePoint.vectorId] = curvePoint;
+  deleteCurveRoadEdge(curveRoadEdgeId) {
+    delete this.vectorData.curveRoadEdges[curveRoadEdgeId];
   }
 
+  //直线
   getRoads() {
     return this.vectorData.roads;
   }
@@ -172,15 +239,15 @@ export class DataService {
 
   deleteRoad(roadId) {
     let road = this.getRoad(roadId);
-    this.deletePoint(road.startId, roadId);
-    this.deletePoint(road.endId, roadId);
-    this.deleteEdge(road.leftEdgeId);
-    this.deleteEdge(road.rightEdgeId);
+    this.deleteRoadPoint(road.startId, roadId);
+    this.deleteRoadPoint(road.endId, roadId);
+    this.deleteRoadEdge(road.leftEdgeId);
+    this.deleteRoadEdge(road.rightEdgeId);
     delete this.vectorData.roads[roadId];
   }
 
-  deleteEdge(edgeId) {
-    delete this.vectorData.edges[edgeId];
+  deleteRoadEdge(edgeId) {
+    delete this.vectorData.roadEdges[edgeId];
   }
 
   /**
@@ -190,35 +257,35 @@ export class DataService {
     return this.vectorData.roadPoints;
   }
 
-  getRoadPoint(pointId) {
-    if (pointId) {
-      return this.vectorData.roadPoints[pointId];
+  getRoadPoint(roadPointId) {
+    if (roadPointId) {
+      return this.vectorData.roadPoints[roadPointId];
     } else {
       return null;
     }
   }
 
-  deleteRoadPoint(pointId, roadId) {
-    let point = this.getRoadPoint(pointId);
+  deleteRoadPoint(roadPointId, roadId) {
+    let roadPoint = this.getRoadPoint(roadPointId);
     //有可能先删除墙,导致点没了
-    if (point) {
-      if (Object.keys(point.parent).length == 0) {
-        point = null;
-        delete this.vectorData.roadPoints[pointId];
-      } else if (Object.keys(point.parent).length == 1 && !roadId) {
-        delete this.vectorData.roadPoints[pointId];
+    if (roadPoint) {
+      if (Object.keys(roadPoint.parent).length == 0) {
+        roadPoint = null;
+        delete this.vectorData.roadPoints[roadPointId];
+      } else if (Object.keys(roadPoint.parent).length == 1 && !roadId) {
+        delete this.vectorData.roadPoints[roadPointId];
       } else if (
-        Object.keys(point.parent).length == 1 &&
-        point.parent[roadId]
+        Object.keys(roadPoint.parent).length == 1 &&
+        roadPoint.parent[roadId]
       ) {
-        delete this.vectorData.roadPoints[pointId];
+        delete this.vectorData.roadPoints[roadPointId];
       } else if (
-        Object.keys(point.parent).length == 1 &&
-        !point.parent[roadId]
+        Object.keys(roadPoint.parent).length == 1 &&
+        !roadPoint.parent[roadId]
       ) {
         return;
       } else {
-        delete point.parent[roadId];
+        delete roadPoint.parent[roadId];
       }
     }
   }
@@ -227,6 +294,14 @@ export class DataService {
     this.vectorData.roadPoints[roadPoint.vectorId] = roadPoint;
   }
 
+  getRoadEdge(roadEdgeId) {
+    return this.vectorData.roadEdges[roadEdgeId];
+  }
+
+  addRoadEdge(roadEdge) {
+    this.vectorData.roadEdges[roadEdge.vectorId] = roadEdge;
+  }
+
   /**
    * 对控制点的操作
    */
@@ -234,14 +309,6 @@ export class DataService {
     return this.vectorData.controlPoints;
   }
 
-  // getControlPoint(controlPointId) {
-  //   if (controlPointId) {
-  //     return this.vectorData.controlPoints[controlPointId];
-  //   } else {
-  //     return null;
-  //   }
-  // }
-
   getControlPoint(edgeId1, edgeId2) {
     if (this.vectorData.controlPoints[edgeId1 + "-" + edgeId2]) {
       return this.vectorData.controlPoints[edgeId1 + "-" + edgeId2];
@@ -318,29 +385,6 @@ export class DataService {
   }
 
   /**
-   * 对公路边缘的操作
-   */
-  getEdge(edgeId) {
-    return this.vectorData.edges[edgeId];
-  }
-
-  addEdge(edge) {
-    this.vectorData.edges[edge.vectorId] = edge;
-  }
-
-  addBackgroundImg(img) {
-    this.vectorData.backgroundImg = img;
-  }
-
-  getBackgroundImg() {
-    return this.vectorData.backgroundImg;
-  }
-
-  setAngle(angle) {
-    this.vectorData.backgroundImg.angle = angle;
-  }
-
-  /**
    * 对标注的操作
    */
   addTag(tag) {

+ 15 - 15
src/graphic/Service/EdgeService.js

@@ -1,4 +1,4 @@
-import Edge from "../Geometry/Edge.js";
+import RoadEdge from "../Geometry/RoadEdge.js";
 import Constant from "../Constant.js";
 import { dataService } from "./DataService.js";
 import { roadService } from "./RoadService.js";
@@ -9,8 +9,8 @@ export default class EdgeService {
   constructor() {}
 
   create(start, end, vectorId, parentId) {
-    let edge = new Edge(start, end, vectorId, parentId);
-    dataService.addEdge(edge);
+    let edge = new RoadEdge(start, end, vectorId, parentId);
+    dataService.addRoadEdge(edge);
     return edge;
   }
 
@@ -23,8 +23,8 @@ export default class EdgeService {
     let road = dataService.getRoad(roadId);
     let startPoint = dataService.getRoadPoint(road.startId);
     let endPoint = dataService.getRoadPoint(road.endId);
-    let leftEdge = dataService.getEdge(road.leftEdgeId);
-    let rightEdge = dataService.getEdge(road.rightEdgeId);
+    let leftEdge = dataService.getRoadEdge(road.leftEdgeId);
+    let rightEdge = dataService.getRoadEdge(road.rightEdgeId);
 
     let edgePoints = mathUtil.RectangleVertex(
       startPoint,
@@ -52,8 +52,8 @@ export default class EdgeService {
     let startPoint = dataService.getRoadPoint(road.startId);
     let endPoint = dataService.getRoadPoint(road.endId);
 
-    let leftEdge = dataService.getEdge(road.leftEdgeId);
-    let rightEdge = dataService.getEdge(road.rightEdgeId);
+    let leftEdge = dataService.getRoadEdge(road.leftEdgeId);
+    let rightEdge = dataService.getRoadEdge(road.rightEdgeId);
 
     let point = null;
     if (dir == "start") {
@@ -90,8 +90,8 @@ export default class EdgeService {
     let startPoint1 = dataService.getRoadPoint(road1.startId);
     let endPoint1 = dataService.getRoadPoint(road1.endId);
     // this.computerDefaultEdge(roadId1);   不能这样,会导致另一端点对应的edge端点改变
-    let leftEdge1 = dataService.getEdge(road1.leftEdgeId);
-    let rightEdge1 = dataService.getEdge(road1.rightEdgeId);
+    let leftEdge1 = dataService.getRoadEdge(road1.leftEdgeId);
+    let rightEdge1 = dataService.getRoadEdge(road1.rightEdgeId);
     let lineLeft1 = this.getLine(leftEdge1);
     let lineRight1 = this.getLine(rightEdge1);
 
@@ -99,8 +99,8 @@ export default class EdgeService {
     // this.computerDefaultEdge(roadId2);
     let startPoint2 = dataService.getRoadPoint(road2.startId);
     let endPoint2 = dataService.getRoadPoint(road2.endId);
-    let leftEdge2 = dataService.getEdge(road2.leftEdgeId);
-    let rightEdge2 = dataService.getEdge(road2.rightEdgeId);
+    let leftEdge2 = dataService.getRoadEdge(road2.leftEdgeId);
+    let rightEdge2 = dataService.getRoadEdge(road2.rightEdgeId);
     let lineLeft2 = this.getLine(leftEdge2);
     let lineRight2 = this.getLine(rightEdge2);
 
@@ -421,8 +421,8 @@ export default class EdgeService {
     const endPoint1 = dataService.getRoadPoint(road1.endId);
     let line1 = mathUtil.createLine1(startPoint1, endPoint1);
 
-    let leftEdge1 = dataService.getEdge(road1.leftEdgeId);
-    let rightEdge1 = dataService.getEdge(road1.rightEdgeId);
+    let leftEdge1 = dataService.getRoadEdge(road1.leftEdgeId);
+    let rightEdge1 = dataService.getRoadEdge(road1.rightEdgeId);
     let lineLeft1 = this.getLine(leftEdge1);
     let lineRight1 = this.getLine(rightEdge1);
 
@@ -431,8 +431,8 @@ export default class EdgeService {
     const endPoint2 = dataService.getRoadPoint(road2.endId);
     let line2 = mathUtil.createLine1(startPoint2, endPoint2);
 
-    let leftEdge2 = dataService.getEdge(road2.leftEdgeId);
-    let rightEdge2 = dataService.getEdge(road2.rightEdgeId);
+    let leftEdge2 = dataService.getRoadEdge(road2.leftEdgeId);
+    let rightEdge2 = dataService.getRoadEdge(road2.rightEdgeId);
     let lineLeft2 = this.getLine(leftEdge2);
     let lineRight2 = this.getLine(rightEdge2);
 

+ 50 - 24
src/graphic/Service/ElementService.js

@@ -1,7 +1,7 @@
 import Point from "../Geometry/Point.js";
-import Line from "../Geometry/Line.js";
+import GuideLine from "../Geometry/GuideLine.js";
 import Road from "../Geometry/Road.js";
-import Edge from "../Geometry/Edge.js";
+import RoadEdge from "../Geometry/RoadEdge.js";
 import MeasureLine from "../Geometry/MeasureLine.js";
 import ElementEvents from "../enum/ElementEvents.js";
 import { listenLayer } from "../ListenLayer";
@@ -37,19 +37,22 @@ export class ElementService {
     this.newRoad = this.createTempRoad();
     this.newRoad.name = ElementEvents.NewRoad;
 
+    this.newLine = new GuideLine({ x: 0, y: 0 }, { x: 1, y: 1 });
+    this.newLine.name = ElementEvents.NewLine;
+
     this.newMeasureLine = new MeasureLine({ x: 0, y: 0 }, { x: 1, y: 1 });
     this.newMeasureLine.name = ElementEvents.NewMeasureLine;
 
-    this.checkLines.X = new Line({ x: 0, y: 0 }, { x: 1, y: 1 });
+    this.checkLines.X = new GuideLine({ x: 0, y: 0 }, { x: 1, y: 1 });
     this.checkLines.X.name = ElementEvents.CheckLinesX;
 
-    this.checkLines.Y = new Line({ x: 0, y: 0 }, { x: 1, y: 1 });
+    this.checkLines.Y = new GuideLine({ x: 0, y: 0 }, { x: 1, y: 1 });
     this.checkLines.Y.name = ElementEvents.CheckLinesY;
 
-    this.vCheckLines.X = new Line({ x: 0, y: 0 }, { x: 1, y: 1 });
+    this.vCheckLines.X = new GuideLine({ x: 0, y: 0 }, { x: 1, y: 1 });
     this.vCheckLines.X.name = ElementEvents.VCheckLinesX;
 
-    this.vCheckLines.Y = new Line({ x: 0, y: 0 }, { x: 1, y: 1 });
+    this.vCheckLines.Y = new GuideLine({ x: 0, y: 0 }, { x: 1, y: 1 });
     this.vCheckLines.Y.name = ElementEvents.VCheckLinesY;
 
     this.hideAll();
@@ -68,14 +71,14 @@ export class ElementService {
       Constant.defaultRoadWidth
     );
 
-    let leftEdge = new Edge(
+    let leftEdge = new RoadEdge(
       edgePoints.leftEdgeStart,
       edgePoints.leftEdgeEnd,
       null,
       this.newRoad.vectorId
     );
 
-    let rightEdge = new Edge(
+    let rightEdge = new RoadEdge(
       edgePoints.rightEdgeStart,
       edgePoints.rightEdgeEnd,
       null,
@@ -134,12 +137,20 @@ export class ElementService {
     }
   }
 
-  setNewRoadState(state) {
-    this.newRoad.state = state;
+  setNewLine(point1, point2) {
+    this.newLine.setPositions(point1, point2);
   }
 
-  setNewRoadGeoType(geoType) {
-    this.newRoad.geoType = geoType;
+  showNewLine() {
+    this.newLine.display = true;
+  }
+
+  hideNewLine() {
+    this.newLine.display = false;
+  }
+
+  setNewRoadState(state) {
+    this.newRoad.state = state;
   }
 
   showCheckLinesX() {
@@ -203,6 +214,7 @@ export class ElementService {
     this.hideCheckLinesY();
     this.hidePoint();
     this.hideNewRoad();
+    this.hideNewLine();
     this.hideNewMeasureLine();
     this.hideVCheckLinesX();
     this.hideVCheckLinesY();
@@ -250,28 +262,42 @@ export class ElementService {
 
     if (!this.vCheckLines.Y.display && !this.vCheckLines.Y.display) {
       if (listenLayer.modifyPoint) {
-        if (listenLayer.modifyPoint.linkedPointIdX) {
+        if (listenLayer.modifyPoint.linkedRoadPointIdX) {
           let linkedPointX = dataService.getRoadPoint(
+            listenLayer.modifyPoint.linkedRoadPointIdX
+          );
+          this.setCheckLinesX(linkedPointX, position);
+          this.showCheckLinesX();
+        } else if (listenLayer.modifyPoint.linkedCurveRoadPointIdX) {
+          let linkedPointX = dataService.getCurveRoadPoint(
+            listenLayer.modifyPoint.linkedCurveRoadPointIdX
+          );
+          this.setCheckLinesX(linkedPointX, position);
+          this.showCheckLinesX();
+        } else if (listenLayer.modifyPoint.linkedPointIdX) {
+          let linkedPointX = dataService.getPoint(
             listenLayer.modifyPoint.linkedPointIdX
           );
-          if (!linkedPointX) {
-            linkedPointX = dataService.getCurvePoint(
-              listenLayer.modifyPoint.linkedPointIdX
-            );
-          }
           this.setCheckLinesX(linkedPointX, position);
           this.showCheckLinesX();
         }
 
-        if (listenLayer.modifyPoint.linkedPointIdY) {
+        if (listenLayer.modifyPoint.linkedRoadPointIdY) {
           let linkedPointY = dataService.getRoadPoint(
+            listenLayer.modifyPoint.linkedRoadPointIdY
+          );
+          this.setCheckLinesY(linkedPointY, position);
+          this.showCheckLinesY();
+        } else if (listenLayer.modifyPoint.linkedCurveRoadPointIdY) {
+          linkedPointY = dataService.getCurveRoadPoint(
+            listenLayer.modifyPoint.linkedCurveRoadPointIdY
+          );
+          this.setCheckLinesY(linkedPointY, position);
+          this.showCheckLinesY();
+        } else if (listenLayer.modifyPoint.linkedPointIdY) {
+          linkedPointY = dataService.getPoint(
             listenLayer.modifyPoint.linkedPointIdY
           );
-          if (!linkedPointY) {
-            linkedPointY = dataService.getCurvePoint(
-              listenLayer.modifyPoint.linkedPointIdY
-            );
-          }
           this.setCheckLinesY(linkedPointY, position);
           this.showCheckLinesY();
         }

+ 21 - 0
src/graphic/Service/LineService.js

@@ -0,0 +1,21 @@
+import Point from "../Geometry/Point.js";
+import Line from "../Geometry/Line.js";
+import { dataService } from "./DataService.js";
+export default class LineService {
+  constructor() {}
+
+  create(startPoint, endPoint, vectorId) {
+    let start = new Point(startPoint);
+    let end = new Point(endPoint);
+    let line = new Line(start.vectorId, end.vectorId, vectorId);
+    start.setPointParent(line.vectorId, "start");
+    end.setPointParent(line.vectorId, "end");
+    dataService.addPoint(start);
+    dataService.addPoint(end);
+    dataService.addLine(line);
+    return line;
+  }
+}
+
+const lineService = new LineService();
+export { lineService };

+ 16 - 16
src/graphic/Service/RoadService.js

@@ -71,8 +71,8 @@ export default class RoadService {
       //return null
     }
 
-    let leftEdge = dataService.getEdge(road.leftEdgeId);
-    let rightEdge = dataService.getEdge(road.rightEdgeId);
+    let leftEdge = dataService.getRoadEdge(road.leftEdgeId);
+    let rightEdge = dataService.getRoadEdge(road.rightEdgeId);
 
     let oldLeftEdgeStartPoint = {
       x: leftEdge.start.x,
@@ -126,10 +126,10 @@ export default class RoadService {
         newRoad.rightEdgeId
       );
 
-      let newRoadLeftEdge = dataService.getEdge(newRoad.leftEdgeId);
+      let newRoadLeftEdge = dataService.getRoadEdge(newRoad.leftEdgeId);
       mathUtil.clonePoint(newRoadLeftEdge.end, oldLeftEdgeEndPoint);
 
-      let newRoadRightEdge = dataService.getEdge(newRoad.rightEdgeId);
+      let newRoadRightEdge = dataService.getRoadEdge(newRoad.rightEdgeId);
       mathUtil.clonePoint(newRoadRightEdge.end, oldRightEdgeEndPoint);
 
       if (Object.keys(startPoint).length > 1) {
@@ -151,10 +151,10 @@ export default class RoadService {
         newRoad.rightEdgeId
       );
 
-      let newRoadLeftEdge = dataService.getEdge(newRoad.leftEdgeId);
+      let newRoadLeftEdge = dataService.getRoadEdge(newRoad.leftEdgeId);
       mathUtil.clonePoint(newRoadLeftEdge.start, oldLeftEdgeStartPoint);
 
-      let newRoadRightEdge = dataService.getEdge(newRoad.rightEdgeId);
+      let newRoadRightEdge = dataService.getRoadEdge(newRoad.rightEdgeId);
       mathUtil.clonePoint(newRoadRightEdge.start, oldRightEdgeStartPoint);
 
       if (Object.keys(endPoint).length > 1) {
@@ -835,8 +835,8 @@ export default class RoadService {
     const road = dataService.getRoad(roadId);
     const startPoint = dataService.getRoadPoint(road.startId);
     const endPoint = dataService.getRoadPoint(road.endId);
-    const leftEdge = dataService.getEdge(road.leftEdgeId);
-    const rightEdge = dataService.getEdge(road.rightEdgeId);
+    const leftEdge = dataService.getRoadEdge(road.leftEdgeId);
+    const rightEdge = dataService.getRoadEdge(road.rightEdgeId);
 
     //离中心最近的点才是中间带的起点和终点
     const mid = {
@@ -945,8 +945,8 @@ export default class RoadService {
     let road = dataService.getRoad(roadId);
     let startPoint = dataService.getRoadPoint(road.startId);
     let endPoint = dataService.getRoadPoint(road.endId);
-    let leftEdge = dataService.getEdge(road.leftEdgeId);
-    let rightEdge = dataService.getEdge(road.rightEdgeId);
+    let leftEdge = dataService.getRoadEdge(road.leftEdgeId);
+    let rightEdge = dataService.getRoadEdge(road.rightEdgeId);
     const leftCount = road.leftDrivewayCount;
     const rightCount = road.rightDrivewayCount;
 
@@ -1051,8 +1051,8 @@ export default class RoadService {
 
     let startPoint = dataService.getRoadPoint(road.startId);
     let endPoint = dataService.getRoadPoint(road.endId);
-    let leftEdge = dataService.getEdge(road.leftEdgeId);
-    let rightEdge = dataService.getEdge(road.rightEdgeId);
+    let leftEdge = dataService.getRoadEdge(road.leftEdgeId);
+    let rightEdge = dataService.getRoadEdge(road.rightEdgeId);
 
     if (dir == "left") {
       oldCount = road.leftDrivewayCount;
@@ -1131,8 +1131,8 @@ export default class RoadService {
     let road = dataService.getRoad(roadId);
     let startPoint = dataService.getRoadPoint(road.startId);
     let endPoint = dataService.getRoadPoint(road.endId);
-    let leftEdge = dataService.getEdge(road.leftEdgeId);
-    let rightEdge = dataService.getEdge(road.rightEdgeId);
+    let leftEdge = dataService.getRoadEdge(road.leftEdgeId);
+    let rightEdge = dataService.getRoadEdge(road.rightEdgeId);
     road.setWidth(newWidth, dir);
     let edgePoints = mathUtil.RectangleVertex(startPoint, endPoint, newWidth);
     if (dir == "left") {
@@ -1154,8 +1154,8 @@ export default class RoadService {
     let road = dataService.getRoad(roadId);
     let startPoint = dataService.getRoadPoint(road.startId);
     let endPoint = dataService.getRoadPoint(road.endId);
-    let leftEdge = dataService.getEdge(road.leftEdgeId);
-    let rightEdge = dataService.getEdge(road.rightEdgeId);
+    let leftEdge = dataService.getRoadEdge(road.leftEdgeId);
+    let rightEdge = dataService.getRoadEdge(road.rightEdgeId);
     let lanes = road.lanes;
 
     dataService.createLine(startPoint, endPoint);

+ 20 - 21
src/graphic/Style1.js

@@ -5,31 +5,30 @@ const Road = {
     strokeStyle: "rgba(255,0,0,0.5)",
     fillStyle: "rgba(255,0,0,0.8)",
   },
-}
+};
 
-const Edge = {
+const RoadEdge = {
   ...Road,
   lineWidth: 1,
   // globalAlpha: 0.3
-}
+};
 
 const Lane = {
-  ...Edge,
-  dash: [15, 15]
-}
+  ...RoadEdge,
+  dash: [15, 15],
+};
 
-const CurveRoad = { ...Road }
+const CurveRoad = { ...Road };
 
-const CurveEdge = {
+const CurveRoadEdge = {
   ...CurveRoad,
-  ...Edge
-}
+  ...RoadEdge,
+};
 
 const CurveLan = {
   ...Lane,
-  ...CurveEdge
-}
-
+  ...CurveRoadEdge,
+};
 
 const Tag = {
   strokeStyle: "rgb(255,255,255,1)",
@@ -37,7 +36,7 @@ const Tag = {
   strokeStyle_adding: "rgba(243, 255, 0, 0.8)",
   fillStyle_adding: "rgba(243, 255, 0, 0.8)",
   lineWidth: 1,
-}
+};
 
 const Font = {
   font: "14px Microsoft YaHei",
@@ -47,23 +46,23 @@ const Font = {
   textBaseline: "middle",
   miterLimit: 10,
   direction: "ltr",
-}
+};
 
 const Point = {
   strokeStyle: "green",
   fillStyle: "rgb(0, 200, 175)",
   radius: 4,
-}
+};
 
 const CurvePoint = {
-  ...Point
-}
+  ...Point,
+};
 
 const Style = {
   Road,
   CurveRoad,
-  Edge,
-  CurveEdge,
+  RoadEdge,
+  CurveRoadEdge,
   Lane,
   CurveLan,
   Point,
@@ -72,7 +71,7 @@ const Style = {
   Text: {
     ...Tag,
     ...Font,
-    font: "12px Microsoft YaHei"
+    font: "12px Microsoft YaHei",
   },
   Select: {
     Road: {

+ 1 - 0
src/graphic/enum/ElementEvents.js

@@ -1,6 +1,7 @@
 const ElementEvents = {
   AddingPoint: "AddingPoint",
   NewRoad: "NewRoad",
+  NewLine: "NewLine",
   NewMeasureLine: "NewMeasureLine",
   CheckLinesX: "CheckLinesX",
   CheckLinesY: "CheckLinesY",

+ 5 - 0
src/graphic/enum/LayerEvents.js

@@ -11,6 +11,11 @@ const LayerEvents = {
   MoveCurveRoad: "moveCurveRoad",
   MoveCurveRoadPoint: "moveCurveRoadPoint",
 
+  AddLine: "addLine",
+  AddingLine: "addingLine",
+  MoveLine: "moveLine",
+  MovePoint: "movePoint",
+
   MoveControlPoint: "moveControlPoint",
   MoveEdge: "moveEdge",
   MoveCurveEdge: "moveCurveEdge",

+ 7 - 5
src/graphic/enum/VectorType.js

@@ -1,18 +1,20 @@
 const VectorType = {
-  Point: "Point",
-  RoadPoint: "RoadPoint",
-  CurvePoint: "CurvePoint",
   ControlPoint: "ControlPoint",
   Circle: "Circle",
   Img: "Img",
+  Point: "Point",
   Line: "Line",
+  CurvePoint: "CurvePoint",
   CurveLine: "CurveLine",
   MeasureLine: "MeasureLine",
   MeasureArrow: "MeasureArrow",
-  Edge: "Edge",
   Road: "Road",
+  RoadEdge: "RoadEdge",
+  RoadPoint: "RoadPoint",
   CurveRoad: "CurveRoad",
-  CurveEdge: "CurveEdge",
+  CurveRoadEdge: "CurveRoadEdge",
+  CurveRoadPoint: "CurveRoadPoint",
+
   Tag: "Tag",
   BackgroundImg: "BackgroundImg",
 };