xushiting 2 年之前
父节点
当前提交
0b9be1dc2a

+ 7 - 9
src/graphic/CanvasStyle/default.js

@@ -57,7 +57,7 @@ const Point = {
 };
 
 const RoadPoint = {
-  ...Point
+  ...Point,
 };
 
 const CurveRoadPoint = {
@@ -82,26 +82,24 @@ const Measure = {
   lineWidth: 1,
 };
 
-const SimpleLine = {
+const NormalLine = {
   strokeStyle: "#CED806",
   lineWidth: 2,
   dash: [3, 2, 2],
-}
+};
 const GuideLine = {
   strokeStyle: "#CED806",
   lineWidth: 2,
   dash: [3, 2, 2],
-}
+};
 const MeasureLine = {
   strokeStyle: "#CED806",
   lineWidth: 2,
-}
+};
 const BaseLine = {
   strokeStyle: "#3290FF",
   lineWidth: 2,
-}
-
-
+};
 
 const Element = {
   AddingPoint: {
@@ -135,7 +133,7 @@ const Element = {
 };
 
 export default {
-  SimpleLine,
+  NormalLine,
   Road,
   CurveRoad,
   RoadEdge,

+ 3 - 3
src/graphic/Controls/AddLine.js

@@ -7,7 +7,7 @@ export default class AddLine {
   constructor() {
     this.startInfo = {};
     this.endInfo = {};
-    this.simpleLineCategory = VectorCategory.Line.NormalLine;
+    this.category = VectorCategory.Line.NormalLine;
   }
 
   setPointInfo(dir, pointInfo) {
@@ -52,10 +52,10 @@ export default class AddLine {
   }
 
   buildLine() {
-    lineService.createSimpleLine(
+    lineService.create(
       this.startInfo.position,
       this.endInfo.position,
-      this.simpleLineCategory
+      this.category
     );
     listenLayer.clear();
     this.clear();

+ 6 - 0
src/graphic/Geometry/Line.js

@@ -8,7 +8,13 @@ export default class Line extends Geometry {
     super();
     this.startId = startId;
     this.endId = endId;
+    this.category = null;
     this.geoType = VectorType.Line;
     this.setId(vectorId);
   }
+
+  //NormalLine,GuideLine,MeasureLine,BaseLine
+  setCategory(value) {
+    this.category = value;
+  }
 }

+ 0 - 28
src/graphic/Geometry/SimpleLine.js

@@ -1,28 +0,0 @@
-import VectorType from "../enum/VectorType.js";
-import Geometry from "./Geometry.js";
-
-//与Line不同的是start和end是二维坐标。Line的start和end表示point的Id
-export default class SimpleLine extends Geometry {
-  constructor(start, end, vectorId) {
-    super();
-    this.start = {};
-    this.end = {};
-    this.category = null;
-    this.geoType = VectorType.SimpleLine;
-    this.setId(vectorId);
-    this.setPositions(start, end);
-  }
-
-  //NormalLine,GuideLine,MeasureLine,BaseLine
-  setCategory(value) {
-    this.category = value;
-  }
-
-  setPositions(point1, point2) {
-    this.start.x = point1.x;
-    this.start.y = point1.y;
-
-    this.end.x = point2.x;
-    this.end.y = point2.y;
-  }
-}

+ 0 - 47
src/graphic/History/Change.js

@@ -20,9 +20,6 @@ export default class Change {
     this.lastData.lines = JSON.parse(JSON.stringify(dataService.getLines()));
     this.lastData.texts = JSON.parse(JSON.stringify(dataService.getTexts()));
     this.lastData.points = JSON.parse(JSON.stringify(dataService.getPoints()));
-    this.lastData.simpleLines = JSON.parse(
-      JSON.stringify(dataService.getSimpleLines())
-    );
     this.lastData.circles = JSON.parse(JSON.stringify(dataService.getPoints()));
   }
 
@@ -32,14 +29,12 @@ export default class Change {
     // this.compareRoads();
     this.comparePoints();
     this.compareLines();
-    this.compareSimpleLines();
     this.compareCircles();
     this.compareTexts();
 
     if (
       this.currentData.points.length == 0 &&
       this.currentData.lines.length == 0 &&
-      this.currentData.simpleLines.length == 0 &&
       this.currentData.circles.length == 0 &&
       this.currentData.texts.length == 0
     ) {
@@ -207,48 +202,6 @@ export default class Change {
       this.currentData.lines.push(item);
     }
   }
-  compareSimpleLines() {
-    const simpleLines = dataService.getSimpleLines();
-    this.currentData.simpleLines = [];
-
-    for (const key in simpleLines) {
-      const simpleLine = simpleLines[key];
-      // 不存在意味着增加
-      if (!this.lastData.simpleLines[key]) {
-        const item = {
-          handle: HistoryEvents.AddSimpleLine,
-          simpleLine: historyUtil.getDataForSimpleLine(simpleLine),
-        };
-        this.currentData.simpleLines.push(item);
-      } else {
-        const lastSimpleLine = this.lastData.simpleLines[key];
-        if (
-          !historyUtil.isDifferentForSimpleLines(simpleLine, lastSimpleLine)
-        ) {
-          delete this.lastData.simpleLines[key];
-          continue;
-        } else {
-          const item = {
-            handle: HistoryEvents.ModifysSmpleLine,
-            preSimpleLine: historyUtil.getDataForSimpleLine(lastSimpleLine),
-            curSimpleLine: historyUtil.getDataForSimpleLine(simpleLine),
-          };
-          this.currentData.simpleLines.push(item);
-        }
-      }
-      delete this.lastData.simpleLines[key];
-    }
-
-    for (const key in this.lastData.simpleLines) {
-      const item = {
-        handle: HistoryEvents.DeleteSimpleLine,
-        simpleLine: historyUtil.getDataForSimpleLine(
-          this.lastData.simpleLines[key]
-        ),
-      };
-      this.currentData.simpleLines.push(item);
-    }
-  }
 
   compareCircles() {
     const circles = dataService.getCircles();

+ 2 - 62
src/graphic/History/History.js

@@ -94,7 +94,6 @@ export default class History {
       item.type = "pre";
       this.goPreForPoints(item.points);
       this.goPreForLines(item.lines);
-      this.goPreForSimpleLines(item.simpleLines);
       this.goPreForCircles(item.circles);
       this.goPreForTexts(item.texts);
 
@@ -129,7 +128,7 @@ export default class History {
         dataService.deleteLine(item.line.id);
       } else if (item.handle == HistoryEvents.DeleteLine) {
         const preLine = item.line;
-        let newLine = lineService.createLine(
+        let newLine = lineService.create(
           preLine.start,
           preLine.end,
           preLine.id
@@ -143,36 +142,6 @@ export default class History {
     }
   }
 
-  goPreForSimpleLines(itemForSimpleLines) {
-    for (let i = 0; i < itemForSimpleLines.length; ++i) {
-      const item = itemForSimpleLines[i];
-      if (item.handle == HistoryEvents.AddSimpleLine) {
-        dataService.deleteSimpleLine(item.simpleLine.id);
-      } else if (item.handle == HistoryEvents.DeleteSimpleLine) {
-        const preSimpleLine = item.simpleLine;
-        let newSimpleLine = lineService.createSimpleLine(
-          preSimpleLine.start,
-          preSimpleLine.end,
-          preSimpleLine.category,
-          preSimpleLine.id
-        );
-        historyUtil.assignSimpleLineFromSimpleLine(
-          newSimpleLine,
-          preSimpleLine
-        );
-      } else if (item.handle == HistoryEvents.ModifySimpleLine) {
-        const preSimpleLine = item.preSimpleLine;
-        let currentSimpleLine = dataService.getSimpleLine(
-          item.curSimpleLine.id
-        );
-        historyUtil.assignSimpleLineFromSimpleLine(
-          currentSimpleLine,
-          preSimpleLine
-        );
-      }
-    }
-  }
-
   goPreForCircles(itemForCircles) {
     for (let i = 0; i < itemForCircles.length; ++i) {
       const item = itemForCircles[i];
@@ -232,7 +201,7 @@ export default class History {
       const item = itemForLines[i];
       if (item.handle == HistoryEvents.AddLine) {
         const preLine = item.line;
-        let newLine = lineService.createLine(
+        let newLine = lineService.create(
           preLine.start,
           preLine.end,
           preLine.id
@@ -248,34 +217,6 @@ export default class History {
     }
   }
 
-  goNextForSimpleLines(itemForSimpleLines) {
-    for (let i = 0; i < itemForSimpleLines.length; ++i) {
-      const item = itemForSimpleLines[i];
-      if (item.handle == HistoryEvents.AddSimpleLine) {
-        const preSimpleLine = item.simpleLine;
-        let newSimpleLine = lineService.createSimpleLine(
-          preSimpleLine.start,
-          preSimpleLine.end,
-          preSimpleLine.category,
-          preSimpleLine.id
-        );
-        historyUtil.assignSimpleLineFromSimpleLine(
-          newSimpleLine,
-          preSimpleLine
-        );
-      } else if (item.handle == HistoryEvents.DeleteSimpleLine) {
-        dataService.deleteSimpleLine(item.simpleLine.id);
-      } else if (item.handle == HistoryEvents.ModifySimpleLine) {
-        const currentSimpleLine = item.curSimpleLine;
-        let preSimpleLine = dataService.getSimpleLine(item.preSimpleLine.id);
-        historyUtil.assignSimpleLineFromSimpleLine(
-          preSimpleLine,
-          currentSimpleLine
-        );
-      }
-    }
-  }
-
   goNextForCircles(itemForCircles) {
     for (let i = 0; i < itemForCircles.length; ++i) {
       const item = itemForCircles[i];
@@ -322,7 +263,6 @@ export default class History {
 
       this.goNextForPoints(item.points);
       this.goNextForLines(item.lines);
-      this.goNextForSimpleLines(item.simpleLines);
       this.goNextForCircles(item.circles);
       this.goNextForTexts(item.texts);
       change.saveCurrentInfo();

+ 11 - 42
src/graphic/History/HistoryUtil.js

@@ -26,17 +26,10 @@ export default class HistoryUtil {
   }
 
   isDifferentForLines(line1, line2) {
-    if (line1.startId == line2.startId && line1.endId == line2.endId) {
-      return false;
-    } else {
-      return true;
-    }
-  }
-
-  isDifferentForSimpleLines(simpleLine1, simpleLine2) {
     if (
-      mathUtil.equalPoint(simpleLine1.start, simpleLine2.start) &&
-      mathUtil.equalPoint(simpleLine1.end, simpleLine2.end)
+      line1.startId == line2.startId &&
+      line1.endId == line2.endId &&
+      line1.category == line2.category
     ) {
       return false;
     } else {
@@ -88,23 +81,16 @@ export default class HistoryUtil {
     lineInfo.vectorId = line1.vectorId;
     lineInfo.start = line2.startId;
     lineInfo.end = line2.endId;
+    lineInfo.category = line2.category;
     this.setLineInfo(lineInfo);
   }
 
-  assignSimpleLineFromSimpleLine(simpleLine1, simpleLine2) {
-    const simpleLineInfo = {};
-    simpleLineInfo.vectorId = simpleLine1.vectorId;
-    simpleLineInfo.start = simpleLine2.start;
-    simpleLineInfo.end = simpleLine2.end;
-    this.setSimpleLineInfo(simpleLineInfo);
-  }
-
-  assignLineFromLine(line1, line2) {
-    const lineInfo = {};
-    lineInfo.vectorId = line1.vectorId;
-    lineInfo.start = line2.startId;
-    lineInfo.end = line2.endId;
-    this.setLineInfo(lineInfo);
+  assignCircleFromCircle(circle1, circle2) {
+    const circleInfo = {};
+    circleInfo.vectorId = circle1.vectorId;
+    circleInfo.center = circle2.center;
+    circleInfo.radius = circle2.radius;
+    this.setCircleInfo(circleInfo);
   }
 
   assignTextFromText(text1, text2) {
@@ -135,17 +121,6 @@ export default class HistoryUtil {
     return data;
   }
 
-  getDataForSimpleLine(simpleLine) {
-    const data = {};
-    data.id = simpleLine.vectorId;
-    data.start = {};
-    mathUtil.clonePoint(data.start, simpleLine.start);
-    data.end = {};
-    mathUtil.clonePoint(data.end, simpleLine.end);
-    data.type = simpleLine.geoType;
-    return data;
-  }
-
   getDataForCircle(circle) {
     const data = {};
     data.id = circle.vectorId;
@@ -185,16 +160,10 @@ export default class HistoryUtil {
     let line = dataService.getLine(lineInfo.vectorId);
     line.startId = lineInfo.start;
     line.endId = lineInfo.end;
+    line.category = lineInfo.category;
     return line;
   }
 
-  setSimpleLineInfo(simpleLineInfo) {
-    let simpleLine = dataService.getSimpleLine(simpleLineInfo.vectorId);
-    simpleLine.start = simpleLineInfo.start;
-    simpleLine.end = simpleLineInfo.end;
-    return simpleLine;
-  }
-
   setCircleInfo(circleInfo) {
     let circle = dataService.getCircle(circleInfo.vectorId);
     circle.center = circleInfo.center;

+ 0 - 142
src/graphic/ListenLayer.js

@@ -65,10 +65,6 @@ export default class ListenLayer {
     //   position,
     //   exceptVectorIds.exceptCurveLineId
     // );
-    selectInfo.simpleLineInfo = this.isSelectSimpleLine(
-      position,
-      exceptVectorIds.exceptSimpleLineId
-    );
     selectInfo.curveLineInfo = {};
     selectInfo.curvePointInfo = {};
     //交叉口拐弯处的控制点
@@ -672,121 +668,6 @@ export default class ListenLayer {
     return crossControlPointInfo;
   }
 
-  isSelectSimpleLine(position, exceptSimpleLineId) {
-    let simpleLineInfo = {
-      simpleLineId: null,
-      type: null,
-      distance: null,
-    };
-    let seqInfo = {};
-    const simpleLines = dataService.getSimpleLines();
-    for (const simpleLineId in simpleLines) {
-      if (simpleLineId == exceptSimpleLineId) {
-        continue;
-      }
-      const simpleLine = dataService.getSimpleLine(simpleLineId);
-      let distance = mathUtil.getDistance(position, simpleLine.start);
-      //先考虑两个端点
-      if (distance < Constant.minAdsorbPix) {
-        if (
-          simpleLineInfo.simpleLineId == null ||
-          distance < simpleLineInfo.distance
-        ) {
-          simpleLineInfo = {
-            simpleLineId: simpleLineId,
-            type: VectorType.SimpleLine,
-            distance: distance,
-            index: "start",
-          };
-          simpleLineInfo.x = simpleLine.start.x;
-          simpleLineInfo.y = simpleLine.start.y;
-        }
-      } else {
-        distance = mathUtil.getDistance(position, simpleLine.end);
-        if (distance < Constant.minAdsorbPix) {
-          if (
-            simpleLineInfo.simpleLineId == null ||
-            distance < simpleLineInfo.distance
-          ) {
-            simpleLineInfo = {
-              simpleLineId: simpleLineId,
-              type: VectorType.SimpleLine,
-              distance: distance,
-              index: "end",
-            };
-            simpleLineInfo.x = simpleLine.end.x;
-            simpleLineInfo.y = simpleLine.end.y;
-          }
-        }
-      }
-
-      //记录平行和垂直
-      if (Math.abs(position.x - simpleLine.start.x) < Constant.minAdsorbPix) {
-        seqInfo.linkedPointIdX = simpleLineId + "-startX";
-        seqInfo.x = simpleLine.start.x;
-      } else if (
-        Math.abs(position.y - simpleLine.start.y) < Constant.minAdsorbPix
-      ) {
-        seqInfo.linkedPointIdY = simpleLineId + "-startY";
-        seqInfo.y = simpleLine.start.y;
-      } else if (
-        Math.abs(position.x - simpleLine.end.x) < Constant.minAdsorbPix
-      ) {
-        seqInfo.linkedPointIdX = simpleLineId + "-endX";
-        seqInfo.x = simpleLine.end.x;
-      } else if (
-        Math.abs(position.y - simpleLine.end.y) < Constant.minAdsorbPix
-      ) {
-        seqInfo.linkedPointIdY = simpleLineId + "-endY";
-        seqInfo.y = simpleLine.end.y;
-      }
-
-      //再考虑整个线段
-      if (simpleLineInfo.simpleLineId == null) {
-        const line = mathUtil.createLine1(simpleLine.start, simpleLine.end);
-        const join = mathUtil.getJoinLinePoint(position, line);
-        const distance = mathUtil.getDistance(position, join);
-        if (
-          !mathUtil.isContainForSegment(join, simpleLine.start, simpleLine.end)
-        ) {
-          continue;
-        } else if (distance < Constant.minAdsorbPix / 2) {
-          simpleLineInfo = {
-            simpleLineId: simpleLineId,
-            type: VectorType.SimpleLine,
-            distance: distance,
-          };
-          simpleLineInfo.x = join.x;
-          simpleLineInfo.y = join.y;
-        }
-      }
-
-      //最后考虑端点的单个x或者y
-      if (simpleLineInfo.simpleLineId == null) {
-        if (seqInfo.hasOwnProperty("linkedPointIdX")) {
-          simpleLineInfo.linkedPointIdX = seqInfo.linkedPointIdX;
-          simpleLineInfo.x = seqInfo.x;
-        } else if (seqInfo.hasOwnProperty("linkedPointIdY")) {
-          simpleLineInfo.linkedPointIdY = seqInfo.linkedPointIdY;
-          simpleLineInfo.y = seqInfo.y;
-        }
-        if (
-          simpleLineInfo.hasOwnProperty("y") &&
-          !simpleLineInfo.hasOwnProperty("x")
-        ) {
-          simpleLineInfo.x = position.x;
-        }
-        if (
-          simpleLineInfo.hasOwnProperty("x") &&
-          !simpleLineInfo.hasOwnProperty("y")
-        ) {
-          simpleLineInfo.y = position.y;
-        }
-      }
-    }
-    return simpleLineInfo;
-  }
-
   /**
     * 
     * @param info:{ 
@@ -937,13 +818,6 @@ export default class ListenLayer {
         this.modifyPoint.x = info.curveLineInfo.x;
         this.modifyPoint.y = info.curveLineInfo.y;
       }
-    } else if (info && info.simpleLineInfo.simpleLineId) {
-      this.modifyPoint.simpleLineId = info.simpleLineInfo.simpleLineId;
-      this.modifyPoint.x = info.simpleLineInfo.x;
-      this.modifyPoint.y = info.simpleLineInfo.y;
-      if (info.simpleLineInfo.index) {
-        this.modifyPoint.index = info.simpleLineInfo.index;
-      }
     } else if (info && info.roadPointInfo.linkedRoadPointIdX) {
       this.modifyPoint = {};
       this.modifyPoint.linkedRoadPointIdX =
@@ -978,16 +852,6 @@ export default class ListenLayer {
       this.modifyPoint.linkedPointIdY = info.pointInfo.linkedPointIdY;
       this.modifyPoint.y = info.pointInfo.y;
       this.modifyPoint.x = info.pointInfo.x;
-    } else if (info && info.simpleLineInfo.linkedPointIdX) {
-      this.modifyPoint = {};
-      this.modifyPoint.linkedPointIdX = info.simpleLineInfo.linkedPointIdX;
-      this.modifyPoint.x = info.simpleLineInfo.x;
-      this.modifyPoint.y = info.simpleLineInfo.y;
-    } else if (info && info.simpleLineInfo.linkedPointIdY) {
-      this.modifyPoint = {};
-      this.modifyPoint.linkedPointIdY = info.simpleLineInfo.linkedPointIdY;
-      this.modifyPoint.y = info.simpleLineInfo.y;
-      this.modifyPoint.x = info.simpleLineInfo.x;
     } else {
       this.modifyPoint = null;
     }
@@ -1068,12 +932,6 @@ export default class ListenLayer {
         VectorType.CurveLine,
         SelectState.Select
       );
-    } else if (this.modifyPoint.simpleLineId) {
-      stateService.setSelectItem(
-        this.modifyPoint.simpleLineId,
-        VectorType.SimpleLine,
-        this.modifyPoint.index ? this.modifyPoint.index : SelectState.Select
-      );
     }
 
     let newSelectItem = stateService.getSelectItem();

+ 1 - 1
src/graphic/Renderer/Render.js

@@ -52,7 +52,7 @@ export default class Render {
       case VectorType.RoadPoint:
         draw.drawCircle(vector);
         break;
-      case VectorType.SimpleLine:
+      case VectorType.Line:
         draw.drawLine(vector); //需要修改,有几种情况:测量,校准,基准
         break;
       case VectorType.Road:

+ 0 - 1
src/graphic/Service/CircleService.js

@@ -1,6 +1,5 @@
 import Point from "../Geometry/Point.js";
 import Circle from "../Geometry/Circle.js";
-import SimpleLine from "../Geometry/SimpleLine.js";
 import { dataService } from "./DataService.js";
 import VectorCategory from "../enum/VectorCategory.js";
 import { mathUtil } from "../Util/MathUtil.js";

+ 0 - 18
src/graphic/Service/DataService.js

@@ -46,8 +46,6 @@ export class DataService {
     this.vectorData.controlPoints = {};
     //直线,起点和终点都是point的id
     this.vectorData.lines = {};
-    //简单线段,起点和终点都是坐标
-    this.vectorData.simpleLines = {};
     //弯曲线条
     this.vectorData.curvelines = {};
     //线段(完全或者直线)上的端点
@@ -120,22 +118,6 @@ export class DataService {
     delete this.vectorData.lines[lineId];
   }
 
-  getSimpleLines() {
-    return this.vectorData.simpleLines;
-  }
-
-  getSimpleLine(simpleLineId) {
-    return this.vectorData.simpleLines[simpleLineId];
-  }
-
-  addSimpleLine(simpleLine) {
-    this.vectorData.simpleLines[simpleLine.vectorId] = simpleLine;
-  }
-
-  deleteSimpleLine(simpleLineId) {
-    delete this.vectorData.simpleLines[simpleLineId];
-  }
-
   //直线的端点
   getPoints() {
     return this.vectorData.points;

+ 40 - 14
src/graphic/Service/ElementService.js

@@ -1,4 +1,5 @@
 import Point from "../Geometry/Point.js";
+import Line from "../Geometry/Line.js";
 import Road from "../Geometry/Road.js";
 import RoadEdge from "../Geometry/RoadEdge.js";
 import ElementEvents from "../enum/ElementEvents.js";
@@ -8,20 +9,30 @@ import Constant from "../Constant";
 import { dataService } from "./DataService.js";
 import { mathUtil } from "../Util/MathUtil";
 import { coordinate } from "../Coordinate.js";
-import SimpleLine from "../Geometry/SimpleLine.js";
 
 export class ElementService {
   constructor() {
     this.point = null;
 
     this.newLine = null;
+    this.newLineStart = null;
+    this.newLineEnd = null;
+
     this.newRoad = null;
 
+    this.checkLinesXStart = null;
+    this.checkLinesXEnd = null;
+    this.checkLinesYStart = null;
+    this.checkLinesYEnd = null;
     this.checkLines = {
       X: null,
       Y: null,
     };
 
+    this.vCheckLinesXStart = null;
+    this.vCheckLinesXEnd = null;
+    this.vCheckLinesYStart = null;
+    this.vCheckLinesYEnd = null;
     this.vCheckLines = {
       X: null,
       Y: null,
@@ -30,29 +41,39 @@ export class ElementService {
   }
 
   init() {
-    this.point = new Point(0, 0);
+    this.point = new Point({ x: 0, y: 0 });
     this.point.name = ElementEvents.AddingPoint;
 
     this.newRoad = this.createTempRoad();
     this.newRoad.name = ElementEvents.NewRoad;
 
-    this.newLine = new SimpleLine({ x: 0, y: 0 }, { x: 1, y: 1 });
+    this.newLineStart = new Point({ x: 0, y: 0 });
+    this.newLineEnd = new Point({ x: 1, y: 1 });
+    this.newLine = new Line(this.newLineStart, this.newLineEnd);
     this.newLine.setCategory(VectorCategory.Line.NormalLine);
     this.newLine.name = ElementEvents.NewLine;
 
-    this.checkLines.X = new SimpleLine({ x: 0, y: 0 }, { x: 1, y: 1 });
+    this.checkLinesXStart = new Point({ x: 0, y: 0 });
+    this.checkLinesXEnd = new Point({ x: 1, y: 1 });
+    this.checkLines.X = new Line(this.checkLinesXStart, this.checkLinesXEnd);
     this.newLine.setCategory(VectorCategory.Line.GuideLine);
     this.checkLines.X.name = ElementEvents.CheckLinesX;
 
-    this.checkLines.Y = new SimpleLine({ x: 0, y: 0 }, { x: 1, y: 1 });
+    this.checkLinesYStart = new Point({ x: 0, y: 0 });
+    this.checkLinesYEnd = new Point({ x: 1, y: 1 });
+    this.checkLines.Y = new Line(this.checkLinesYStart, this.checkLinesYEnd);
     this.newLine.setCategory(VectorCategory.Line.GuideLine);
     this.checkLines.Y.name = ElementEvents.CheckLinesY;
 
-    this.vCheckLines.X = new SimpleLine({ x: 0, y: 0 }, { x: 1, y: 1 });
+    this.vCheckLinesXStart = new Point({ x: 0, y: 0 });
+    this.vCheckLinesXEnd = new Point({ x: 1, y: 1 });
+    this.vCheckLines.X = new Line(this.vCheckLinesXStart, this.vCheckLinesXEnd);
     this.newLine.setCategory(VectorCategory.Line.GuideLine);
     this.vCheckLines.X.name = ElementEvents.VCheckLinesX;
 
-    this.vCheckLines.Y = new SimpleLine({ x: 0, y: 0 }, { x: 1, y: 1 });
+    this.vCheckLinesYStart = new Point({ x: 0, y: 0 });
+    this.vCheckLinesYEnd = new Point({ x: 1, y: 1 });
+    this.vCheckLines.Y = new Line(this.vCheckLinesYStart, this.vCheckLinesYEnd);
     this.newLine.setCategory(VectorCategory.Line.GuideLine);
     this.vCheckLines.Y.name = ElementEvents.VCheckLinesY;
 
@@ -75,8 +96,8 @@ export class ElementService {
         p1,
         p2,
         this.newRoad.leftWidth +
-        this.newRoad.rightWidth +
-        this.newRoad.midDivide.midDivideWidth
+          this.newRoad.rightWidth +
+          this.newRoad.midDivide.midDivideWidth
       );
     }
     let leftEdge = new RoadEdge(
@@ -150,7 +171,8 @@ export class ElementService {
   }
 
   setNewLine(point1, point2) {
-    this.newLine.setPositions(point1, point2);
+    this.newLineStart.setPositions(point1);
+    this.newLineEnd.setPositions(point2);
   }
 
   showNewLine() {
@@ -174,7 +196,8 @@ export class ElementService {
   }
 
   setCheckLinesX(point1, point2) {
-    this.checkLines.X.setPositions(point1, point2);
+    this.checkLinesXStart.setPositions(point1);
+    this.checkLinesXEnd.setPositions(point2);
   }
 
   showCheckLinesY() {
@@ -186,7 +209,8 @@ export class ElementService {
   }
 
   setCheckLinesY(point1, point2) {
-    this.checkLines.Y.setPositions(point1, point2);
+    this.checkLinesYStart.setPositions(point1);
+    this.checkLinesYEnd.setPositions(point2);
   }
 
   showVCheckLinesX() {
@@ -198,7 +222,8 @@ export class ElementService {
   }
 
   setVCheckLinesX(point1, point2) {
-    this.vCheckLines.X.setPositions(point1, point2);
+    this.vCheckLinesXStart.setPositions(point1);
+    this.vCheckLinesXEnd.setPositions(point2);
   }
 
   showVCheckLinesY() {
@@ -210,7 +235,8 @@ export class ElementService {
   }
 
   setVCheckLinesY(point1, point2) {
-    this.vCheckLines.Y.setPositions(point1, point2);
+    this.vCheckLinesYStart.setPositions(point1);
+    this.vCheckLinesYEnd.setPositions(point2);
   }
 
   hideAll() {

+ 1 - 12
src/graphic/Service/LineService.js

@@ -1,13 +1,12 @@
 import Point from "../Geometry/Point.js";
 import Line from "../Geometry/Line.js";
-import SimpleLine from "../Geometry/SimpleLine.js";
 import { dataService } from "./DataService.js";
 import VectorCategory from "../enum/VectorCategory.js";
 import { mathUtil } from "../Util/MathUtil.js";
 export default class LineService {
   constructor() {}
 
-  createLine(startPoint, endPoint) {
+  create(startPoint, endPoint) {
     if (!startPoint || !endPoint || mathUtil.equalPoint(startPoint, endPoint)) {
       return null;
     }
@@ -21,16 +20,6 @@ export default class LineService {
     dataService.addLine(line);
     return line;
   }
-
-  createSimpleLine(startPoint, endPoint, category, vectorId) {
-    if (!startPoint || !endPoint || mathUtil.equalPoint(startPoint, endPoint)) {
-      return null;
-    }
-    let simpleLineline = new SimpleLine(startPoint, endPoint, vectorId);
-    simpleLineline.setCategory(category);
-    dataService.addSimpleLine(simpleLineline);
-    return simpleLineline;
-  }
 }
 
 const lineService = new LineService();

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

@@ -6,6 +6,7 @@ import { edgeService } from "./EdgeService.js";
 import { mathUtil } from "../Util/MathUtil.js";
 import Constant from "../Constant";
 import { controlPointService } from "./ControlPointService.js";
+import { lineService } from "./LineService.js";
 export default class RoadService {
   constructor() {}
 
@@ -1384,22 +1385,22 @@ export default class RoadService {
     this.setLanes(roadId, dir);
   }
 
-  unlock(roadId) {
-    let road = dataService.getRoad(roadId);
-    let startPoint = dataService.getRoadPoint(road.startId);
-    let endPoint = dataService.getRoadPoint(road.endId);
-    let leftEdge = dataService.getRoadEdge(road.leftEdgeId);
-    let rightEdge = dataService.getRoadEdge(road.rightEdgeId);
-    let lanes = road.lanes;
-
-    dataService.createLine(startPoint, endPoint);
-    dataService.createLine(leftEdge.start, leftEdge.end);
-    dataService.createLine(rightEdge.start, rightEdge.end);
-    for (let i = 0; i < lanes.length; ++i) {
-      dataService.createLine(lanes[i].start, lanes[i].end);
-    }
-    dataService.deleteRoad(roadId);
-  }
+  // unlock(roadId) {
+  //   let road = dataService.getRoad(roadId);
+  //   let startPoint = dataService.getRoadPoint(road.startId);
+  //   let endPoint = dataService.getRoadPoint(road.endId);
+  //   let leftEdge = dataService.getRoadEdge(road.leftEdgeId);
+  //   let rightEdge = dataService.getRoadEdge(road.rightEdgeId);
+  //   let lanes = road.lanes;
+
+  //   lineService.createLine(startPoint, endPoint);
+  //   lineService.createLine(leftEdge.start, leftEdge.end);
+  //   lineService.createLine(rightEdge.start, rightEdge.end);
+  //   for (let i = 0; i < lanes.length; ++i) {
+  //     lineService.createLine(lanes[i].start, lanes[i].end);
+  //   }
+  //   dataService.deleteRoad(roadId);
+  // }
   /****************************************************************************************************************************************************************/
 }
 

+ 0 - 4
src/graphic/enum/HistoryEvents.js

@@ -19,10 +19,6 @@ const HistoryEvents = {
   DeleteLine: "deleteLine",
   ModifyLine: "modifyLine",
 
-  AddSimpleLine: "addSimpleLine",
-  DeleteSimpleLine: "deleteSimpleLine",
-  ModifySimpleLine: "modifySimpleLine",
-
   AddCircle: "addCircle",
   DeleteCirclee: "deleteCircle",
   ModifyCircle: "modifyCircle",