|
@@ -1,16 +1,16 @@
|
|
|
-import { dataService } from '../Service/DataService';
|
|
|
-import { lineService } from '../Service/LineService';
|
|
|
-import { pointService } from '../Service/PointService';
|
|
|
-import VectorCategory from '../enum/VectorCategory';
|
|
|
-import Point from '../Geometry/Point.js';
|
|
|
-import { mathUtil } from '../Util/MathUtil';
|
|
|
-import addLine from './AddLine';
|
|
|
-import Settings from '../Settings';
|
|
|
-import { stateService } from '../Service/StateService';
|
|
|
-import LayerEvents from '../enum/LayerEvents';
|
|
|
-import VectorType from '../enum/VectorType';
|
|
|
-import Constant from '../Constant';
|
|
|
-import { listenLayer } from '../ListenLayer';
|
|
|
+import { dataService } from "../Service/DataService";
|
|
|
+import { lineService } from "../Service/LineService";
|
|
|
+import { pointService } from "../Service/PointService";
|
|
|
+import VectorCategory from "../enum/VectorCategory";
|
|
|
+import Point from "../Geometry/Point.js";
|
|
|
+import { mathUtil } from "../Util/MathUtil";
|
|
|
+import addLine from "./AddLine";
|
|
|
+import Settings from "../Settings";
|
|
|
+import { stateService } from "../Service/StateService";
|
|
|
+import LayerEvents from "../enum/LayerEvents";
|
|
|
+import VectorType from "../enum/VectorType";
|
|
|
+import Constant from "../Constant";
|
|
|
+import { listenLayer } from "../ListenLayer";
|
|
|
|
|
|
export default class AddPoint {
|
|
|
constructor() {
|
|
@@ -19,7 +19,11 @@ export default class AddPoint {
|
|
|
|
|
|
buildPoint(position) {
|
|
|
//只有一个基准点的时候,测量的时候自动选择基准点
|
|
|
- if ((Settings.selectLocationMode == Constant.angleLocationMode || Settings.selectLocationMode == Constant.allLocationMode) && Settings.basePointIds.length == 1) {
|
|
|
+ if (
|
|
|
+ (Settings.selectLocationMode == Constant.angleLocationMode ||
|
|
|
+ Settings.selectLocationMode == Constant.allLocationMode) &&
|
|
|
+ Settings.basePointIds.length == 1
|
|
|
+ ) {
|
|
|
Settings.selectBasePointId = Settings.basePointIds[0];
|
|
|
}
|
|
|
let newPoint;
|
|
@@ -27,28 +31,43 @@ export default class AddPoint {
|
|
|
newPoint = pointService.create(position);
|
|
|
Settings.selectBasePointId = newPoint.vectorId;
|
|
|
} else {
|
|
|
- if (Settings.selectBasePointId != null && Settings.selectLocationMode == Constant.angleLocationMode) {
|
|
|
+ if (
|
|
|
+ Settings.selectBasePointId != null &&
|
|
|
+ Settings.selectLocationMode == Constant.angleLocationMode
|
|
|
+ ) {
|
|
|
newPoint = pointService.create(position);
|
|
|
this.setLocationByAngle(newPoint.vectorId);
|
|
|
newPoint.setLocationMode(Constant.angleLocationMode);
|
|
|
stateService.setEventName(LayerEvents.AddPoint);
|
|
|
- } else if (Settings.selectBasePointId != null && Settings.selectLocationMode == Constant.allLocationMode) {
|
|
|
+ } else if (
|
|
|
+ Settings.selectBasePointId != null &&
|
|
|
+ Settings.selectLocationMode == Constant.allLocationMode
|
|
|
+ ) {
|
|
|
newPoint = pointService.create(position);
|
|
|
this.setLocationByAll(newPoint.vectorId);
|
|
|
newPoint.setLocationMode(Constant.allLocationMode);
|
|
|
stateService.setEventName(LayerEvents.AddPoint);
|
|
|
- } else if (Settings.baseLineId != null && Settings.selectLocationMode == Constant.normalLocationMode) {
|
|
|
+ } else if (
|
|
|
+ Settings.baseLineId != null &&
|
|
|
+ Settings.selectLocationMode == Constant.normalLocationMode
|
|
|
+ ) {
|
|
|
newPoint = pointService.create(position);
|
|
|
this.setLocationByNormal(newPoint.vectorId);
|
|
|
newPoint.setLocationMode(Constant.normalLocationMode);
|
|
|
|
|
|
stateService.setEventName(LayerEvents.AddPoint);
|
|
|
- } else if (Settings.selectBasePointId == null && (Settings.selectLocationMode == Constant.angleLocationMode || Settings.selectLocationMode == Constant.allLocationMode)) {
|
|
|
+ } else if (
|
|
|
+ Settings.selectBasePointId == null &&
|
|
|
+ (Settings.selectLocationMode == Constant.angleLocationMode ||
|
|
|
+ Settings.selectLocationMode == Constant.allLocationMode)
|
|
|
+ ) {
|
|
|
return null;
|
|
|
}
|
|
|
if (
|
|
|
newPoint &&
|
|
|
- (newPoint.getLocationMode() == Constant.allLocationMode || newPoint.getLocationMode() == Constant.angleLocationMode || newPoint.getLocationMode() == Constant.normalLocationMode) &&
|
|
|
+ (newPoint.getLocationMode() == Constant.allLocationMode ||
|
|
|
+ newPoint.getLocationMode() == Constant.angleLocationMode ||
|
|
|
+ newPoint.getLocationMode() == Constant.normalLocationMode) &&
|
|
|
newPoint.getCategory() == VectorCategory.Point.TestPoint
|
|
|
) {
|
|
|
this.testPointIds.push(newPoint.vectorId);
|
|
@@ -58,6 +77,24 @@ export default class AddPoint {
|
|
|
return newPoint;
|
|
|
}
|
|
|
|
|
|
+ //添加固定点/基准点
|
|
|
+ buildPoint2(position) {
|
|
|
+ let newPoint = null;
|
|
|
+ if (listenLayer.modifyPoint && listenLayer.modifyPoint.linkedPointId) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ if (Settings.selectPointCategory == VectorCategory.Point.BasePoint) {
|
|
|
+ newPoint = pointService.create(position);
|
|
|
+ Settings.selectBasePointId = newPoint.vectorId;
|
|
|
+ stateService.setEventName(LayerEvents.AddPoint);
|
|
|
+ } else if (Settings.selectPointCategory == VectorCategory.Point.FixPoint) {
|
|
|
+ newPoint = pointService.create(position);
|
|
|
+ stateService.setEventName(LayerEvents.AddPoint);
|
|
|
+ }
|
|
|
+ listenLayer.clear();
|
|
|
+ return newPoint;
|
|
|
+ }
|
|
|
+
|
|
|
isFocusBasePoint() {
|
|
|
if (Settings.selectBasePointId) {
|
|
|
let point = dataService.getPoint(Settings.selectBasePointId);
|
|
@@ -90,9 +127,17 @@ export default class AddPoint {
|
|
|
join.setLocationMode(Constant.angleLocationMode);
|
|
|
join.setLinkedBasePointId(basePoint.vectorId);
|
|
|
join.setLinkedTestPointId(testPointId);
|
|
|
- let guidePositionLine = lineService.createByPointId(testPointId, join.vectorId, VectorCategory.Line.GuidePositionLine);
|
|
|
+ let guidePositionLine = lineService.createByPointId(
|
|
|
+ testPointId,
|
|
|
+ join.vectorId,
|
|
|
+ VectorCategory.Line.GuidePositionLine
|
|
|
+ );
|
|
|
|
|
|
- let positionLine = lineService.createByPointId(basePoint.vectorId, join.vectorId, VectorCategory.Line.PositionLine);
|
|
|
+ let positionLine = lineService.createByPointId(
|
|
|
+ basePoint.vectorId,
|
|
|
+ join.vectorId,
|
|
|
+ VectorCategory.Line.PositionLine
|
|
|
+ );
|
|
|
guidePositionLine.setLocationMode(Constant.angleLocationMode);
|
|
|
positionLine.setLocationMode(Constant.angleLocationMode);
|
|
|
join.setCategory(VectorCategory.Point.TestBasePoint);
|
|
@@ -118,15 +163,29 @@ export default class AddPoint {
|
|
|
join.setLinkedBasePointId(basePoint.vectorId);
|
|
|
join.setLinkedTestPointId(testPointId);
|
|
|
//待测点与基准线的垂直线
|
|
|
- lineService.createByPointId(testPointId, join.vectorId, VectorCategory.Line.PositionLine);
|
|
|
+ lineService.createByPointId(
|
|
|
+ testPointId,
|
|
|
+ join.vectorId,
|
|
|
+ VectorCategory.Line.PositionLine
|
|
|
+ );
|
|
|
//暂时没有其他待测点
|
|
|
if (this.testPointIds.length == 0) {
|
|
|
//待测点与基准线点的连线
|
|
|
- lineService.createByPointId(basePoint.vectorId, testPointId, VectorCategory.Line.PositionLine);
|
|
|
+ lineService.createByPointId(
|
|
|
+ basePoint.vectorId,
|
|
|
+ testPointId,
|
|
|
+ VectorCategory.Line.PositionLine
|
|
|
+ );
|
|
|
} else {
|
|
|
//取上一个待测点
|
|
|
- lineService.createByPointId(this.testPointIds[this.testPointIds.length - 1], testPointId, VectorCategory.Line.PositionLine);
|
|
|
- testPoint.setLinkedTestPointId(this.testPointIds[this.testPointIds.length - 1]);
|
|
|
+ lineService.createByPointId(
|
|
|
+ this.testPointIds[this.testPointIds.length - 1],
|
|
|
+ testPointId,
|
|
|
+ VectorCategory.Line.PositionLine
|
|
|
+ );
|
|
|
+ testPoint.setLinkedTestPointId(
|
|
|
+ this.testPointIds[this.testPointIds.length - 1]
|
|
|
+ );
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -148,7 +207,11 @@ export default class AddPoint {
|
|
|
join.setCategory(VectorCategory.Point.TestBasePoint);
|
|
|
join.setLocationMode(Constant.normalLocationMode);
|
|
|
join.setLinkedTestPointId(testPointId);
|
|
|
- lineService.createByPointId(testPointId, join.vectorId, VectorCategory.Line.PositionLine);
|
|
|
+ lineService.createByPointId(
|
|
|
+ testPointId,
|
|
|
+ join.vectorId,
|
|
|
+ VectorCategory.Line.PositionLine
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
deleteTestPoints() {
|
|
@@ -158,7 +221,7 @@ export default class AddPoint {
|
|
|
this.testPointIds = [];
|
|
|
}
|
|
|
|
|
|
- resetTestPoints(){
|
|
|
+ resetTestPoints() {
|
|
|
this.testPointIds = [];
|
|
|
}
|
|
|
}
|