xushiting 2 дней назад
Родитель
Сommit
1555e4b184
4 измененных файлов с 448 добавлено и 149 удалено
  1. 8 0
      src/graphic/Controls/MoveSVG.js
  2. 17 0
      src/graphic/Geometry/SVG.js
  3. 2 0
      src/graphic/Layer.js
  4. 421 149
      src/graphic/ListenLayer.js

+ 8 - 0
src/graphic/Controls/MoveSVG.js

@@ -37,6 +37,14 @@ export default class MoveSVG {
   //   const side2 = mathUtil.getDistance(position, svg.center);
   //   svg.scale = (side2 / side1) * scale;
   // }
+  moveRotateSVG(position, svgId) {
+    let svg = dataService.getSVG(svgId);
+    const angle = mathUtil.Angle(svg.center, svg.controlAnglePoint, position);
+    for (let i = 0; i < svg.points.length; ++i) {
+      svg.points[i] = svg.rotatePoint(svg.points[i], svg.center, angle);
+    }
+    svg.setControlAnglePoint();
+  }
 
   movePoint(newPos, svgId, pointIndex) {
     let svg = dataService.getSVG(svgId);

+ 17 - 0
src/graphic/Geometry/SVG.js

@@ -20,6 +20,7 @@ export default class SVG extends Geometry {
     this.scaleLength = this.getScale();
     this.scaleWidth = this.getScale();
     this.setBoundingVertexs();
+    this.controlAnglePoint = this.setControlAnglePoint();
     this.setId(vectorId);
     this.checkCategory(type);
   }
@@ -113,6 +114,22 @@ export default class SVG extends Geometry {
     this.points = points;
   }
 
+  setControlAnglePoint() {
+    const len =
+      mathUtil.getDistance(this.points[0], this.points[2]) / 2 +
+      20 * coordinate.ratio;
+
+    const v = {
+      x: Math.cos(this.angle + Math.PI / 2),
+      y: Math.sin(this.angle + Math.PI / 2),
+    };
+    const p = {
+      x: this.center.x + v.x * len,
+      y: this.center.y + v.y * len,
+    };
+    return p;
+  }
+
   // setLengthScale(scale1) {
   //   this.scaleLength = scale1;
   // }

+ 2 - 0
src/graphic/Layer.js

@@ -1047,6 +1047,8 @@ export default class Layer {
         if (draggingItem != null) {
           if (draggingItem.state == -1) {
             moveSVG.moveFullSVG(position, draggingItem.vectorId);
+          } else if (draggingItem.state == 100) {
+            moveSVG.moveRotateSVG(position, draggingItem.vectorId);
           } else {
             draggingItem.state = moveSVG.movePoint(
               position,

+ 421 - 149
src/graphic/ListenLayer.js

@@ -64,18 +64,37 @@ export default class ListenLayer {
     }
     this.clear();
     if (!vType || vType == VectorType.CurveRoad) {
-      selectInfo.curveRoadEdgeInfo = this.isSelectCurveRoad(position, exceptVectorIds.exceptCurveRoadId); //包括edge
-      selectInfo.curveRoadPointInfo = this.isSelectCurveRoadPoint(position, exceptVectorIds.exceptCurveRoadPointId);
+      selectInfo.curveRoadEdgeInfo = this.isSelectCurveRoad(
+        position,
+        exceptVectorIds.exceptCurveRoadId
+      ); //包括edge
+      selectInfo.curveRoadPointInfo = this.isSelectCurveRoadPoint(
+        position,
+        exceptVectorIds.exceptCurveRoadPointId
+      );
     }
 
     if (!vType || vType == VectorType.Road) {
-      selectInfo.roadEdgeInfo = this.isSelectRoad(position, exceptVectorIds.exceptRoadIds); //包括edge
-      selectInfo.roadPointInfo = this.isSelectRoadPoint(position, exceptVectorIds.exceptRoadPointId);
+      selectInfo.roadEdgeInfo = this.isSelectRoad(
+        position,
+        exceptVectorIds.exceptRoadIds
+      ); //包括edge
+      selectInfo.roadPointInfo = this.isSelectRoadPoint(
+        position,
+        exceptVectorIds.exceptRoadPointId
+      );
     }
 
     if (!vType || vType == VectorType.Line) {
-      selectInfo.lineInfo = this.isSelectLine(position, exceptVectorIds.exceptLineIds);
-      selectInfo.pointInfo = this.isSelectPoint(position, exceptVectorIds.exceptPointId, exceptVectorIds.exceptLineIds);
+      selectInfo.lineInfo = this.isSelectLine(
+        position,
+        exceptVectorIds.exceptLineIds
+      );
+      selectInfo.pointInfo = this.isSelectPoint(
+        position,
+        exceptVectorIds.exceptPointId,
+        exceptVectorIds.exceptLineIds
+      );
     }
     // selectInfo.pointInfo = this.isSelectPoint(
     //   position,
@@ -83,23 +102,44 @@ export default class ListenLayer {
     // );
 
     if (!vType || vType == VectorType.CurveLine) {
-      selectInfo.curvePointInfo = this.isSelectCurvePoint(position, exceptVectorIds.exceptCurvePointId);
-      selectInfo.curveLineInfo = this.isSelectCurveLine(position, exceptVectorIds.exceptCurveLineId);
+      selectInfo.curvePointInfo = this.isSelectCurvePoint(
+        position,
+        exceptVectorIds.exceptCurvePointId
+      );
+      selectInfo.curveLineInfo = this.isSelectCurveLine(
+        position,
+        exceptVectorIds.exceptCurveLineId
+      );
     }
 
     //if (!vType || vType == VectorType.Circle) {
-    selectInfo.circleInfo = this.isSelectCircle(position, exceptVectorIds.exceptCircleId);
+    selectInfo.circleInfo = this.isSelectCircle(
+      position,
+      exceptVectorIds.exceptCircleId
+    );
     //}
 
     //if (!vType) {
     //交叉口拐弯处的控制点
-    selectInfo.crossPointInfo = this.isSelectCrossCrossPoint(position, exceptVectorIds.exceptCrossCrossPointId);
-    selectInfo.textInfo = this.isSelectText(position, exceptVectorIds.exceptTextId);
-    selectInfo.magnifierInfo = this.isSelectMagnifier(position, exceptVectorIds.exceptMagnifierId);
+    selectInfo.crossPointInfo = this.isSelectCrossCrossPoint(
+      position,
+      exceptVectorIds.exceptCrossCrossPointId
+    );
+    selectInfo.textInfo = this.isSelectText(
+      position,
+      exceptVectorIds.exceptTextId
+    );
+    selectInfo.magnifierInfo = this.isSelectMagnifier(
+      position,
+      exceptVectorIds.exceptMagnifierId
+    );
     //
 
     if (!vType || vType == VectorType.SVG) {
-      selectInfo.svgInfo = this.isSelectSVG(position, exceptVectorIds.exceptSVGId);
+      selectInfo.svgInfo = this.isSelectSVG(
+        position,
+        exceptVectorIds.exceptSVGId
+      );
     }
 
     this.setModifyPoint(position, selectInfo);
@@ -139,11 +179,19 @@ export default class ListenLayer {
           }
         }
       } else {
-        if ((Math.abs(position.x - curvePoint.x) * coordinate.zoom) / coordinate.defaultZoom < Constant.minAdsorbPix) {
+        if (
+          (Math.abs(position.x - curvePoint.x) * coordinate.zoom) /
+            coordinate.defaultZoom <
+          Constant.minAdsorbPix
+        ) {
           seqInfo.linkedCurvePointIdX = curvePointId;
           seqInfo.x = curvePoint.x;
         }
-        if ((Math.abs(position.y - curvePoint.y) * coordinate.zoom) / coordinate.defaultZoom < Constant.minAdsorbPix) {
+        if (
+          (Math.abs(position.y - curvePoint.y) * coordinate.zoom) /
+            coordinate.defaultZoom <
+          Constant.minAdsorbPix
+        ) {
           seqInfo.linkedPointIdY = curvePointId;
           seqInfo.y = curvePoint.y;
         }
@@ -152,7 +200,9 @@ export default class ListenLayer {
 
     if (curvePointInfo.curvePointId) {
       curvePointInfo.linkedCurvePointId = curvePointInfo.curvePointId;
-      const linkedCurvePoint = dataService.getCurvePoint(curvePointInfo.curvePointId);
+      const linkedCurvePoint = dataService.getCurvePoint(
+        curvePointInfo.curvePointId
+      );
       curvePointInfo.x = linkedCurvePoint.x;
       curvePointInfo.y = linkedCurvePoint.y;
     } else {
@@ -164,10 +214,16 @@ export default class ListenLayer {
         curvePointInfo.linkedCurvePointIdY = seqInfo.linkedCurvePointIdY;
         curvePointInfo.y = seqInfo.y;
       }
-      if (curvePointInfo.hasOwnProperty("y") && !curvePointInfo.hasOwnProperty("x")) {
+      if (
+        curvePointInfo.hasOwnProperty("y") &&
+        !curvePointInfo.hasOwnProperty("x")
+      ) {
         curvePointInfo.x = position.x;
       }
-      if (curvePointInfo.hasOwnProperty("x") && !curvePointInfo.hasOwnProperty("y")) {
+      if (
+        curvePointInfo.hasOwnProperty("x") &&
+        !curvePointInfo.hasOwnProperty("y")
+      ) {
         curvePointInfo.y = position.y;
       }
     }
@@ -182,12 +238,20 @@ export default class ListenLayer {
     };
     const curveLines = dataService.getCurveLines();
     for (const curveLineId in curveLines) {
-      if (exceptCurveLineIds && (exceptCurveLineIds.hasOwnProperty(curveLineId) || exceptCurveLineIds == curveLineId)) {
+      if (
+        exceptCurveLineIds &&
+        (exceptCurveLineIds.hasOwnProperty(curveLineId) ||
+          exceptCurveLineIds == curveLineId)
+      ) {
         continue;
       }
       const curveLine = dataService.getCurveLine(curveLineId);
 
-      let joinInfo = this.distanceForBezier(position, curveLine.curves, Constant.minAdsorbPix);
+      let joinInfo = this.distanceForBezier(
+        position,
+        curveLine.curves,
+        Constant.minAdsorbPix
+      );
       //选中了路
       if (joinInfo.distance < Constant.minAdsorbPix) {
         curveLineInfo = {
@@ -251,11 +315,19 @@ export default class ListenLayer {
           }
         }
       } else {
-        if ((Math.abs(position.x - point.x) * coordinate.zoom) / coordinate.defaultZoom < Constant.minAdsorbPix) {
+        if (
+          (Math.abs(position.x - point.x) * coordinate.zoom) /
+            coordinate.defaultZoom <
+          Constant.minAdsorbPix
+        ) {
           seqInfo.linkedPointIdX = pointId;
           seqInfo.x = point.x;
         }
-        if ((Math.abs(position.y - point.y) * coordinate.zoom) / coordinate.defaultZoom < Constant.minAdsorbPix) {
+        if (
+          (Math.abs(position.y - point.y) * coordinate.zoom) /
+            coordinate.defaultZoom <
+          Constant.minAdsorbPix
+        ) {
           seqInfo.linkedPointIdY = pointId;
           seqInfo.y = point.y;
         }
@@ -308,7 +380,8 @@ export default class ListenLayer {
         line.getCategory() == VectorCategory.Line.ExtendedPositionLine ||
         line.getCategory() == VectorCategory.Line.GuideLocationLine ||
         line.getCategory() == VectorCategory.Line.GuidePositionLine ||
-        (line.getCategory() == VectorCategory.Line.PositionLine && line.getLocationMode() != Constant.angleLocationMode)
+        (line.getCategory() == VectorCategory.Line.PositionLine &&
+          line.getLocationMode() != Constant.angleLocationMode)
       ) {
         continue;
       }
@@ -386,7 +459,12 @@ export default class ListenLayer {
       //     };
       //   }
       // }
-      const flag = mathUtil.isPointInElliptic(position, circle.center, circle.radiusX, circle.radiusY);
+      const flag = mathUtil.isPointInElliptic(
+        position,
+        circle.center,
+        circle.radiusX,
+        circle.radiusY
+      );
       if (flag) {
         circleInfo = {
           circleId: circleId,
@@ -433,10 +511,18 @@ export default class ListenLayer {
           }
         }
       } else {
-        if ((Math.abs(position.x - roadPoint.x) * coordinate.zoom) / coordinate.defaultZoom < Constant.minAdsorbPix) {
+        if (
+          (Math.abs(position.x - roadPoint.x) * coordinate.zoom) /
+            coordinate.defaultZoom <
+          Constant.minAdsorbPix
+        ) {
           seqInfo.linkedRoadPointIdX = roadPointId;
           seqInfo.x = roadPoint.x;
-        } else if ((Math.abs(position.y - roadPoint.y) * coordinate.zoom) / coordinate.defaultZoom < Constant.minAdsorbPix) {
+        } else if (
+          (Math.abs(position.y - roadPoint.y) * coordinate.zoom) /
+            coordinate.defaultZoom <
+          Constant.minAdsorbPix
+        ) {
           seqInfo.linkedRoadPointIdY = roadPointId;
           seqInfo.y = roadPoint.y;
         }
@@ -459,10 +545,16 @@ export default class ListenLayer {
         roadPointInfo.y = seqInfo.y;
       }
 
-      if (roadPointInfo.hasOwnProperty("y") && !roadPointInfo.hasOwnProperty("x")) {
+      if (
+        roadPointInfo.hasOwnProperty("y") &&
+        !roadPointInfo.hasOwnProperty("x")
+      ) {
         roadPointInfo.x = position.x;
       }
-      if (roadPointInfo.hasOwnProperty("x") && !roadPointInfo.hasOwnProperty("y")) {
+      if (
+        roadPointInfo.hasOwnProperty("x") &&
+        !roadPointInfo.hasOwnProperty("y")
+      ) {
         roadPointInfo.y = position.y;
       }
     }
@@ -502,10 +594,18 @@ export default class ListenLayer {
           }
         }
       } else {
-        if ((Math.abs(position.x - curveRoadPoint.x) * coordinate.zoom) / coordinate.defaultZoom < Constant.minAdsorbPix) {
+        if (
+          (Math.abs(position.x - curveRoadPoint.x) * coordinate.zoom) /
+            coordinate.defaultZoom <
+          Constant.minAdsorbPix
+        ) {
           seqInfo.linkedCurveRoadPointIdX = curveRoadPointId;
           seqInfo.x = curveRoadPoint.x;
-        } else if ((Math.abs(position.y - curveRoadPoint.y) * coordinate.zoom) / coordinate.defaultZoom < Constant.minAdsorbPix) {
+        } else if (
+          (Math.abs(position.y - curveRoadPoint.y) * coordinate.zoom) /
+            coordinate.defaultZoom <
+          Constant.minAdsorbPix
+        ) {
           seqInfo.linkedCurveRoadPointIdY = curveRoadPointId;
           seqInfo.y = curveRoadPoint.y;
         }
@@ -513,22 +613,33 @@ export default class ListenLayer {
     }
 
     if (curveRoadPointInfo.curveRoadPointId) {
-      curveRoadPointInfo.linkedCurveRoadPointId = curveRoadPointInfo.curveRoadPointId;
-      const linkedCurvePoint = dataService.getCurveRoadPoint(curveRoadPointInfo.curveRoadPointId);
+      curveRoadPointInfo.linkedCurveRoadPointId =
+        curveRoadPointInfo.curveRoadPointId;
+      const linkedCurvePoint = dataService.getCurveRoadPoint(
+        curveRoadPointInfo.curveRoadPointId
+      );
       curveRoadPointInfo.x = linkedCurvePoint.x;
       curveRoadPointInfo.y = linkedCurvePoint.y;
     } else {
       if (seqInfo.hasOwnProperty("linkedCurveRoadPointIdX")) {
-        curveRoadPointInfo.linkedCurveRoadPointIdX = seqInfo.linkedCurveRoadPointIdX;
+        curveRoadPointInfo.linkedCurveRoadPointIdX =
+          seqInfo.linkedCurveRoadPointIdX;
         curveRoadPointInfo.x = seqInfo.x;
       } else if (seqInfo.hasOwnProperty("linkedCurveRoadPointIdY")) {
-        curveRoadPointInfo.linkedCurveRoadPointIdY = seqInfo.linkedCurveRoadPointIdY;
+        curveRoadPointInfo.linkedCurveRoadPointIdY =
+          seqInfo.linkedCurveRoadPointIdY;
         curveRoadPointInfo.y = seqInfo.y;
       }
-      if (curveRoadPointInfo.hasOwnProperty("y") && !curveRoadPointInfo.hasOwnProperty("x")) {
+      if (
+        curveRoadPointInfo.hasOwnProperty("y") &&
+        !curveRoadPointInfo.hasOwnProperty("x")
+      ) {
         curveRoadPointInfo.x = position.x;
       }
-      if (curveRoadPointInfo.hasOwnProperty("x") && !curveRoadPointInfo.hasOwnProperty("y")) {
+      if (
+        curveRoadPointInfo.hasOwnProperty("x") &&
+        !curveRoadPointInfo.hasOwnProperty("y")
+      ) {
         curveRoadPointInfo.y = position.y;
       }
     }
@@ -565,13 +676,25 @@ export default class ListenLayer {
       let rightLine = mathUtil.createLine1(rightEdge.start, rightEdge.end);
       let rightJoin = mathUtil.getJoinLinePoint(position, rightLine);
 
-      let leftSideLine = leftEdge.roadSide ? mathUtil.createLine1(leftEdge.roadSide.start, leftEdge.roadSide.end) : null;
-      let leftSideJoin = leftSideLine ? mathUtil.getJoinLinePoint(position, leftSideLine) : null;
-
-      let rightSideLine = rightEdge.roadSide ? mathUtil.createLine1(rightEdge.roadSide.start, rightEdge.roadSide.end) : null;
-      let rightSideJoin = rightSideLine ? mathUtil.getJoinLinePoint(position, rightSideLine) : null;
+      let leftSideLine = leftEdge.roadSide
+        ? mathUtil.createLine1(leftEdge.roadSide.start, leftEdge.roadSide.end)
+        : null;
+      let leftSideJoin = leftSideLine
+        ? mathUtil.getJoinLinePoint(position, leftSideLine)
+        : null;
+
+      let rightSideLine = rightEdge.roadSide
+        ? mathUtil.createLine1(rightEdge.roadSide.start, rightEdge.roadSide.end)
+        : null;
+      let rightSideJoin = rightSideLine
+        ? mathUtil.getJoinLinePoint(position, rightSideLine)
+        : null;
       let distance = this.getDistance(position, join);
-      if (mathUtil.isContainForSegment(join, startPoint, endPoint) && (mathUtil.isContainForSegment(position, join, leftJoin) || mathUtil.isContainForSegment(position, join, rightJoin))) {
+      if (
+        mathUtil.isContainForSegment(join, startPoint, endPoint) &&
+        (mathUtil.isContainForSegment(position, join, leftJoin) ||
+          mathUtil.isContainForSegment(position, join, rightJoin))
+      ) {
         if (!roadInfo.roadId || distance < roadInfo.distance) {
           roadInfo = {
             roadId: roadId,
@@ -603,8 +726,11 @@ export default class ListenLayer {
 
       distance = this.getDistance(position, leftJoin);
       if (
-        (mathUtil.isContainForSegment(leftJoin, leftEdge.start, leftEdge.end) && distance < Constant.minAdsorbPix / 2) ||
-        (mathUtil.isContainForSegment(join, startPoint, endPoint) && leftSideJoin && mathUtil.isContainForSegment(position, leftSideJoin, leftJoin))
+        (mathUtil.isContainForSegment(leftJoin, leftEdge.start, leftEdge.end) &&
+          distance < Constant.minAdsorbPix / 2) ||
+        (mathUtil.isContainForSegment(join, startPoint, endPoint) &&
+          leftSideJoin &&
+          mathUtil.isContainForSegment(position, leftSideJoin, leftJoin))
       ) {
         if (!edgeInfo.edgeId || distance < edgeInfo.distance) {
           edgeInfo = {
@@ -619,8 +745,15 @@ export default class ListenLayer {
       distance = this.getDistance(position, rightJoin);
 
       if (
-        (mathUtil.isContainForSegment(rightJoin, rightEdge.start, rightEdge.end) && distance < Constant.minAdsorbPix / 2) ||
-        (mathUtil.isContainForSegment(join, startPoint, endPoint) && rightSideJoin && mathUtil.isContainForSegment(position, rightSideJoin, rightJoin))
+        (mathUtil.isContainForSegment(
+          rightJoin,
+          rightEdge.start,
+          rightEdge.end
+        ) &&
+          distance < Constant.minAdsorbPix / 2) ||
+        (mathUtil.isContainForSegment(join, startPoint, endPoint) &&
+          rightSideJoin &&
+          mathUtil.isContainForSegment(position, rightSideJoin, rightJoin))
       ) {
         if (!edgeInfo.edgeId || distance < edgeInfo.distance) {
           edgeInfo = {
@@ -633,10 +766,16 @@ export default class ListenLayer {
       }
     }
 
-    if (roadInfo.roadId && (!edgeInfo.edgeId || roadInfo.distance < edgeInfo.distance)) {
+    if (
+      roadInfo.roadId &&
+      (!edgeInfo.edgeId || roadInfo.distance < edgeInfo.distance)
+    ) {
       const linkedRoad = dataService.getRoad(roadInfo.roadId);
       const linkedRoadLine = roadService.getMidLine(linkedRoad);
-      const linkedPosition = mathUtil.getJoinLinePoint(position, linkedRoadLine);
+      const linkedPosition = mathUtil.getJoinLinePoint(
+        position,
+        linkedRoadLine
+      );
 
       roadInfo.x = linkedPosition.x;
       roadInfo.y = linkedPosition.y;
@@ -700,14 +839,33 @@ export default class ListenLayer {
       console.log("isSelectCurveRoad:" + JSON.stringify(joinInfo));
       //检查edge
       const leftCurveEdge = dataService.getCurveRoadEdge(curveRoad.leftEdgeId);
-      const leftJoinInfo = this.distanceForBezier(position, leftCurveEdge.curves, Constant.minAdsorbPix);
+      const leftJoinInfo = this.distanceForBezier(
+        position,
+        leftCurveEdge.curves,
+        Constant.minAdsorbPix
+      );
 
-      const rightCurveEdge = dataService.getCurveRoadEdge(curveRoad.rightEdgeId);
-      const rightJoinInfo = this.distanceForBezier(position, rightCurveEdge.curves, Constant.minAdsorbPix);
+      const rightCurveEdge = dataService.getCurveRoadEdge(
+        curveRoad.rightEdgeId
+      );
+      const rightJoinInfo = this.distanceForBezier(
+        position,
+        rightCurveEdge.curves,
+        Constant.minAdsorbPix
+      );
 
-      let line1 = mathUtil.createLine1(joinInfo.position, leftJoinInfo.position);
+      let line1 = mathUtil.createLine1(
+        joinInfo.position,
+        leftJoinInfo.position
+      );
       let position1 = mathUtil.getJoinLinePoint(position, line1);
-      if (mathUtil.isContainForSegment(position1, joinInfo.position, leftJoinInfo.position)) {
+      if (
+        mathUtil.isContainForSegment(
+          position1,
+          joinInfo.position,
+          leftJoinInfo.position
+        )
+      ) {
         if (joinInfo.distance < curveRoad.leftWidth) {
           curveRoadInfo = {
             curveRoadId: curveRoadId,
@@ -719,10 +877,19 @@ export default class ListenLayer {
         }
         curveRoadInfo.dir = "left";
       } else {
-        let line2 = mathUtil.createLine1(joinInfo.position, rightJoinInfo.position);
+        let line2 = mathUtil.createLine1(
+          joinInfo.position,
+          rightJoinInfo.position
+        );
 
         let position2 = mathUtil.getJoinLinePoint(position, line2);
-        if (mathUtil.isContainForSegment(position2, joinInfo.position, rightJoinInfo.position)) {
+        if (
+          mathUtil.isContainForSegment(
+            position2,
+            joinInfo.position,
+            rightJoinInfo.position
+          )
+        ) {
           if (joinInfo.distance < curveRoad.rightWidth) {
             curveRoadInfo = {
               curveRoadId: curveRoadId,
@@ -737,7 +904,10 @@ export default class ListenLayer {
       }
 
       if (leftJoinInfo.distance < Constant.minAdsorbPix) {
-        const index = mathUtil.getCurvesIndexForCurvesPoints(leftJoinInfo.position, curveRoad.points);
+        const index = mathUtil.getCurvesIndexForCurvesPoints(
+          leftJoinInfo.position,
+          curveRoad.points
+        );
         curveEdgeInfo = {
           curveEdgeId: curveRoad.leftEdgeId,
           type: VectorType.CurveRoadEdge,
@@ -747,7 +917,10 @@ export default class ListenLayer {
           y: leftJoinInfo.position.y,
         };
       } else if (rightJoinInfo.distance < Constant.minAdsorbPix) {
-        const index = mathUtil.getCurvesIndexForCurvesPoints(rightJoinInfo.position, curveRoad.points);
+        const index = mathUtil.getCurvesIndexForCurvesPoints(
+          rightJoinInfo.position,
+          curveRoad.points
+        );
         curveEdgeInfo = {
           curveEdgeId: curveRoad.rightEdgeId,
           type: VectorType.CurveRoadEdge,
@@ -758,7 +931,11 @@ export default class ListenLayer {
         };
       }
     }
-    if (curveRoadInfo.curveRoadId && (!curveEdgeInfo.curveEdgeId || curveRoadInfo.distance < curveEdgeInfo.distance)) {
+    if (
+      curveRoadInfo.curveRoadId &&
+      (!curveEdgeInfo.curveEdgeId ||
+        curveRoadInfo.distance < curveEdgeInfo.distance)
+    ) {
       // console.log("选中的CurveRoad:" + curveRoadInfo.curveRoadId);
       return curveRoadInfo;
     } else if (curveEdgeInfo.curveEdgeId) {
@@ -843,46 +1020,60 @@ export default class ListenLayer {
     };
     const svgs = dataService.getSVGs();
 
-    /**-----暴力做法 */
+    // /**-----暴力做法 */
+    // for (const svgId in svgs) {
+    //   if (svgId == exceptSVGId) {
+    //     continue;
+    //   }
+    //   const svg = dataService.getSVG(svgId);
+    //   for (let i = 0; i < svg.points.length; ++i) {
+    //     let distance = this.getDistance(position, svg.points[i]);
+    //     // if (!svgInfo.svgId && distance < Constant.minAdsorbPix / 5) { //改大图例四个点的选择范围
+    //     if (!svgInfo.svgId && distance < Constant.minAdsorbPix / 2) {
+    //       svgInfo = {
+    //         svgId: svgId,
+    //         distance: distance,
+    //         type: VectorType.SVG,
+    //         index: i,
+    //         x: position.x,
+    //         y: position.y,
+    //       };
+    //     } else if (svgInfo.svgId && distance < svgInfo.distance) {
+    //       svgInfo = {
+    //         svgId: svgId,
+    //         distance: distance,
+    //         type: VectorType.SVG,
+    //         index: i,
+    //         x: position.x,
+    //         y: position.y,
+    //       };
+    //     }
+    //   }
+    // }
+    // /**----- */
+
     for (const svgId in svgs) {
       if (svgId == exceptSVGId) {
         continue;
       }
       const svg = dataService.getSVG(svgId);
-      for (let i = 0; i < svg.points.length; ++i) {
-        let distance = this.getDistance(position, svg.points[i]);
-        // if (!svgInfo.svgId && distance < Constant.minAdsorbPix / 5) { //改大图例四个点的选择范围
-        if (!svgInfo.svgId && distance < Constant.minAdsorbPix / 2) {
-          svgInfo = {
-            svgId: svgId,
-            distance: distance,
-            type: VectorType.SVG,
-            index: i,
-            x: position.x,
-            y: position.y,
-          };
-        } else if (svgInfo.svgId && distance < svgInfo.distance) {
-          svgInfo = {
-            svgId: svgId,
-            distance: distance,
-            type: VectorType.SVG,
-            index: i,
-            x: position.x,
-            y: position.y,
-          };
-        }
-      }
-    }
-    /**----- */
+      // let centerPoint = mathUtil.calculateCenterPoint(svg.points);
 
-    for (const svgId in svgs) {
-      if (svgId == exceptSVGId) {
-        continue;
+      let newDistance = this.getDistance(position, svg.center);
+      if (
+        this.getDistance(position, svg.controlAnglePoint) <
+        Constant.minAdsorbPix / 2
+      ) {
+        svgInfo = {
+          svgId: svgId,
+          type: VectorType.SVG,
+          index: 100, //表示选中旋转控制点
+          x: position.x,
+          y: position.y,
+        };
+        return svgInfo;
       }
-      const svg = dataService.getSVG(svgId);
-      let centerPoint = mathUtil.calculateCenterPoint(svg.points);
 
-      let newDistance = this.getDistance(position, centerPoint);
       for (let i = 0; i < svg.points.length; ++i) {
         let distance = this.getDistance(position, svg.points[i]);
 
@@ -909,9 +1100,6 @@ export default class ListenLayer {
           };
         }
       }
-      // if (svgInfo.svgId) {
-      //   return svgInfo;
-      // }
 
       let flag = mathUtil.isPointInPoly(position, svg.points);
       if (flag && !svgInfo.svgId) {
@@ -933,28 +1121,6 @@ export default class ListenLayer {
           newDistance: newDistance,
         };
       }
-
-      // if (!svgInfo.svgId && newDistance < Constant.minAdsorbPix / 2) {
-      //   svgInfo = {
-      //     svgId: svgId,
-      //     type: VectorType.SVG,
-      //     x: position.x,
-      //     y: position.y,
-      //     index: -1,
-      //     newDistance: newDistance,
-      //   };
-      //   break;
-      // } else if (svgInfo.svgId && newDistance < svgInfo.newDistance) {
-      //   svgInfo = {
-      //     svgId: svgId,
-      //     type: VectorType.SVG,
-      //     x: position.x,
-      //     y: position.y,
-      //     index: -1,
-      //     newDistance: newDistance,
-      //   };
-      //   break;
-      // }
     }
 
     return svgInfo;
@@ -1038,7 +1204,10 @@ export default class ListenLayer {
       this.modifyPoint.index = info.circleInfo.index;
       this.modifyPoint.x = info.circleInfo.x;
       this.modifyPoint.y = info.circleInfo.y;
-    } else if (info && (info.pointInfo.pointId || info.curvePointInfo.curvePointId)) {
+    } 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) {
@@ -1046,7 +1215,8 @@ export default class ListenLayer {
           this.modifyPoint.x = info.pointInfo.x;
           this.modifyPoint.y = info.pointInfo.y;
         } else {
-          this.modifyPoint.linkedCurvePointId = info.curvePointInfo.curvePointId;
+          this.modifyPoint.linkedCurvePointId =
+            info.curvePointInfo.curvePointId;
           this.modifyPoint.x = info.curvePointInfo.x;
           this.modifyPoint.y = info.curvePointInfo.y;
         }
@@ -1059,7 +1229,10 @@ export default class ListenLayer {
         this.modifyPoint.x = info.curvePointInfo.x;
         this.modifyPoint.y = info.curvePointInfo.y;
       }
-    } else if (info && (info.lineInfo.lineId || info.curveLineInfo.curveLineId)) {
+    } else if (
+      info &&
+      (info.lineInfo.lineId || info.curveLineInfo.curveLineId)
+    ) {
       this.modifyPoint = {};
       if (info.lineInfo.lineId && info.curveLineInfo.curveLineId) {
         if (info.lineInfo.distance < info.curveLineInfo.distance) {
@@ -1086,14 +1259,22 @@ export default class ListenLayer {
       this.modifyPoint.index = info.svgInfo.index;
       this.modifyPoint.x = info.svgInfo.x;
       this.modifyPoint.y = info.svgInfo.y;
-    } else if (info && (info.roadPointInfo.roadPointId || info.curveRoadPointInfo.curveRoadPointId)) {
-      if (info.roadPointInfo.roadPointId && info.curveRoadPointInfo.curveRoadPointId) {
+    } else if (
+      info &&
+      (info.roadPointInfo.roadPointId ||
+        info.curveRoadPointInfo.curveRoadPointId)
+    ) {
+      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.linkedCurveRoadPointId = info.curveRoadPointInfo.curveRoadPointId;
+          this.modifyPoint.linkedCurveRoadPointId =
+            info.curveRoadPointInfo.curveRoadPointId;
           this.modifyPoint.x = info.curveRoadPointInfo.x;
           this.modifyPoint.y = info.curveRoadPointInfo.y;
         }
@@ -1102,11 +1283,15 @@ export default class ListenLayer {
         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.linkedCurveRoadPointId =
+          info.curveRoadPointInfo.curveRoadPointId;
         this.modifyPoint.x = info.curveRoadPointInfo.x;
         this.modifyPoint.y = info.curveRoadPointInfo.y;
       }
-    } else if (info && (info.roadEdgeInfo.roadId || info.curveRoadEdgeInfo.curveRoadId)) {
+    } else if (
+      info &&
+      (info.roadEdgeInfo.roadId || info.curveRoadEdgeInfo.curveRoadId)
+    ) {
       this.modifyPoint = {};
       if (info.roadEdgeInfo.roadId && info.curveRoadEdgeInfo.curveRoadId) {
         if (roadEdgeInfo.distance < info.curveRoadEdgeInfo.distance) {
@@ -1131,7 +1316,10 @@ export default class ListenLayer {
         this.modifyPoint.y = info.curveRoadEdgeInfo.y;
         this.modifyPoint.dir = info.curveRoadEdgeInfo.dir;
       }
-    } else if (info && (info.roadEdgeInfo.edgeId || info.curveRoadEdgeInfo.curveEdgeId)) {
+    } else if (
+      info &&
+      (info.roadEdgeInfo.edgeId || info.curveRoadEdgeInfo.curveEdgeId)
+    ) {
       this.modifyPoint = {};
       if (info.roadEdgeInfo.edgeId && info.curveRoadEdgeInfo.curveEdgeId) {
         if (info.roadEdgeInfo.distance < info.curveRoadEdgeInfo.distance) {
@@ -1139,7 +1327,8 @@ export default class ListenLayer {
           this.modifyPoint.x = info.roadEdgeInfo.x;
           this.modifyPoint.y = info.roadEdgeInfo.y;
         } else {
-          this.modifyPoint.linkedCurveEdgeId = 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;
@@ -1156,40 +1345,57 @@ export default class ListenLayer {
       }
     } else if (info && info.crossPointInfo.crossCrossPointId) {
       this.modifyPoint = {};
-      this.modifyPoint.linkedCrossCrossPointId = info.crossPointInfo.crossCrossPointId;
+      this.modifyPoint.linkedCrossCrossPointId =
+        info.crossPointInfo.crossCrossPointId;
       this.modifyPoint.x = info.crossPointInfo.x;
       this.modifyPoint.y = info.crossPointInfo.y;
     } else if (info && info.roadPointInfo.linkedRoadPointIdX) {
       this.modifyPoint = {};
-      this.modifyPoint.linkedRoadPointIdX = info.roadPointInfo.linkedRoadPointIdX;
+      this.modifyPoint.linkedRoadPointIdX =
+        info.roadPointInfo.linkedRoadPointIdX;
       this.modifyPoint.x = info.roadPointInfo.x;
       this.modifyPoint.y = info.roadPointInfo.y;
     } else if (info && info.roadPointInfo.linkedRoadPointIdY) {
       this.modifyPoint = {};
-      this.modifyPoint.linkedRoadPointIdY = info.roadPointInfo.linkedRoadPointIdY;
+      this.modifyPoint.linkedRoadPointIdY =
+        info.roadPointInfo.linkedRoadPointIdY;
       this.modifyPoint.y = info.roadPointInfo.y;
       this.modifyPoint.x = info.roadPointInfo.x;
     } else if (info && info.curvePointInfo.linkedRoadPointIdX) {
       this.modifyPoint = {};
-      this.modifyPoint.linkedRoadPointIdX = info.curvePointInfo.linkedRoadPointIdX;
+      this.modifyPoint.linkedRoadPointIdX =
+        info.curvePointInfo.linkedRoadPointIdX;
       this.modifyPoint.x = info.curvePointInfo.x;
       this.modifyPoint.y = position.y;
     } else if (info && info.curvePointInfo.linkedRoadPointIdY) {
       this.modifyPoint = {};
-      this.modifyPoint.linkedRoadPointIdY = info.curvePointInfo.linkedRoadPointIdY;
+      this.modifyPoint.linkedRoadPointIdY =
+        info.curvePointInfo.linkedRoadPointIdY;
       this.modifyPoint.y = info.curvePointInfo.y;
       this.modifyPoint.x = position.x;
-    } else if (info && info.pointInfo.linkedPointIdX && !info.pointInfo.linkedPointIdY) {
+    } else if (
+      info &&
+      info.pointInfo.linkedPointIdX &&
+      !info.pointInfo.linkedPointIdY
+    ) {
       this.modifyPoint = {};
       this.modifyPoint.linkedPointIdX = info.pointInfo.linkedPointIdX;
       this.modifyPoint.x = info.pointInfo.x;
       this.modifyPoint.y = info.pointInfo.y;
-    } else if (info && info.pointInfo.linkedPointIdY && !info.pointInfo.linkedPointIdX) {
+    } else if (
+      info &&
+      info.pointInfo.linkedPointIdY &&
+      !info.pointInfo.linkedPointIdX
+    ) {
       this.modifyPoint = {};
       this.modifyPoint.linkedPointIdY = info.pointInfo.linkedPointIdY;
       this.modifyPoint.y = info.pointInfo.y;
       this.modifyPoint.x = info.pointInfo.x;
-    } else if (info && info.pointInfo.linkedPointIdY && info.pointInfo.linkedPointIdX) {
+    } else if (
+      info &&
+      info.pointInfo.linkedPointIdY &&
+      info.pointInfo.linkedPointIdX
+    ) {
       this.modifyPoint = {};
       this.modifyPoint.linkedPointIdX = info.pointInfo.linkedPointIdX;
       this.modifyPoint.linkedPointIdY = info.pointInfo.linkedPointIdY;
@@ -1210,40 +1416,103 @@ export default class ListenLayer {
         return false;
       }
     } else if (this.modifyPoint.linkedRoadPointId) {
-      stateService.setSelectItem(this.modifyPoint.linkedRoadPointId, VectorType.RoadPoint, SelectState.Select);
+      stateService.setSelectItem(
+        this.modifyPoint.linkedRoadPointId,
+        VectorType.RoadPoint,
+        SelectState.Select
+      );
     } else if (this.modifyPoint.linkedCurveRoadPointId) {
-      stateService.setSelectItem(this.modifyPoint.linkedCurveRoadPointId, VectorType.CurveRoadPoint, SelectState.Select, this.modifyPoint.dir);
+      stateService.setSelectItem(
+        this.modifyPoint.linkedCurveRoadPointId,
+        VectorType.CurveRoadPoint,
+        SelectState.Select,
+        this.modifyPoint.dir
+      );
     } else if (this.modifyPoint.linkedRoadId) {
-      stateService.setSelectItem(this.modifyPoint.linkedRoadId, VectorType.Road, SelectState.Select, this.modifyPoint.dir);
+      stateService.setSelectItem(
+        this.modifyPoint.linkedRoadId,
+        VectorType.Road,
+        SelectState.Select,
+        this.modifyPoint.dir
+      );
     } else if (this.modifyPoint.linkedCurveRoadId) {
-      stateService.setSelectItem(this.modifyPoint.linkedCurveRoadId, VectorType.CurveRoad, SelectState.Select, this.modifyPoint.dir);
+      stateService.setSelectItem(
+        this.modifyPoint.linkedCurveRoadId,
+        VectorType.CurveRoad,
+        SelectState.Select,
+        this.modifyPoint.dir
+      );
     } else if (this.modifyPoint.linkedCrossCrossPointId) {
-      stateService.setSelectItem(this.modifyPoint.linkedCrossCrossPointId, VectorType.CrossPoint, SelectState.Select);
+      stateService.setSelectItem(
+        this.modifyPoint.linkedCrossCrossPointId,
+        VectorType.CrossPoint,
+        SelectState.Select
+      );
     } else if (this.modifyPoint.textId) {
-      stateService.setSelectItem(this.modifyPoint.textId, VectorType.Text, SelectState.Select);
+      stateService.setSelectItem(
+        this.modifyPoint.textId,
+        VectorType.Text,
+        SelectState.Select
+      );
     } else if (this.modifyPoint.magnifierId) {
       // if (this.modifyPoint.index == 0) {
       //点击隐藏的放大镜不显示
-      stateService.setSelectItem(this.modifyPoint.magnifierId, VectorType.Magnifier, this.modifyPoint.index);
+      stateService.setSelectItem(
+        this.modifyPoint.magnifierId,
+        VectorType.Magnifier,
+        this.modifyPoint.index
+      );
       // } else {
       stateService.setSelectState(this.modifyPoint.index);
       // }
     } else if (this.modifyPoint.svgId) {
-      stateService.setSelectItem(this.modifyPoint.svgId, VectorType.SVG, this.modifyPoint.index);
+      stateService.setSelectItem(
+        this.modifyPoint.svgId,
+        VectorType.SVG,
+        this.modifyPoint.index
+      );
     } else if (this.modifyPoint.linkedEdgeId) {
-      stateService.setSelectItem(this.modifyPoint.linkedEdgeId, VectorType.RoadEdge, SelectState.Select);
+      stateService.setSelectItem(
+        this.modifyPoint.linkedEdgeId,
+        VectorType.RoadEdge,
+        SelectState.Select
+      );
     } else if (this.modifyPoint.linkedCurveEdgeId) {
-      stateService.setSelectItem(this.modifyPoint.linkedCurveEdgeId, VectorType.CurveRoadEdge, SelectState.Select);
+      stateService.setSelectItem(
+        this.modifyPoint.linkedCurveEdgeId,
+        VectorType.CurveRoadEdge,
+        SelectState.Select
+      );
     } else if (this.modifyPoint.linkedPointId) {
-      stateService.setSelectItem(this.modifyPoint.linkedPointId, VectorType.Point, SelectState.Select);
+      stateService.setSelectItem(
+        this.modifyPoint.linkedPointId,
+        VectorType.Point,
+        SelectState.Select
+      );
     } else if (this.modifyPoint.linkedCurvePointId) {
-      stateService.setSelectItem(this.modifyPoint.linkedCurvePointId, VectorType.CurvePoint, SelectState.Select);
+      stateService.setSelectItem(
+        this.modifyPoint.linkedCurvePointId,
+        VectorType.CurvePoint,
+        SelectState.Select
+      );
     } else if (this.modifyPoint.linkedLineId) {
-      stateService.setSelectItem(this.modifyPoint.linkedLineId, VectorType.Line, SelectState.Select);
+      stateService.setSelectItem(
+        this.modifyPoint.linkedLineId,
+        VectorType.Line,
+        SelectState.Select
+      );
     } else if (this.modifyPoint.linkedCurveLineId) {
-      stateService.setSelectItem(this.modifyPoint.linkedCurveLineId, VectorType.CurveLine, SelectState.Select);
+      stateService.setSelectItem(
+        this.modifyPoint.linkedCurveLineId,
+        VectorType.CurveLine,
+        SelectState.Select
+      );
     } else if (this.modifyPoint.linkedCircleId) {
-      stateService.setSelectItem(this.modifyPoint.linkedCircleId, VectorType.Circle, this.modifyPoint.index);
+      stateService.setSelectItem(
+        this.modifyPoint.linkedCircleId,
+        VectorType.Circle,
+        this.modifyPoint.index
+      );
     } else {
       stateService.clearSelectItem();
     }
@@ -1281,7 +1550,10 @@ export default class ListenLayer {
 
   //调整到与像素的长度一致
   getDistance(start, end) {
-    return (mathUtil.getDistance(start, end) * coordinate.zoom) / coordinate.defaultZoom;
+    return (
+      (mathUtil.getDistance(start, end) * coordinate.zoom) /
+      coordinate.defaultZoom
+    );
   }
 
   clear() {