|
@@ -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 {
|
|
export default class AddPoint {
|
|
constructor() {
|
|
constructor() {
|
|
@@ -18,48 +18,36 @@ export default class AddPoint {
|
|
}
|
|
}
|
|
|
|
|
|
buildPoint(position) {
|
|
buildPoint(position) {
|
|
|
|
+ if ((Settings.selectLocationMode == Constant.angleLocationMode || Settings.selectLocationMode == Constant.allLocationMode) && Settings.basePointIds.length == 1) {
|
|
|
|
+ Settings.selectBasePointId = Settings.basePointIds[0];
|
|
|
|
+ }
|
|
let newPoint;
|
|
let newPoint;
|
|
if (Settings.selectPointCategory == VectorCategory.Point.BasePoint) {
|
|
if (Settings.selectPointCategory == VectorCategory.Point.BasePoint) {
|
|
newPoint = pointService.create(position);
|
|
newPoint = pointService.create(position);
|
|
Settings.selectBasePointId = newPoint.vectorId;
|
|
Settings.selectBasePointId = newPoint.vectorId;
|
|
} else {
|
|
} else {
|
|
- if (
|
|
|
|
- Settings.selectBasePointId != null &&
|
|
|
|
- Settings.selectLocationMode == Constant.angleLocationMode
|
|
|
|
- ) {
|
|
|
|
|
|
+ if (Settings.selectBasePointId != null && Settings.selectLocationMode == Constant.angleLocationMode) {
|
|
newPoint = pointService.create(position);
|
|
newPoint = pointService.create(position);
|
|
this.setLocationByAngle(newPoint.vectorId);
|
|
this.setLocationByAngle(newPoint.vectorId);
|
|
newPoint.setLocationMode(Constant.angleLocationMode);
|
|
newPoint.setLocationMode(Constant.angleLocationMode);
|
|
stateService.setEventName(LayerEvents.AddPoint);
|
|
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);
|
|
newPoint = pointService.create(position);
|
|
this.setLocationByAll(newPoint.vectorId);
|
|
this.setLocationByAll(newPoint.vectorId);
|
|
newPoint.setLocationMode(Constant.allLocationMode);
|
|
newPoint.setLocationMode(Constant.allLocationMode);
|
|
stateService.setEventName(LayerEvents.AddPoint);
|
|
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);
|
|
newPoint = pointService.create(position);
|
|
this.setLocationByNormal(newPoint.vectorId);
|
|
this.setLocationByNormal(newPoint.vectorId);
|
|
newPoint.setLocationMode(Constant.normalLocationMode);
|
|
newPoint.setLocationMode(Constant.normalLocationMode);
|
|
|
|
|
|
stateService.setEventName(LayerEvents.AddPoint);
|
|
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;
|
|
return null;
|
|
}
|
|
}
|
|
if (
|
|
if (
|
|
newPoint &&
|
|
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
|
|
newPoint.getCategory() == VectorCategory.Point.TestPoint
|
|
) {
|
|
) {
|
|
this.testPointIds.push(newPoint.vectorId);
|
|
this.testPointIds.push(newPoint.vectorId);
|
|
@@ -101,17 +89,9 @@ export default class AddPoint {
|
|
join.setLocationMode(Constant.angleLocationMode);
|
|
join.setLocationMode(Constant.angleLocationMode);
|
|
join.setLinkedBasePointId(basePoint.vectorId);
|
|
join.setLinkedBasePointId(basePoint.vectorId);
|
|
join.setLinkedTestPointId(testPointId);
|
|
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);
|
|
guidePositionLine.setLocationMode(Constant.angleLocationMode);
|
|
positionLine.setLocationMode(Constant.angleLocationMode);
|
|
positionLine.setLocationMode(Constant.angleLocationMode);
|
|
join.setCategory(VectorCategory.Point.TestBasePoint);
|
|
join.setCategory(VectorCategory.Point.TestBasePoint);
|
|
@@ -137,29 +117,15 @@ export default class AddPoint {
|
|
join.setLinkedBasePointId(basePoint.vectorId);
|
|
join.setLinkedBasePointId(basePoint.vectorId);
|
|
join.setLinkedTestPointId(testPointId);
|
|
join.setLinkedTestPointId(testPointId);
|
|
//待测点与基准线的垂直线
|
|
//待测点与基准线的垂直线
|
|
- lineService.createByPointId(
|
|
|
|
- testPointId,
|
|
|
|
- join.vectorId,
|
|
|
|
- VectorCategory.Line.PositionLine
|
|
|
|
- );
|
|
|
|
|
|
+ lineService.createByPointId(testPointId, join.vectorId, VectorCategory.Line.PositionLine);
|
|
//暂时没有其他待测点
|
|
//暂时没有其他待测点
|
|
if (this.testPointIds.length == 0) {
|
|
if (this.testPointIds.length == 0) {
|
|
//待测点与基准线点的连线
|
|
//待测点与基准线点的连线
|
|
- lineService.createByPointId(
|
|
|
|
- basePoint.vectorId,
|
|
|
|
- testPointId,
|
|
|
|
- VectorCategory.Line.PositionLine
|
|
|
|
- );
|
|
|
|
|
|
+ lineService.createByPointId(basePoint.vectorId, testPointId, VectorCategory.Line.PositionLine);
|
|
} else {
|
|
} 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]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -181,11 +147,7 @@ export default class AddPoint {
|
|
join.setCategory(VectorCategory.Point.TestBasePoint);
|
|
join.setCategory(VectorCategory.Point.TestBasePoint);
|
|
join.setLocationMode(Constant.normalLocationMode);
|
|
join.setLocationMode(Constant.normalLocationMode);
|
|
join.setLinkedTestPointId(testPointId);
|
|
join.setLinkedTestPointId(testPointId);
|
|
- lineService.createByPointId(
|
|
|
|
- testPointId,
|
|
|
|
- join.vectorId,
|
|
|
|
- VectorCategory.Line.PositionLine
|
|
|
|
- );
|
|
|
|
|
|
+ lineService.createByPointId(testPointId, join.vectorId, VectorCategory.Line.PositionLine);
|
|
}
|
|
}
|
|
|
|
|
|
deleteTestPoints() {
|
|
deleteTestPoints() {
|