Pārlūkot izejas kodu

Merge remote-tracking branch 'origin/master'

bill 2 gadi atpakaļ
vecāks
revīzija
27a8ee368e

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1 - 1
server/test/a0k4xu045_202305311600080410/attach/sceneStore


+ 14 - 13
src/graphic/Controls/MoveSVG.js

@@ -10,19 +10,6 @@ export default class MoveSVG {
     svg.setBoundingVertexs();
   }
 
-  movePoint(position, svgId, pointIndex) {
-    let svg = dataService.getSVG(svgId);
-    const rec = svg.getLengthWidth();
-    const scale = svg.getScale();
-    const side1 = Math.sqrt(
-      Math.pow((rec.width / 2) * scale, 2) +
-        Math.pow((rec.length / 2) * scale, 2)
-    );
-    const side2 = mathUtil.getDistance(position, svg.center);
-    svg.scale = (side2 / side1) * scale;
-    svg.setBoundingVertexs();
-  }
-
   // movePoint(position, svgId, pointIndex) {
   //   let svg = dataService.getSVG(svgId);
   //   const rec = svg.getLengthWidth();
@@ -35,6 +22,20 @@ export default class MoveSVG {
   //   svg.scale = (side2 / side1) * scale;
   //   svg.setBoundingVertexs();
   // }
+
+  movePoint(position, svgId, pointIndex) {
+    let svg = dataService.getSVG(svgId);
+    const rec = svg.getLengthWidth();
+    const scale = svg.getScale();
+    const side1 = Math.sqrt(
+      Math.pow((rec.width / 2) * scale, 2) +
+        Math.pow((rec.length / 2) * scale, 2)
+    );
+
+    svg.setBoundingVertexs2(position, pointIndex);
+    const side2 = mathUtil.getDistance(position, svg.center);
+    svg.scale = (side2 / side1) * scale;
+  }
 }
 
 const moveSVG = new MoveSVG();

+ 13 - 5
src/graphic/Geometry/SVG.js

@@ -91,11 +91,19 @@ export default class SVG extends Geometry {
     this.points.push(point4);
   }
 
-  // setBoundingVertexs2(position, pointIndex) {
-  //   mathUtil.clonePoint(this.points[pointIndex], position);
-  //   // 【注意】angle 逆时针为正,顺时针为负
-  //   this.points[pointIndex] = this.rotatePoint(position, this.center, 90);
-  // }
+  setBoundingVertexs2(position, pointIndex) {
+    if (mathUtil.getDistance(position, this.center) < Constant.minAdsorbPix) {
+      return;
+    }
+    mathUtil.clonePoint(this.points[pointIndex], position);
+    // 【注意】angle 逆时针为正,顺时针为负
+    let nextIndex = this.getNextIndex(pointIndex);
+    this.points[nextIndex] = this.rotatePoint(position, this.center, 90);
+    nextIndex = this.getNextIndex(nextIndex);
+    this.points[nextIndex] = this.rotatePoint(position, this.center, 180);
+    nextIndex = this.getNextIndex(nextIndex);
+    this.points[nextIndex] = this.rotatePoint(position, this.center, 270);
+  }
 
   getNextIndex(index) {
     let nextIndex = index + 1;

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

@@ -17,7 +17,6 @@ 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";
 import Settings from "../Settings";
 
 export default class History {

+ 11 - 21
src/graphic/ListenLayer.js

@@ -190,33 +190,23 @@ export default class ListenLayer {
         continue;
       }
       const curveLine = dataService.getCurveLine(curveLineId);
-      let startPoint = dataService.getCurvePoint(curveLine.startId);
-      let endPoint = dataService.getCurvePoint(curveLine.endId);
-      const comLine = mathUtil.createLine1(startPoint, endPoint);
-      const join = mathUtil.getJoinLinePoint(position, comLine);
-      const distance = this.getDistance(position, join);
-      if (!mathUtil.isContainForSegment(join, startPoint, endPoint)) {
-        continue;
-      }
-      if (distance < Constant.minAdsorbPix / 2) {
+
+      let joinInfo = this.distanceForBezier(
+        position,
+        curveLine.curves,
+        Constant.minAdsorbPix
+      );
+      //选中了路
+      if (joinInfo.distance < Constant.minAdsorbPix) {
         curveLineInfo = {
           curveLineId: curveLineId,
           type: VectorType.CurveLine,
-          distance: distance,
+          distance: joinInfo.distance,
+          x: joinInfo.position.x,
+          y: joinInfo.position.y,
         };
       }
     }
-
-    if (curveLineInfo.curveLineId) {
-      const linkedLine = dataService.getLine(lineInfo.curveLineId);
-      let startPoint = dataService.getCurvePoint(linkedLine.startId);
-      let endPoint = dataService.getCurvePoint(linkedLine.endId);
-      const linkedComLine = mathUtil.createLine1(startPoint, endPoint);
-      const linkedPosition = mathUtil.getJoinLinePoint(position, linkedComLine);
-      curveLineInfo.x = linkedPosition.x;
-      curveLineInfo.y = linkedPosition.y;
-      return curveLineInfo;
-    }
     return curveLineInfo;
   }
 

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

@@ -614,7 +614,7 @@ export default class Draw {
       ...element,
       // radius: help.getReal(element.radius),
       radius: (element.radius * coordinate.zoom) / coordinate.defaultZoom,
-      geoType: "Circle",
+      geoType: VectorType.Circle,
       ...element.center,
     });
 

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

@@ -3,7 +3,7 @@ import Line from "../Geometry/Line.js";
 import CurvePoint from "../Geometry/CurvePoint.js";
 import CurveLine from "../Geometry/CurveLine.js";
 import { dataService } from "./DataService.js";
-// import { curvePointService } from "./CurvePointService.js";
+import { curvePointService } from "./CurvePointService.js";
 import VectorCategory from "../enum/VectorCategory.js";
 import { mathUtil } from "../Util/MathUtil.js";
 import { uiService } from "./UIService.js";