xushiting 2 rokov pred
rodič
commit
6d964eb763

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1 - 1
server/test/a0k4xu045_202305311600080410/attach/sceneStore


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

@@ -133,7 +133,6 @@ export default class AddPoint {
     join.setCategory(VectorCategory.Point.TestBasePoint);
     join.setLocationMode(Constant.angleLocationMode);
     join.setLinkedBasePointId(basePoint.vectorId);
-    join.setLinkedTestPointId(testPointId);
     let guidePositionLine = lineService.createByPointId(
       testPointId,
       join.vectorId,
@@ -168,7 +167,6 @@ export default class AddPoint {
     join.setCategory(VectorCategory.Point.TestBasePoint);
     join.setLocationMode(Constant.allLocationMode);
     join.setLinkedBasePointId(basePoint.vectorId);
-    join.setLinkedTestPointId(testPointId);
     //待测点与基准线的垂直线
     lineService.createByPointId(
       testPointId,
@@ -190,9 +188,6 @@ export default class AddPoint {
         testPointId,
         VectorCategory.Line.PositionLine
       );
-      testPoint.setLinkedTestPointId(
-        this.testPointIds[this.testPointIds.length - 1]
-      );
     }
   }
 
@@ -213,7 +208,6 @@ export default class AddPoint {
     join = pointService.create(join);
     join.setCategory(VectorCategory.Point.TestBasePoint);
     join.setLocationMode(Constant.normalLocationMode);
-    join.setLinkedTestPointId(testPointId);
     lineService.createByPointId(
       testPointId,
       join.vectorId,

+ 39 - 6
src/graphic/Controls/LocationModeControl.js

@@ -7,6 +7,7 @@ import { lineService } from "../Service/LineService";
 import { pointService } from "../Service/PointService";
 import VectorCategory from "../enum/VectorCategory";
 import Constant from "../Constant";
+import { uiService } from "../Service/UIService";
 
 export default class LocationModeControl {
   constructor() {}
@@ -15,6 +16,7 @@ export default class LocationModeControl {
   setAngle() {
     let selectBasePoint = this.isFocusBasePoint();
     if (selectBasePoint) {
+      this.deleteOldLines();
       let points = dataService.getPoints();
       for (let key in points) {
         let point = dataService.getPoint(key);
@@ -41,15 +43,10 @@ export default class LocationModeControl {
 
     let baseLineGeometry = mathUtil.createLine1(startPoint, endPoint);
     let vLine = mathUtil.getVerticalLine(baseLineGeometry, fixPoint);
-    // let join = mathUtil.getJoinLinePoint(basePoint, vLine);
-    // join = pointService.create(join);
-    // join.setLocationMode(Constant.angleLocationMode);
     let join = mathUtil.getIntersectionPoint(baseLineGeometry, vLine); //固定点到基准线的垂直线与基准线的交点
     join = pointService.create(join);
     join.setLocationMode(Constant.angleLocationMode);
     join.setCategory(VectorCategory.Point.TestBasePoint);
-    //join.setCategory(VectorCategory.Line.LocationLineByFixPoint);
-    //fixPoint.linkedTestPointId = join.vectorId;
 
     let locationLineByFixPoint = lineService.createByPointId(
       fixPointId,
@@ -57,13 +54,14 @@ export default class LocationModeControl {
       VectorCategory.Line.LocationLineByFixPoint
     );
     locationLineByFixPoint.setLocationMode(Constant.angleLocationMode);
+    locationLineByFixPoint.setLinkedBasePointId(basePointId);
+    locationLineByFixPoint.setLinkedFixPointId(fixPointId);
 
     let locationLineByBasePoint = mathUtil.getVerticalLine(vLine, basePoint); //基准点1条垂直线的垂直线
     join = mathUtil.getIntersectionPoint(locationLineByBasePoint, vLine);
     join = pointService.create(join);
     join.setLocationMode(Constant.angleLocationMode);
     join.setCategory(VectorCategory.Point.TestBasePoint);
-    //join.linkedBasePointId = basePointId;
 
     locationLineByBasePoint = lineService.createByPointId(
       basePointId,
@@ -71,6 +69,8 @@ export default class LocationModeControl {
       VectorCategory.Line.LocationLineByBasePoint
     );
     locationLineByBasePoint.setLocationMode(Constant.angleLocationMode);
+    locationLineByBasePoint.setLinkedBasePointId(basePointId);
+    locationLineByBasePoint.setLinkedFixPointId(fixPointId);
 
     let guideLocationLine = lineService.createByPointId(
       fixPointId,
@@ -78,6 +78,8 @@ export default class LocationModeControl {
       VectorCategory.Line.GuideLocationLine
     );
     guideLocationLine.setLocationMode(Constant.angleLocationMode);
+    guideLocationLine.setLinkedBasePointId(basePointId);
+    guideLocationLine.setLinkedFixPointId(fixPointId);
   }
 
   /******************************************************************************************************************************************************/
@@ -88,6 +90,23 @@ export default class LocationModeControl {
   /******************************************************************************************************************************************************/
 
   isFocusBasePoint() {
+    let basePointCount = 0;
+    let selectBasePointId = null;
+    if (!Settings.selectBasePointId) {
+      let points = dataService.getPoints();
+      for (let key in points) {
+        let point = dataService.getPoint(key);
+        if (point.getCategory() == VectorCategory.Point.BasePoint) {
+          ++basePointCount;
+          selectBasePointId = key;
+        }
+      }
+    }
+
+    if (basePointCount == 1) {
+      uiService.setSelectBasePointId(selectBasePointId);
+    }
+
     if (Settings.selectBasePointId) {
       let point = dataService.getPoint(Settings.selectBasePointId);
       if (point.getCategory() == VectorCategory.Point.BasePoint) {
@@ -96,6 +115,20 @@ export default class LocationModeControl {
     }
     return null;
   }
+
+  //设置定位法前,需要删除和定位法相关的线条
+  deleteOldLines() {
+    let lines = dataService.getLines();
+    for (let key in lines) {
+      let line = dataService.getLine(key);
+      if (
+        line.getLinkedFixPointId() != null ||
+        line.getLinkedBasePointId() != null
+      ) {
+        dataService.deleteLine(key);
+      }
+    }
+  }
 }
 
 const locationModeControl = new LocationModeControl();

+ 6 - 0
src/graphic/Controls/MoveLine.js

@@ -128,6 +128,9 @@ export default class MoveLine {
           VectorCategory.Line.ExtendedPositionLine
         );
         extendedPositionLine.setLocationMode(Constant.angleLocationMode);
+        extendedPositionLine.setLinkedBasePointId(line.getLinkedBasePointId());
+        extendedPositionLine.setLinkedFixPointId(line.getLinkedFixPointId());
+
         dataService.deletePointParent(startPoint.vectorId, lineId);
         line.startId = newStartPoint.vectorId;
         newStartPoint.setPointParent(line.vectorId, "start");
@@ -189,6 +192,9 @@ export default class MoveLine {
           VectorCategory.Line.ExtendedPositionLine
         );
         extendedPositionLine.setLocationMode(Constant.angleLocationMode);
+        extendedPositionLine.setLinkedBasePointId(line.getLinkedBasePointId());
+        extendedPositionLine.setLinkedFixPointId(line.getLinkedFixPointId());
+
         dataService.deletePointParent(startPoint.vectorId, lineId);
         line.startId = newStartPoint.vectorId;
         newStartPoint.setPointParent(line.vectorId, "start");

+ 0 - 1
src/graphic/Controls/MovePoint.js

@@ -111,7 +111,6 @@ export default class MovePoint {
       if (point.getCategory() == VectorCategory.Point.TestBasePoint) {
         if (
           point.getLinkedBasePointId() == basePointId &&
-          point.getLinkedTestPointId() == testPointId &&
           point.getLocationMode() == locationMode
         ) {
           return point;

+ 3 - 1
src/graphic/Controls/MoveText.js

@@ -6,7 +6,9 @@ export default class MoveText {
 
   moveFullText(position, textId) {
     let text = dataService.getText(textId);
-    mathUtil.clonePoint(text.center, position);
+    if (!text.linkedPointId) {
+      mathUtil.clonePoint(text.center, position);
+    }
   }
 }
 

+ 11 - 2
src/graphic/Geometry/Geometry.js

@@ -134,11 +134,20 @@ export default class Geometry {
     this.locationMode = value;
   }
 
+  getLinkedBasePointId() {
+    return this.linkedBasePointId;
+  }
+
   setLinkedBasePointId(id) {
     this.linkedBasePointId = id;
   }
-  setLinkedTestPointId(id) {
-    this.linkedTestPointId = id;
+
+  getLinkedFixPointId() {
+    return this.linkedFixPointId;
+  }
+
+  setLinkedFixPointId(id) {
+    this.linkedFixPointId = id;
   }
 
   getLocationMode() {

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

@@ -13,6 +13,8 @@ export default class Line extends Geometry {
     this.endId = endId;
     this.category = Settings.selectLineCategory;
     this.locationMode = null;
+    this.linkedFixPointId = null;
+    this.linkedBasePointId = null;
     this.color = Style.SingleArrowLine.strokeStyle; //箭头类型会用到
     this.value = null; //测量线会用到
     this.geoType = VectorType.Line;

+ 1 - 9
src/graphic/Geometry/Point.js

@@ -10,8 +10,8 @@ export default class Point extends Geometry {
     this.y = null;
     this.parent = {};
     this.linkedBasePointId = null; //关联基准点
-    this.linkedTestPointId = null; //关联待测点
     this.locationMode = null; //如果该点是待测点,采用的定位法是哪种
+    this.linkedTextId = null; //固定点,关联文本
     this.category = Settings.selectPointCategory;
     this.geoType = VectorType.Point;
     this.setId(vectorId);
@@ -32,14 +32,6 @@ export default class Point extends Geometry {
     this.linkedBasePointId = pointId;
   }
 
-  setLinkedTestPointId(pointId) {
-    this.linkedTestPointId = pointId;
-  }
-
-  getLinkedTestPointId() {
-    return this.linkedTestPointId;
-  }
-
   //基准点:BasePoint
   setCategory(value) {
     if (!value) {

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

@@ -134,7 +134,6 @@ export default class History {
         let point = pointService.create(item.point, item.point.id);
         point.setCategory(item.point.category);
         point.setLinkedBasePointId(item.point.linkedBasePointId);
-        point.setLinkedTestPointId(item.point.linkedTestPointId);
         point.setLocationMode(item.point.locationMode);
         point.parent = JSON.parse(JSON.stringify(item.point.parent));
       } else if (item.handle == HistoryEvents.ModifyPoint) {
@@ -482,7 +481,6 @@ export default class History {
         let newPoint = pointService.create(item.point, item.point.id);
         newPoint.setCategory(item.point.category);
         newPoint.setLinkedBasePointId(item.point.linkedBasePointId);
-        newPoint.setLinkedTestPointId(item.point.linkedTestPointId);
         newPoint.setLocationMode(item.point.locationMode);
         historyUtil.assignPointFromPoint(newPoint, item.point);
       } else if (item.handle == HistoryEvents.DeletePoint) {

+ 15 - 5
src/graphic/History/HistoryUtil.js

@@ -15,7 +15,7 @@ export default class HistoryUtil {
       point1.category == point2.category &&
       point1.locationMode == point2.locationMode &&
       point1.linkedBasePointId == point2.linkedBasePointId &&
-      point1.linkedTestPointId == point2.linkedTestPointId
+      point1.linkedTextId == point2.linkedTextId
     ) {
       return false;
     } else {
@@ -29,6 +29,8 @@ export default class HistoryUtil {
       line1.endId == line2.endId &&
       line1.category == line2.category &&
       line1.locationMode == line2.locationMode &&
+      line1.linkedFixPointId == line2.linkedFixPointId &&
+      line1.linkedBasePointId == line2.linkedBasePointId &&
       line1.style == line2.style &&
       line1.weight == line2.weight
     ) {
@@ -82,7 +84,8 @@ export default class HistoryUtil {
       text1.value == text2.value &&
       text1.angle == text2.angle &&
       text1.fontSize == text2.fontSize &&
-      text1.color == text2.color
+      text1.color == text2.color &&
+      text1.linkedTextId == text2.linkedTextId
     ) {
       return false;
     } else {
@@ -342,7 +345,7 @@ export default class HistoryUtil {
     pointInfo.parent = JSON.parse(JSON.stringify(point2.parent));
     pointInfo.locationMode = point2.locationMode;
     pointInfo.linkedBasePointId = point2.linkedBasePointId;
-    pointInfo.linkedTestPointId = point2.linkedTestPointId;
+    pointInfo.linkedTextId == point2.linkedTextId;
     pointInfo.category = point2.category;
     this.setPointInfo(pointInfo);
   }
@@ -354,6 +357,8 @@ export default class HistoryUtil {
     lineInfo.end = line2.end;
     lineInfo.category = line2.category;
     lineInfo.locationMode = line2.locationMode;
+    lineInfo.linkedFixPointId = line2.linkedFixPointId;
+    lineInfo.linkedBasePointId = line2.linkedBasePointId;
     lineInfo.value = line2.value;
     lineInfo.style = line2.style;
     lineInfo.weight = line2.weight;
@@ -398,6 +403,7 @@ export default class HistoryUtil {
     textInfo.angle = text2.angle;
     textInfo.color = text2.color;
     textInfo.fontSize = text2.fontSize;
+    textInfo.linkedPointId = text2.linkedPointId;
     this.setTextInfo(textInfo);
   }
 
@@ -598,7 +604,6 @@ export default class HistoryUtil {
     data.category = point.category;
     data.locationMode = point.locationMode;
     data.linkedBasePointId = point.linkedBasePointId;
-    data.linkedTestPointId = point.linkedTestPointId;
     data.type = point.geoType;
     return data;
   }
@@ -610,6 +615,8 @@ export default class HistoryUtil {
     data.end = line.endId;
     data.category = line.category;
     data.locationMode = line.locationMode;
+    data.linkedFixPointId = line.linkedFixPointId;
+    data.linkedBasePointId = line.linkedBasePointId;
     data.type = line.geoType;
     data.style = line.style;
     data.weight = line.weight;
@@ -836,7 +843,7 @@ export default class HistoryUtil {
     point.category = pointInfo.category;
     point.locationMode = pointInfo.locationMode;
     point.linkedBasePointId = pointInfo.linkedBasePointId;
-    point.linkedTestPointId = pointInfo.linkedTestPointId;
+    point.linkedTextId = pointInfo.linkedTextId;
     return point;
   }
 
@@ -846,6 +853,8 @@ export default class HistoryUtil {
     line.endId = lineInfo.end;
     line.category = lineInfo.category;
     line.locationMode = lineInfo.locationMode;
+    line.linkedFixPointId = lineInfo.linkedFixPointId;
+    line.linkedBasePointId = lineInfo.linkedBasePointId;
     line.value = lineInfo.value;
     line.style = lineInfo.style;
     line.weight = lineInfo.weight;
@@ -893,6 +902,7 @@ export default class HistoryUtil {
     text.angle = textInfo.angle;
     text.fontSize = textInfo.fontSize;
     text.color = textInfo.color;
+    text.linkedPointId = textInfo.linkedPointId;
   }
 
   setMagnifierInfo(magnifierInfo) {

+ 6 - 2
src/graphic/ListenLayer.js

@@ -60,10 +60,14 @@ export default class ListenLayer {
       position,
       exceptVectorIds.exceptRoadPointId
     );
+    // selectInfo.pointInfo = this.isSelectPoint(
+    //   position,
+    //   exceptVectorIds.exceptPointId,
+    //   exceptVectorIds.exceptLineIds
+    // );
     selectInfo.pointInfo = this.isSelectPoint(
       position,
-      exceptVectorIds.exceptPointId,
-      exceptVectorIds.exceptLineIds
+      exceptVectorIds.exceptPointId
     );
     selectInfo.lineInfo = this.isSelectLine(
       position,

+ 9 - 1
src/graphic/Load.js

@@ -97,7 +97,7 @@ export default class Load {
           point.setDisplay(dataLocal.points[key].display);
           point.setLocationMode(dataLocal.points[key].locationMode);
           point.setLinkedBasePointId(dataLocal.points[key].linkedBasePointId);
-          point.setLinkedTestPointId(dataLocal.points[key].linkedTestPointId);
+          point.linkedTextId == dataLocal.points[key].linkedTextId;
         }
 
         // let points = dataService.vectorData.points;
@@ -149,6 +149,13 @@ export default class Load {
           if (dataLocal.lines[key].locationMode) {
             line.setLocationMode(dataLocal.lines[key].locationMode);
           }
+          if (dataLocal.lines[key].linkedFixPointId) {
+            line.setLinkedFixPointId(dataLocal.lines[key].linkedFixPointId);
+          }
+          if (dataLocal.lines[key].linkedBasePointId) {
+            line.setLinkedBasePointId(dataLocal.lines[key].linkedBasePointId);
+          }
+
           line.setDisplay(dataLocal.lines[key].display);
           if (line.getCategory() == VectorCategory.Line.BaseLine) {
             Settings.baseLineId = key;
@@ -355,6 +362,7 @@ export default class Load {
           text.setColor(dataLocal.texts[key].color);
           text.setDisplay(dataLocal.texts[key].display);
           text.setAngle(dataLocal.texts[key].angle || 0);
+          text.linkedPointId = dataLocal.texts[key].linkedPointId;
         }
       }
 

+ 4 - 2
src/graphic/Service/DataService.js

@@ -142,7 +142,8 @@ export class DataService {
     delete startParent[lineId];
     if (
       Object.keys(startParent).length == 0 &&
-      start.getCategory() != VectorCategory.Point.BasePoint
+      start.getCategory() != VectorCategory.Point.BasePoint &&
+      start.getCategory() != VectorCategory.Point.FixPoint
     ) {
       this.deletePoint(line.startId);
     }
@@ -154,7 +155,8 @@ export class DataService {
 
       if (
         Object.keys(endParent).length == 0 &&
-        end.getCategory() != VectorCategory.Point.BasePoint
+        end.getCategory() != VectorCategory.Point.BasePoint &&
+        end.getCategory() != VectorCategory.Point.FixPoint
       ) {
         this.deletePoint(line.endId);
       }

+ 43 - 22
src/graphic/Service/PointService.js

@@ -58,9 +58,7 @@ export default class PointService {
       ) {
         this.deleteTestPoint(pointId);
       } else if (category == VectorCategory.Point.FixPoint) {
-        let textId = point.linkedTextId;
-        dataService.deletePoint(pointId); //暂时简单粗暴
-        dataService.deleteText(textId);
+        this.deleteFixPoint(pointId);
       }
     }
   }
@@ -73,32 +71,57 @@ export default class PointService {
       }
     }
   }
+  // deleteBasePoint(basePointId) {
+  //   let points = dataService.getPoints();
+  //   let needDeletePointIds = [];
+  //   for (let key in points) {
+  //     let point = dataService.getPoint(key);
+  //     if (point.vectorId == basePointId) {
+  //       needDeletePointIds.push(basePointId);
+  //     } else if (point.linkedBasePointId == basePointId) {
+  //       needDeletePointIds.push(key);
+  //     }
+  //   }
+  //   let lines = dataService.getLines();
+  //   for (let key in lines) {
+  //     let line = dataService.getLine(key);
+  //     if (
+  //       needDeletePointIds.indexOf(line.startId) > -1 ||
+  //       needDeletePointIds.indexOf(line.endId) > -1
+  //     ) {
+  //       dataService.deleteLine(key);
+  //     }
+  //   }
+  //   dataService.deletePoint(basePointId);
+  //   if (Settings.selectBasePointId == basePointId) {
+  //     Settings.selectBasePointId = null;
+  //   }
+  //   this.updateBasePointIds();
+  // }
+
   deleteBasePoint(basePointId) {
-    let points = dataService.getPoints();
-    let needDeletePointIds = [];
-    for (let key in points) {
-      let point = dataService.getPoint(key);
-      if (point.vectorId == basePointId) {
-        needDeletePointIds.push(basePointId);
-      } else if (point.linkedBasePointId == basePointId) {
-        needDeletePointIds.push(key);
-      }
-    }
     let lines = dataService.getLines();
     for (let key in lines) {
       let line = dataService.getLine(key);
-      if (
-        needDeletePointIds.indexOf(line.startId) > -1 ||
-        needDeletePointIds.indexOf(line.endId) > -1
-      ) {
+      if (line.getLinkedBasePointId() == basePointId) {
         dataService.deleteLine(key);
       }
     }
     dataService.deletePoint(basePointId);
-    if (Settings.selectBasePointId == basePointId) {
-      Settings.selectBasePointId = null;
+  }
+
+  deleteFixPoint(fixPointId) {
+    let lines = dataService.getLines();
+    for (let key in lines) {
+      let line = dataService.getLine(key);
+      if (line.getLinkedFixPointId() == fixPointId) {
+        dataService.deleteLine(key);
+      }
     }
-    this.updateBasePointIds();
+    let fixPoint = dataService.getPoint(fixPointId);
+    let textId = fixPoint.linkedTextId;
+    dataService.deletePoint(fixPointId);
+    dataService.deleteText(textId);
   }
 
   deleteTestPoint(testPointId) {
@@ -111,8 +134,6 @@ export default class PointService {
       }
       if (point.vectorId == testPointId) {
         needDeletePointIds.push(testPointId);
-      } else if (point.linkedTestPointId == testPointId) {
-        needDeletePointIds.push(key);
       }
     }
     let lines = dataService.getLines();

+ 4 - 0
src/graphic/Service/UIService.js

@@ -170,6 +170,10 @@ export default class UIService {
     Settings.wayType = value;
   }
 
+  setSelectBasePointId(value) {
+    Settings.selectBasePointId = value;
+  }
+
   setSingleRoadDrivewayCount(value) {
     Settings.singleRoadDrivewayCount = value;
   }

+ 4 - 0
后续要继续做的内容.txt

@@ -0,0 +1,4 @@
+1. 定位法
+2. res和ratio要合并到res中
+3. ListenLayer的细节
+4. 删除线,点,路的时候,关联的删除