xushiting 2 年 前
コミット
f7283e98a2

+ 5 - 0
src/graphic/Controls/AddPoint.js

@@ -11,6 +11,7 @@ import LayerEvents from "../enum/LayerEvents";
 import VectorType from "../enum/VectorType";
 import Constant from "../Constant";
 import { listenLayer } from "../ListenLayer";
+import { textService } from "../Service/TextService";
 
 export default class AddPoint {
   constructor() {
@@ -90,6 +91,10 @@ export default class AddPoint {
     } else if (Settings.selectPointCategory == VectorCategory.Point.FixPoint) {
       newPoint = pointService.create(position);
       stateService.setEventName(LayerEvents.AddPoint);
+      const textVector = textService.create(position);
+      textVector.setValue("固定点");
+      newPoint.linkedTextId = textVector.vectorId;
+      textVector.linkedPointId = newPoint.vectorId;
     }
     listenLayer.clear();
     return newPoint;

+ 0 - 2
src/graphic/Controls/UIControl.js

@@ -104,8 +104,6 @@ export default class UIControl {
           stateService.setEventName(LayerEvents.AddCircle);
         } else if (selectUI == UIEvents.Text) {
           stateService.setEventName(LayerEvents.AddText);
-        } else if (selectUI == UIEvents.FixPoint) {
-          stateService.setEventName(LayerEvents.addFixPoint);
         } else if (selectUI == UIEvents.Magnifier) {
           stateService.setEventName(LayerEvents.AddMagnifier);
         } else if (SVGType[selectUI]) {

+ 9 - 8
src/graphic/History/HistoryUtil.js

@@ -28,9 +28,9 @@ export default class HistoryUtil {
       line1.startId == line2.startId &&
       line1.endId == line2.endId &&
       line1.category == line2.category &&
-      line1.locationMode == line2.locationMode && 
-      line1.style == line2.style && 
-      line1.weight == line2.weight 
+      line1.locationMode == line2.locationMode &&
+      line1.style == line2.style &&
+      line1.weight == line2.weight
     ) {
       return false;
     } else {
@@ -80,9 +80,9 @@ export default class HistoryUtil {
     if (
       mathUtil.equalPoint(text1.center, text2.center) &&
       text1.value == text2.value &&
-      text1.angle == text2.angle && 
-      text1.fontSize == text2.fontSize && 
-      text1.color == text2.color 
+      text1.angle == text2.angle &&
+      text1.fontSize == text2.fontSize &&
+      text1.color == text2.color
     ) {
       return false;
     } else {
@@ -643,8 +643,8 @@ export default class HistoryUtil {
     data.center = {};
     mathUtil.clonePoint(data.center, text.center);
     data.value = text.value;
-    data.fontSize = text.fontSize 
-    data.color = text.color 
+    data.fontSize = text.fontSize;
+    data.color = text.color;
     return data;
   }
 
@@ -700,6 +700,7 @@ export default class HistoryUtil {
     data.start = JSON.parse(JSON.stringify(roadEdge.start));
     data.end = {};
     data.end = JSON.parse(JSON.stringify(roadEdge.end));
+    data.style = roadEdge.style;
     return data;
   }
 

+ 6 - 4
src/graphic/ListenLayer.js

@@ -891,13 +891,15 @@ export default class ListenLayer {
         continue;
       }
       const text = dataService.getText(textId);
-      const distance = this.getDistance(position, text.center);
-
-      if (distance < Constant.minAdsorbPix) {
+      const rec = text.getBound(draw.context);
+      //const distance = this.getDistance(position, text.center);
+      let flag = mathUtil.isPointInPoly(position, rec);
+      //if (distance < Constant.minAdsorbPix) {
+      if (flag) {
         textInfo = {
           textId: textId,
           type: VectorType.Text,
-          distance: distance,
+          //distance: distance,
           x: text.center.x,
           y: text.center.y,
         };

+ 16 - 13
src/graphic/Service/UIService.js

@@ -1,15 +1,15 @@
-import Text from '../Geometry/Text.js';
-import { dataService } from './DataService.js';
-import { mathUtil } from '../Util/MathUtil.js';
-import Settings from '../Settings';
-import { coordinate } from '../Coordinate.js';
-import UIEvents from '../enum/UIEvents.js';
-import VectorCategory from '../enum/VectorCategory.js';
-import Constant from '../Constant.js';
-import VectorStyle from '../enum/VectorStyle.js';
-import VectorWeight from '../enum/VectorWeight.js';
-import RoadTemplate from '../enum/RoadTemplate.js';
-import RoadStructure from '../enum/RoadStructure.js';
+import Text from "../Geometry/Text.js";
+import { dataService } from "./DataService.js";
+import { mathUtil } from "../Util/MathUtil.js";
+import Settings from "../Settings";
+import { coordinate } from "../Coordinate.js";
+import UIEvents from "../enum/UIEvents.js";
+import VectorCategory from "../enum/VectorCategory.js";
+import Constant from "../Constant.js";
+import VectorStyle from "../enum/VectorStyle.js";
+import VectorWeight from "../enum/VectorWeight.js";
+import RoadTemplate from "../enum/RoadTemplate.js";
+import RoadStructure from "../enum/RoadStructure.js";
 
 export default class UIService {
   constructor() {}
@@ -56,7 +56,7 @@ export default class UIService {
   }
 
   isBelongCurveRoad(ui) {
-    if (ui == 'SBend') {
+    if (ui == "SBend") {
       this.setRoadLeftDrivewayCount(0);
       this.setRoadRightDrivewayCount(0);
       return true;
@@ -109,6 +109,9 @@ export default class UIService {
       this.setSelectPointCategory(VectorCategory.Point.BasePoint);
       this.setSelectLocationMode(null);
       return true;
+    } else if (ui == UIEvents.FixPoint) {
+      this.setSelectPointCategory(VectorCategory.Point.FixPoint);
+      return true;
     }
     return false;
   }