|
@@ -19,68 +19,8 @@ export default class AddPoint {
|
|
|
this.testPointIds = []; //所有待测点
|
|
|
}
|
|
|
|
|
|
- buildPoint(position) {
|
|
|
- //只有一个基准点的时候,测量的时候自动选择基准点
|
|
|
- if (
|
|
|
- (Settings.selectLocationMode == Constant.angleLocationMode ||
|
|
|
- Settings.selectLocationMode == Constant.allLocationMode) &&
|
|
|
- Settings.basePointIds.length == 1
|
|
|
- ) {
|
|
|
- Settings.selectBasePointId = Settings.basePointIds[0];
|
|
|
- }
|
|
|
- let newPoint;
|
|
|
- if (Settings.selectPointCategory == VectorCategory.Point.BasePoint) {
|
|
|
- newPoint = pointService.create(position);
|
|
|
- Settings.selectBasePointId = newPoint.vectorId;
|
|
|
- } else {
|
|
|
- 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
|
|
|
- ) {
|
|
|
- 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
|
|
|
- ) {
|
|
|
- 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)
|
|
|
- ) {
|
|
|
- return null;
|
|
|
- }
|
|
|
- if (
|
|
|
- newPoint &&
|
|
|
- (newPoint.getLocationMode() == Constant.allLocationMode ||
|
|
|
- newPoint.getLocationMode() == Constant.angleLocationMode ||
|
|
|
- newPoint.getLocationMode() == Constant.normalLocationMode) &&
|
|
|
- newPoint.getCategory() == VectorCategory.Point.TestPoint
|
|
|
- ) {
|
|
|
- this.testPointIds.push(newPoint.vectorId);
|
|
|
- }
|
|
|
- }
|
|
|
- listenLayer.clear();
|
|
|
- return newPoint;
|
|
|
- }
|
|
|
-
|
|
|
//添加固定点/基准点
|
|
|
- buildPoint2(position) {
|
|
|
+ buildPoint(position) {
|
|
|
let newPoint = null;
|
|
|
if (listenLayer.modifyPoint && listenLayer.modifyPoint.linkedPointId) {
|
|
|
return null;
|
|
@@ -112,109 +52,6 @@ export default class AddPoint {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- //直角定位法
|
|
|
- setLocationByAngle(testPointId) {
|
|
|
- let basePoint = this.isFocusBasePoint();
|
|
|
- if (!basePoint) {
|
|
|
- return;
|
|
|
- }
|
|
|
- let testPoint = dataService.getPoint(testPointId);
|
|
|
- if (testPoint.getCategory() != VectorCategory.Point.TestPoint) {
|
|
|
- return;
|
|
|
- }
|
|
|
- testPoint.setLinkedBasePointId(basePoint.vectorId);
|
|
|
- let lineGeometry = dataService.getLine(Settings.baseLineId);
|
|
|
- let startPoint = dataService.getPoint(lineGeometry.startId);
|
|
|
- let endPoint = dataService.getPoint(lineGeometry.endId);
|
|
|
- let line = mathUtil.createLine1(startPoint, endPoint);
|
|
|
- let vLine = mathUtil.getVerticalLine(line, testPoint);
|
|
|
- let join = mathUtil.getJoinLinePoint(basePoint, vLine);
|
|
|
- join = pointService.create(join);
|
|
|
- join.setCategory(VectorCategory.Point.TestBasePoint);
|
|
|
- join.setLocationMode(Constant.angleLocationMode);
|
|
|
- join.setLinkedBasePointId(basePoint.vectorId);
|
|
|
- let guidePositionLine = lineService.createByPointId(
|
|
|
- testPointId,
|
|
|
- join.vectorId,
|
|
|
- VectorCategory.Line.GuidePositionLine
|
|
|
- );
|
|
|
-
|
|
|
- let positionLine = lineService.createByPointId(
|
|
|
- basePoint.vectorId,
|
|
|
- join.vectorId,
|
|
|
- VectorCategory.Line.PositionLine
|
|
|
- );
|
|
|
- guidePositionLine.setLocationMode(Constant.angleLocationMode);
|
|
|
- positionLine.setLocationMode(Constant.angleLocationMode);
|
|
|
- join.setCategory(VectorCategory.Point.TestBasePoint);
|
|
|
- }
|
|
|
-
|
|
|
- //综合定位法
|
|
|
- setLocationByAll(testPointId) {
|
|
|
- let basePoint = this.isFocusBasePoint();
|
|
|
- if (!basePoint) {
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- let testPoint = dataService.getPoint(testPointId);
|
|
|
- testPoint.setLinkedBasePointId(basePoint.vectorId);
|
|
|
- let lineGeometry = dataService.getLine(Settings.baseLineId);
|
|
|
- let startPoint = dataService.getPoint(lineGeometry.startId);
|
|
|
- let endPoint = dataService.getPoint(lineGeometry.endId);
|
|
|
- let line = mathUtil.createLine1(startPoint, endPoint);
|
|
|
- let join = mathUtil.getJoinLinePoint(testPoint, line);
|
|
|
- join = pointService.create(join); //经过待测点且与基准线垂直的线段,与基准线的交点
|
|
|
- join.setCategory(VectorCategory.Point.TestBasePoint);
|
|
|
- join.setLocationMode(Constant.allLocationMode);
|
|
|
- join.setLinkedBasePointId(basePoint.vectorId);
|
|
|
- //待测点与基准线的垂直线
|
|
|
- lineService.createByPointId(
|
|
|
- testPointId,
|
|
|
- join.vectorId,
|
|
|
- VectorCategory.Line.PositionLine
|
|
|
- );
|
|
|
- //暂时没有其他待测点
|
|
|
- if (this.testPointIds.length == 0) {
|
|
|
- //待测点与基准线点的连线
|
|
|
- lineService.createByPointId(
|
|
|
- basePoint.vectorId,
|
|
|
- testPointId,
|
|
|
- VectorCategory.Line.PositionLine
|
|
|
- );
|
|
|
- } else {
|
|
|
- //取上一个待测点
|
|
|
- lineService.createByPointId(
|
|
|
- this.testPointIds[this.testPointIds.length - 1],
|
|
|
- testPointId,
|
|
|
- VectorCategory.Line.PositionLine
|
|
|
- );
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- setLocationByNormal(testPointId) {
|
|
|
- let testPoint = dataService.getPoint(testPointId);
|
|
|
- if (testPoint.getCategory() != VectorCategory.Point.TestPoint) {
|
|
|
- return;
|
|
|
- }
|
|
|
- if (!Settings.baseLineId) {
|
|
|
- return;
|
|
|
- }
|
|
|
- let lineGeometry = dataService.getLine(Settings.baseLineId);
|
|
|
- let startPoint = dataService.getPoint(lineGeometry.startId);
|
|
|
- let endPoint = dataService.getPoint(lineGeometry.endId);
|
|
|
- let line = mathUtil.createLine1(startPoint, endPoint);
|
|
|
- let vLine = mathUtil.getVerticalLine(line, testPoint);
|
|
|
- let join = mathUtil.getIntersectionPoint(vLine, line);
|
|
|
- join = pointService.create(join);
|
|
|
- join.setCategory(VectorCategory.Point.TestBasePoint);
|
|
|
- join.setLocationMode(Constant.normalLocationMode);
|
|
|
- lineService.createByPointId(
|
|
|
- testPointId,
|
|
|
- join.vectorId,
|
|
|
- VectorCategory.Line.PositionLine
|
|
|
- );
|
|
|
- }
|
|
|
-
|
|
|
deleteTestPoints() {
|
|
|
for (let i = 0; i < this.testPointIds.length; ++i) {
|
|
|
pointService.deletePoint(this.testPointIds[i]);
|