Browse Source

Merge branch 'master' of http://192.168.0.115:3000/bill/traffic-laser

xzw 2 years ago
parent
commit
b1dbc549f4

File diff suppressed because it is too large
+ 1 - 1
server/test/SS-t-P1d6CwREny2/attach/sceneStore


+ 1 - 1
src/graphic/Constant.js

@@ -24,7 +24,7 @@ const Constant = {
   // miniMap_Width: 1200,
   // miniMap_Height: 1200,
   minLen: 0.2, //挨着,比如:点是否在线段上
-  minAdsorbPix: 20, //最小吸附像素
+  minAdsorbPix: 50, //最小吸附像素
   minRealDis: 20,
   defaultRoadWidth: 100, //默认公路宽度
   ratio: 1,

+ 1 - 0
src/graphic/Geometry/CurveLine.js

@@ -9,6 +9,7 @@ export default class CurveLine extends Geometry {
     this.startId = startId;
     this.endId = endId;
     this.points = null;
+    this.curves = null;
     this.geoType = VectorType.CurveLine;
     this.setId(vectorId);
   }

+ 0 - 8
src/graphic/Geometry/CurvePoint.js

@@ -13,14 +13,6 @@ export default class CurvePoint extends Geometry {
     this.setPosition(position);
   }
 
-  getIndex() {
-    return this.index;
-  }
-
-  setIndex(index) {
-    this.index = index;
-  }
-
   setPointParent(parentId) {
     this.parent = parentId;
   }

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

@@ -13,14 +13,6 @@ export default class CurveRoadPoint extends Geometry {
     this.setPosition(position);
   }
 
-  getIndex() {
-    return this.index;
-  }
-
-  setIndex(index) {
-    this.index = index;
-  }
-
   setPointParent(parentId) {
     this.parent = parentId;
   }

+ 16 - 0
src/graphic/Geometry/Geometry.js

@@ -16,6 +16,22 @@ export default class Geometry {
     }
   }
 
+  getIndex() {
+    return this.index;
+  }
+
+  setIndex(index) {
+    this.index = index;
+  }
+
+  getPoints() {
+    return this.points;
+  }
+
+  setPoints(points) {
+    this.points = JSON.parse(JSON.stringify(points));
+  }
+
   setPointParent(parentId, dir) {
     if (this.parent == null) {
       this.parent = {};

+ 133 - 77
src/graphic/History/Change.js

@@ -20,6 +20,14 @@ 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.curveLines = JSON.parse(
+      JSON.stringify(dataService.getCurveLines())
+    );
+    this.lastData.curvePoints = JSON.parse(
+      JSON.stringify(dataService.getCurvePoints())
+    );
+
     this.lastData.circles = JSON.parse(
       JSON.stringify(dataService.getCircles())
     );
@@ -54,6 +62,8 @@ export default class Change {
     // this.compareRoads();
     this.comparePoints();
     this.compareLines();
+    this.compareCurvePoints();
+    this.compareCurveLines();
     this.compareCircles();
     this.compareTexts();
     this.compareMagnifiers();
@@ -68,6 +78,8 @@ export default class Change {
     if (
       this.currentData.points.length == 0 &&
       this.currentData.lines.length == 0 &&
+      this.currentData.curvePoints.length == 0 &&
+      this.currentData.curveLines.length == 0 &&
       this.currentData.circles.length == 0 &&
       this.currentData.texts.length == 0 &&
       this.currentData.magnifiers.length == 0 &&
@@ -126,44 +138,127 @@ export default class Change {
     }
   }
 
-  // compareRoads() {
-  //   this.currentData.roads = [];
-  //   const roads = dataService.getRoads();
-  //   for (const key in roads) {
-  //     const road = roads[key];
-  //     const lastRoad = this.lastData.roads[key];
-
-  //     // 不存在意味着增加
-  //     if (!lastRoad) {
-  //       const item = {
-  //         handle: HistoryEvents.AddRoad,
-  //         road: historyUtil.getDataForRoad(road),
-  //       };
-  //       this.currentData.roads.push(item);
-  //     } else {
-  //       if (!historyUtil.isDifferentForRoads(road, lastRoad)) {
-  //         delete this.lastData.roads[key];
-  //         continue;
-  //       } else {
-  //         const item = {
-  //           handle: HistoryEvents.ModifyRoad,
-  //           preRoad: historyUtil.getDataForRoad(lastRoad),
-  //           curRoad: historyUtil.getDataForRoad(road),
-  //         };
-  //         this.currentData.roads.push(item);
-  //       }
-  //     }
-  //     delete this.lastData.roads[key];
-  //   }
-
-  //   for (const key in this.lastData.roads) {
-  //     const item = {
-  //       handle: HistoryEvents.DeleteRoad,
-  //       road: historyUtil.getDataForRoad(this.lastData.roads[key]),
-  //     };
-  //     this.currentData.roads.push(item);
-  //   }
-  // }
+  compareLines() {
+    const lines = dataService.getLines();
+    this.currentData.lines = [];
+
+    for (const key in lines) {
+      const line = lines[key];
+      // 不存在意味着增加
+      if (!this.lastData.lines[key]) {
+        const item = {
+          handle: HistoryEvents.AddLine,
+          line: historyUtil.getDataForLine(line),
+        };
+        this.currentData.lines.push(item);
+      } else {
+        const lastLine = this.lastData.lines[key];
+        if (!historyUtil.isDifferentForLines(line, lastLine)) {
+          delete this.lastData.lines[key];
+          continue;
+        } else {
+          const item = {
+            handle: HistoryEvents.ModifyLine,
+            preLine: historyUtil.getDataForLine(lastLine),
+            curLine: historyUtil.getDataForLine(line),
+          };
+          this.currentData.lines.push(item);
+        }
+      }
+      delete this.lastData.lines[key];
+    }
+
+    for (const key in this.lastData.lines) {
+      const item = {
+        handle: HistoryEvents.DeleteLine,
+        line: historyUtil.getDataForLine(this.lastData.lines[key]),
+      };
+      this.currentData.lines.push(item);
+    }
+  }
+
+  compareCurvePoints() {
+    const curvePoints = dataService.getCurvePoints();
+    this.currentData.curvePoints = [];
+
+    for (const key in curvePoints) {
+      const curvePoint = curvePoints[key];
+      // 不存在意味着增加
+      if (!this.lastData.curvePoints[key]) {
+        const item = {
+          handle: HistoryEvents.AddCurvePoint,
+          curvePoint: historyUtil.getDataForCurvePoint(curvePoint),
+        };
+        this.currentData.curvePoints.push(item);
+      } else {
+        const lastCurvePoint = this.lastData.curvePoints[key];
+        if (
+          !historyUtil.isDifferentForCurvePoints(curvePoint, lastCurvePoint)
+        ) {
+          delete this.lastData.curvePoints[key];
+          continue;
+        } else {
+          const item = {
+            handle: HistoryEvents.ModifyCurvePoint,
+            preCurvePoint: historyUtil.getDataForCurvePoint(lastCurvePoint),
+            curCurvePoint: historyUtil.getDataForCurvePoint(curvePoint),
+          };
+          this.currentData.curvePoints.push(item);
+        }
+      }
+      delete this.lastData.curvePoints[key];
+    }
+
+    for (const key in this.lastData.curvePoints) {
+      const item = {
+        handle: HistoryEvents.DeleteCurvePoint,
+        curvePoint: historyUtil.getDataForCurvePoint(
+          this.lastData.curvePoints[key]
+        ),
+      };
+      this.currentData.curvePoints.push(item);
+    }
+  }
+  compareCurveLines() {
+    const curveLines = dataService.getCurveLines();
+    this.currentData.curveLines = [];
+
+    for (const key in curveLines) {
+      const curveLine = curveLines[key];
+      // 不存在意味着增加
+      if (!this.lastData.curveLines[key]) {
+        const item = {
+          handle: HistoryEvents.AddCurveLine,
+          curveLine: historyUtil.getDataForCurveLine(curveLine),
+        };
+        this.currentData.curveLines.push(item);
+      } else {
+        const lastCurveLine = this.lastData.curveLines[key];
+        if (!historyUtil.isDifferentForCurveLines(curveLine, lastCurveLine)) {
+          delete this.lastData.curveLines[key];
+          continue;
+        } else {
+          const item = {
+            handle: HistoryEvents.ModifyCurveLine,
+            preCurveLine: historyUtil.getDataForCurveLine(lastCurveLine),
+            curCurveLine: historyUtil.getDataForCurveLine(curveLine),
+          };
+          this.currentData.curveLines.push(item);
+        }
+      }
+      delete this.lastData.curveLines[key];
+    }
+
+    for (const key in this.lastData.curveLines) {
+      const item = {
+        handle: HistoryEvents.DeleteCurveLine,
+        curveLine: historyUtil.getDataForCurveLine(
+          this.lastData.curveLines[key]
+        ),
+      };
+      this.currentData.curveLines.push(item);
+    }
+  }
 
   compareTexts() {
     this.currentData.texts = [];
@@ -205,45 +300,6 @@ export default class Change {
     }
   }
 
-  compareLines() {
-    const lines = dataService.getLines();
-    this.currentData.lines = [];
-
-    for (const key in lines) {
-      const line = lines[key];
-      // 不存在意味着增加
-      if (!this.lastData.lines[key]) {
-        const item = {
-          handle: HistoryEvents.AddLine,
-          line: historyUtil.getDataForLine(line),
-        };
-        this.currentData.lines.push(item);
-      } else {
-        const lastLine = this.lastData.lines[key];
-        if (!historyUtil.isDifferentForLines(line, lastLine)) {
-          delete this.lastData.lines[key];
-          continue;
-        } else {
-          const item = {
-            handle: HistoryEvents.ModifyLine,
-            preLine: historyUtil.getDataForLine(lastLine),
-            curLine: historyUtil.getDataForLine(line),
-          };
-          this.currentData.lines.push(item);
-        }
-      }
-      delete this.lastData.lines[key];
-    }
-
-    for (const key in this.lastData.lines) {
-      const item = {
-        handle: HistoryEvents.DeleteLine,
-        line: historyUtil.getDataForLine(this.lastData.lines[key]),
-      };
-      this.currentData.lines.push(item);
-    }
-  }
-
   compareCircles() {
     const circles = dataService.getCircles();
     this.currentData.circles = [];

+ 102 - 0
src/graphic/History/History.js

@@ -17,6 +17,7 @@ import { crossPointService } from "../Service/CrossPointService";
 import { curveRoadPointService } from "../Service/CurveRoadPointService";
 import { curveEdgeService } from "../Service/CurveEdgeService";
 import { curveRoadService } from "../Service/CurveRoadService";
+import { curvePointService } from "../Service/CurvePointService";
 
 export default class History {
   constructor(layer) {
@@ -100,6 +101,8 @@ export default class History {
       item.type = "pre";
       this.goPreForPoints(item.points);
       this.goPreForLines(item.lines);
+      this.goPreForCurvePoints(item.curvePoints);
+      this.goPreForCurveLines(item.curveLines);
       this.goPreForCircles(item.circles);
       this.goPreForTexts(item.texts);
       this.goPreForMagnifiers(item.magnifiers);
@@ -158,6 +161,56 @@ export default class History {
     }
   }
 
+  goPreForCurvePoints(itemForCurvePoints) {
+    for (let i = 0; i < itemForCurvePoints.length; ++i) {
+      const item = itemForCurvePoints[i];
+      if (item.handle == HistoryEvents.AddCurvePoint) {
+        dataService.deleteCurvePoint(item.curvePoint.id);
+      } else if (item.handle == HistoryEvents.DeleteCurvePoint) {
+        let curvePoint = curvePointService.create(
+          item.curvePoint,
+          item.curvePoint.id
+        );
+        curvePoint.setPoints(item.points);
+        curvePoint.setIndex(item.index);
+        curvePoint.parent = item.curvePoint.parent;
+      } else if (item.handle == HistoryEvents.ModifyCurvePoint) {
+        const preCurvePoint = item.preCurvePoint;
+        let currentCurvePoint = dataService.getCurvePoint(
+          item.curCurvePoint.id
+        );
+        historyUtil.assignCurvePointFromCurvePoint(
+          currentCurvePoint,
+          preCurvePoint
+        );
+      }
+    }
+  }
+
+  goPreForCurveLines(itemForCurveLines) {
+    for (let i = 0; i < itemForCurveLines.length; ++i) {
+      const item = itemForCurveLines[i];
+      if (item.handle == HistoryEvents.AddCurveLine) {
+        dataService.deleteCurveLine(item.curveLine.id);
+      } else if (item.handle == HistoryEvents.DeleteCurveLine) {
+        const preCurveLine = item.curveLine;
+        let newCurveLine = lineService.createCurveLine(
+          preCurveLine.start,
+          preCurveLine.end,
+          preCurveLine.id
+        );
+        historyUtil.assignCurveLineFromCurveLine(newCurveLine, preCurveLine);
+      } else if (item.handle == HistoryEvents.ModifyCurveLine) {
+        const preCurveLine = item.preCurveLine;
+        let currentCurveLine = dataService.getCurveLine(item.curCurveLine.id);
+        historyUtil.assignCurveLineFromCurveLine(
+          currentCurveLine,
+          preCurveLine
+        );
+      }
+    }
+  }
+
   goPreForCircles(itemForCircles) {
     for (let i = 0; i < itemForCircles.length; ++i) {
       const item = itemForCircles[i];
@@ -441,6 +494,53 @@ export default class History {
     }
   }
 
+  goNextForCurvePoints(itemForCurvePoints) {
+    for (let i = 0; i < itemForCurvePoints.length; ++i) {
+      const item = itemForCurvePoints[i];
+      if (item.handle == HistoryEvents.AddCurvePoint) {
+        let newCurvePoint = curvePointService.create(
+          item.curvePoint,
+          item.curvePoint.id
+        );
+        historyUtil.assignCurvePointFromCurvePoint(
+          newCurvePoint,
+          item.curvePoint
+        );
+      } else if (item.handle == HistoryEvents.DeleteCurvePoint) {
+        dataService.deleteCurvePoint(item.curvePoint.id);
+      } else if (item.handle == HistoryEvents.ModifyCurvePoint) {
+        const currentCurvePoint = item.curCurvePoint;
+        let preCurvePoint = dataService.getCurvePoint(item.curCurvePoint.id);
+        historyUtil.assignCurvePointFromCurvePoint(
+          preCurvePoint,
+          currentCurvePoint
+        );
+      }
+    }
+  }
+
+  goNextForCurveLines(itemForCurveLines) {
+    for (let i = 0; i < itemForCurveLines.length; ++i) {
+      const item = itemForCurveLines[i];
+      if (item.handle == HistoryEvents.AddLine) {
+        const preLine = item.line;
+        let newLine = lineService.createByPointId(
+          preLine.start,
+          preLine.end,
+          preLine.category,
+          preLine.id
+        );
+        historyUtil.assignLineFromLine(newLine, preLine);
+      } else if (item.handle == HistoryEvents.DeleteLine) {
+        dataService.deleteLine(item.line.id);
+      } else if (item.handle == HistoryEvents.ModifyLine) {
+        const currentLine = item.curLine;
+        let preLine = dataService.getLine(item.preLine.id);
+        historyUtil.assignLineFromLine(preLine, currentLine);
+      }
+    }
+  }
+
   goNextForCircles(itemForCircles) {
     for (let i = 0; i < itemForCircles.length; ++i) {
       const item = itemForCircles[i];
@@ -692,6 +792,8 @@ export default class History {
 
       this.goNextForPoints(item.points);
       this.goNextForLines(item.lines);
+      this.goNextForCurvePoints(item.curvePoints);
+      this.goNextForCurveLines(item.curveLines);
       this.goNextForCircles(item.circles);
       this.goNextForTexts(item.texts);
       this.goNextForMagnifiers(item.magnifiers);

+ 81 - 0
src/graphic/History/HistoryUtil.js

@@ -34,6 +34,31 @@ export default class HistoryUtil {
     }
   }
 
+  isDifferentForCurvePoints(curvePoint1, curvePoint2) {
+    if (
+      curvePoint1.x == curvePoint2.x &&
+      curvePoint1.y == curvePoint2.y &&
+      curvePoint1.parent == curvePoint2.parent &&
+      curvePoint1.index == curvePoint2.index
+    ) {
+      return false;
+    } else {
+      return true;
+    }
+  }
+
+  isDifferentForCurveLines(curveLine1, curveLine2) {
+    if (
+      curveLine1.startId == curveLine2.startId &&
+      curveLine1.endId == curveLine2.endId &&
+      mathUtil.equalJSON(curveLine1.points, curveLine2.points)
+    ) {
+      return false;
+    } else {
+      return true;
+    }
+  }
+
   isDifferentForCircles(circle1, circle2) {
     if (
       mathUtil.equalPoint(circle1.center, circle2.center) &&
@@ -241,6 +266,25 @@ export default class HistoryUtil {
     this.setLineInfo(lineInfo);
   }
 
+  assignCurvePointFromCurvePoint(curvePoint1, curvePoint2) {
+    const curvePointInfo = {};
+    curvePointInfo.vectorId = curvePoint1.vectorId;
+    curvePointInfo.position = { x: curvePoint2.x, y: curvePoint2.y };
+    curvePointInfo.parent = curvePoint2.parent;
+    curvePointInfo.index = curvePoint2.index;
+    this.setCurvePointInfo(curvePointInfo);
+  }
+
+  assignCurveLineFromCurveLine(curveLine1, curveLine2) {
+    const curveLineInfo = {};
+    curveLineInfo.vectorId = curveLine1.vectorId;
+    curveLineInfo.start = curveLine2.start;
+    curveLineInfo.end = curveLine2.end;
+    curveLineInfo.points = JSON.parse(JSON.stringify(curveLine2.points));
+    curveLineInfo.curves = JSON.parse(JSON.stringify(curveLine2.curves));
+    this.setCurveLineInfo(curveLineInfo);
+  }
+
   assignCircleFromCircle(circle1, circle2) {
     const circleInfo = {};
     circleInfo.vectorId = circle1.vectorId;
@@ -444,6 +488,26 @@ export default class HistoryUtil {
     return data;
   }
 
+  getDataForCurvePoint(curvePoint) {
+    const data = {};
+    data.id = curvePoint.vectorId;
+    mathUtil.clonePoint(data, curvePoint);
+    data.parent = curvePoint.parent;
+    data.index = curvePoint.index;
+    data.type = curvePoint.geoType;
+    return data;
+  }
+
+  getDataForCurveLine(curveLine) {
+    const data = {};
+    data.id = curveLine.vectorId;
+    data.start = curveLine.startId;
+    data.end = curveLine.endId;
+    data.points = JSON.parse(JSON.stringify(curveLine.points));
+    data.type = curveLine.geoType;
+    return data;
+  }
+
   getDataForCircle(circle) {
     const data = {};
     data.id = circle.vectorId;
@@ -627,6 +691,23 @@ export default class HistoryUtil {
     return line;
   }
 
+  setCurvePointInfo(curvePointInfo) {
+    let curvePoint = dataService.getCurvePoint(curvePointInfo.vectorId);
+    mathUtil.clonePoint(curvePoint, curvePointInfo.position);
+    curvePoint.parent = curvePointInfo.parent;
+    curvePoint.index = curvePointInfo.index;
+    return curvePoint;
+  }
+
+  setCurveLineInfo(curveLineInfo) {
+    let curveLine = dataService.getCurveLine(curveLineInfo.vectorId);
+    curveLine.startId = curveLineInfo.start;
+    curveLine.endId = curveLineInfo.end;
+    curveLine.points = JSON.parse(JSON.stringify(curveLineInfo.points));
+    curveLine.curves = JSON.parse(JSON.stringify(curveLineInfo.curves));
+    return curveLine;
+  }
+
   setCircleInfo(circleInfo) {
     let circle = dataService.getCircle(circleInfo.vectorId);
     circle.center = circleInfo.center;

+ 18 - 2
src/graphic/Layer.js

@@ -252,16 +252,30 @@ export default class Layer {
     };
     const eventName = stateService.getEventName();
     if (
+      !this.dragging &&
+      Math.abs(X - this.startX) < minDragDis &&
+      Math.abs(Y - this.startY) < minDragDis
+    ) {
+      return;
+    }
+    this.dragging = true;
+    if (
       Math.abs(X - this.startX) > minDragDis ||
       Math.abs(Y - this.startY) > minDragDis
     ) {
       // 是否拖拽了
-      this.dragging = true;
       if (eventName != null) {
         stateService.clearFocusItem();
         this.uiControl.focusVector = null;
       }
     }
+
+    console.log(
+      "onMouseMove--->offsetX:" +
+        Math.abs(X - this.startX) +
+        "offsetY:" +
+        Math.abs(Y - this.startY)
+    );
     // 是否需要重绘
     let needAutoRedraw = false;
     let point = null;
@@ -692,6 +706,7 @@ export default class Layer {
   onMouseUp(e) {
     // 右键
     if (e.button == 2) {
+      this.dragging = false;
       return;
     }
     let X = e.offsetX || e.layerX;
@@ -704,6 +719,7 @@ export default class Layer {
       this.StorePage2 = null;
       this.StoreMidePage = null;
       if (e.touches.length > 1) {
+        this.dragging = false;
         return;
       }
     }
@@ -725,7 +741,7 @@ export default class Layer {
     } else {
       this.uiControl.focusVector = null;
     }
-
+    this.dragging = false;
     let position = coordinate.getXYFromScreen({
       x: X,
       y: Y,

+ 27 - 14
src/graphic/ListenLayer.js

@@ -109,7 +109,7 @@ export default class ListenLayer {
         continue;
       }
       const curvePoint = dataService.getCurvePoint(curvePointId);
-      const distance = mathUtil.getDistance(position, curvePoint);
+      const distance = this.getDistance(position, curvePoint);
       if (distance < Constant.minAdsorbPix) {
         if (curvePointInfo.curvePointId == null) {
           curvePointInfo = {
@@ -189,7 +189,7 @@ export default class ListenLayer {
       let endPoint = dataService.getCurvePoint(curveLine.endId);
       const comLine = mathUtil.createLine1(startPoint, endPoint);
       const join = mathUtil.getJoinLinePoint(position, comLine);
-      const distance = mathUtil.getDistance(position, join);
+      const distance = this.getDistance(position, join);
       if (!mathUtil.isContainForSegment(join, startPoint, endPoint)) {
         continue;
       }
@@ -232,7 +232,7 @@ export default class ListenLayer {
       if (point.getCategory() == VectorCategory.Point.TestBasePoint) {
         continue;
       }
-      const distance = mathUtil.getDistance(position, point);
+      const distance = this.getDistance(position, point);
       if (distance < Constant.minAdsorbPix) {
         if (pointInfo.pointId == null) {
           pointInfo = {
@@ -307,7 +307,7 @@ export default class ListenLayer {
       let endPoint = dataService.getPoint(line.endId);
       const comLine = mathUtil.createLine1(startPoint, endPoint);
       const join = mathUtil.getJoinLinePoint(position, comLine);
-      const distance = mathUtil.getDistance(position, join);
+      const distance = this.getDistance(position, join);
       if (!mathUtil.isContainForSegment(join, startPoint, endPoint)) {
         continue;
       }
@@ -347,7 +347,7 @@ export default class ListenLayer {
       }
       const circle = dataService.getCircle(circleId);
       for (let i = 0; i < circle.points.length; ++i) {
-        distance = mathUtil.getDistance(position, circle.points[i]);
+        distance = this.getDistance(position, circle.points[i]);
         if (distance < Constant.minAdsorbPix) {
           circleInfo = {
             circleId: circleId,
@@ -360,7 +360,7 @@ export default class ListenLayer {
           return circleInfo;
         }
       }
-      distance = mathUtil.getDistance(position, circle.center);
+      distance = this.getDistance(position, circle.center);
       if (distance < circle.radius) {
         if (circleInfo.circleId == null || distance < circleInfo.distance) {
           circleInfo = {
@@ -508,7 +508,7 @@ export default class ListenLayer {
         continue;
       }
       const roadPoint = dataService.getRoadPoint(roadPointId);
-      const distance = mathUtil.getDistance(position, roadPoint);
+      const distance = this.getDistance(position, roadPoint);
       if (distance < Constant.minAdsorbPix) {
         if (roadPointInfo.roadPointId == null) {
           roadPointInfo = {
@@ -583,7 +583,7 @@ export default class ListenLayer {
         continue;
       }
       const curveRoadPoint = dataService.getCurveRoadPoint(curveRoadPointId);
-      const distance = mathUtil.getDistance(position, curveRoadPoint);
+      const distance = this.getDistance(position, curveRoadPoint);
       if (distance < Constant.minAdsorbPix) {
         if (curveRoadPointInfo.curveRoadPointId == null) {
           curveRoadPointInfo = {
@@ -671,7 +671,7 @@ export default class ListenLayer {
       const rightEdge = dataService.getRoadEdge(road.rightEdgeId);
       const roadLine = roadService.getMidLine(road);
       let join = mathUtil.getJoinLinePoint(position, roadLine);
-      let distance = mathUtil.getDistance(position, join);
+      let distance = this.getDistance(position, join);
       if (
         mathUtil.isContainForSegment(join, startPoint, endPoint) &&
         distance < Constant.minAdsorbPix
@@ -688,7 +688,7 @@ export default class ListenLayer {
       //检查edge
       let leftLine = mathUtil.createLine1(leftEdge.start, leftEdge.end);
       join = mathUtil.getJoinLinePoint(position, leftLine);
-      distance = mathUtil.getDistance(position, join);
+      distance = this.getDistance(position, join);
       if (
         mathUtil.isContainForSegment(join, leftEdge.start, leftEdge.end) &&
         distance < Constant.minAdsorbPix
@@ -705,7 +705,7 @@ export default class ListenLayer {
 
       let rightLine = mathUtil.createLine1(rightEdge.start, rightEdge.end);
       join = mathUtil.getJoinLinePoint(position, rightLine);
-      distance = mathUtil.getDistance(position, join);
+      distance = this.getDistance(position, join);
       if (
         mathUtil.isContainForSegment(join, rightEdge.start, rightEdge.end) &&
         distance < Constant.minAdsorbPix
@@ -862,7 +862,7 @@ export default class ListenLayer {
         continue;
       }
       const crossPoint = dataService.getCrossPoint2(crossPointId);
-      const distance = mathUtil.getDistance(position, crossPoint.extremePoint);
+      const distance = this.getDistance(position, crossPoint.extremePoint);
       if (distance < Constant.minAdsorbPix) {
         crossCrossPointInfo = {
           crossCrossPointId: crossPointId,
@@ -889,7 +889,13 @@ export default class ListenLayer {
         continue;
       }
       const text = dataService.getText(textId);
-      const distance = mathUtil.getDistance(position, text.center);
+      const distance = this.getDistance(position, text.center);
+      console.log(
+        "isSelectText-distance:" +
+          distance +
+          ",minAdsorbPix:" +
+          Constant.minAdsorbPix
+      );
       if (distance < Constant.minAdsorbPix) {
         textInfo = {
           textId: textId,
@@ -916,7 +922,7 @@ export default class ListenLayer {
         continue;
       }
       const magnifier = dataService.getMagnifier(magnifierId);
-      const distance = mathUtil.getDistance(position, magnifier.position);
+      const distance = this.getDistance(position, magnifier.position);
       if (distance < Constant.minAdsorbPix) {
         magnifierInfo = {
           magnifierId: magnifierId,
@@ -1278,6 +1284,13 @@ export default class ListenLayer {
     return flag;
   }
 
+  getDistance(start, end) {
+    return (
+      (mathUtil.getDistance(start, end) * coordinate.zoom) /
+      coordinate.defaultZoom
+    );
+  }
+
   clear() {
     this.modifyPoint = null;
   }

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

@@ -117,7 +117,7 @@ export default class LineService {
     curveLine.points.push(startPoint);
     curveLine.points.push(midPoint);
     curveLine.points.push(endPoint);
-
+    curveLine.curves = mathUtil.getCurvesByPoints(curveLine.points);
     dataService.addCurveLine(curveLine);
     return curveLine;
   }

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

@@ -23,6 +23,14 @@ const HistoryEvents = {
   DeleteLine: "deleteLine",
   ModifyLine: "modifyLine",
 
+  AddCurvePoint: "addCurvePoint",
+  DeleteCurvePoint: "deleteCurvePoint",
+  ModifyCurvePoint: "modifyCurvePoint",
+
+  AddCurveLine: "addCurveLine",
+  DeleteCurveLine: "deleteCurveLine",
+  ModifyCurveLine: "modifyCurveLine",
+
   AddCircle: "addCircle",
   DeleteCircle: "deleteCircle",
   ModifyCircle: "modifyCircle",