|
@@ -1,9 +1,10 @@
|
|
-import Constant from "../Constant";
|
|
|
|
-import { dataService } from "../Service/DataService";
|
|
|
|
-import { lineService } from "../Service/LineService";
|
|
|
|
-import { pointService } from "../Service/PointService";
|
|
|
|
-import { mathUtil } from "../Util/MathUtil";
|
|
|
|
-import VectorCategory from "../enum/VectorCategory";
|
|
|
|
|
|
+import Constant from '../Constant';
|
|
|
|
+import { dataService } from '../Service/DataService';
|
|
|
|
+import { lineService } from '../Service/LineService';
|
|
|
|
+import { pointService } from '../Service/PointService';
|
|
|
|
+import { movePoint } from './MovePoint';
|
|
|
|
+import { mathUtil } from '../Util/MathUtil';
|
|
|
|
+import VectorCategory from '../enum/VectorCategory';
|
|
|
|
|
|
export default class MoveLine {
|
|
export default class MoveLine {
|
|
constructor() {}
|
|
constructor() {}
|
|
@@ -16,10 +17,7 @@ export default class MoveLine {
|
|
let endPoint = dataService.getPoint(line.endId);
|
|
let endPoint = dataService.getPoint(line.endId);
|
|
|
|
|
|
//垂直移动
|
|
//垂直移动
|
|
- if (
|
|
|
|
- line.getCategory() == VectorCategory.Line.PositionLine &&
|
|
|
|
- line.getLocationMode() == Constant.angleLocationMode
|
|
|
|
- ) {
|
|
|
|
|
|
+ if (line.getCategory() == VectorCategory.Line.PositionLine && line.getLocationMode() == Constant.angleLocationMode) {
|
|
let point1 = {
|
|
let point1 = {
|
|
x: startPoint.x + dx,
|
|
x: startPoint.x + dx,
|
|
y: startPoint.y + dy,
|
|
y: startPoint.y + dy,
|
|
@@ -37,29 +35,21 @@ export default class MoveLine {
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
let newStartPoint = pointService.create(point1);
|
|
let newStartPoint = pointService.create(point1);
|
|
- let extendedPositionLine = lineService.createByPointId(
|
|
|
|
- startPoint.vectorId,
|
|
|
|
- newStartPoint.vectorId,
|
|
|
|
- VectorCategory.Line.ExtendedPositionLine
|
|
|
|
- );
|
|
|
|
|
|
+ let extendedPositionLine = lineService.createByPointId(startPoint.vectorId, newStartPoint.vectorId, VectorCategory.Line.ExtendedPositionLine);
|
|
extendedPositionLine.setLocationMode(Constant.angleLocationMode);
|
|
extendedPositionLine.setLocationMode(Constant.angleLocationMode);
|
|
dataService.deletePointParent(startPoint.vectorId, lineId);
|
|
dataService.deletePointParent(startPoint.vectorId, lineId);
|
|
line.startId = newStartPoint.vectorId;
|
|
line.startId = newStartPoint.vectorId;
|
|
- newStartPoint.setPointParent(line.vectorId, "start");
|
|
|
|
|
|
+ newStartPoint.setPointParent(line.vectorId, 'start');
|
|
newStartPoint.setCategory(VectorCategory.Point.TestBasePoint);
|
|
newStartPoint.setCategory(VectorCategory.Point.TestBasePoint);
|
|
} else {
|
|
} else {
|
|
startPoint.x = point1.x;
|
|
startPoint.x = point1.x;
|
|
startPoint.y = point1.y;
|
|
startPoint.y = point1.y;
|
|
let parents = Object.keys(startPoint.parent);
|
|
let parents = Object.keys(startPoint.parent);
|
|
let extendedLine = dataService.getLine(parents[0]);
|
|
let extendedLine = dataService.getLine(parents[0]);
|
|
- if (
|
|
|
|
- extendedLine.getCategory() != VectorCategory.Line.ExtendedPositionLine
|
|
|
|
- ) {
|
|
|
|
|
|
+ if (extendedLine.getCategory() != VectorCategory.Line.ExtendedPositionLine) {
|
|
extendedLine = dataService.getLine(parents[1]);
|
|
extendedLine = dataService.getLine(parents[1]);
|
|
}
|
|
}
|
|
- if (
|
|
|
|
- extendedLine.getCategory() == VectorCategory.Line.ExtendedPositionLine
|
|
|
|
- ) {
|
|
|
|
|
|
+ if (extendedLine.getCategory() == VectorCategory.Line.ExtendedPositionLine) {
|
|
//point1是基准点
|
|
//point1是基准点
|
|
point1 = dataService.getPoint(extendedLine.startId);
|
|
point1 = dataService.getPoint(extendedLine.startId);
|
|
point2 = dataService.getPoint(extendedLine.endId);
|
|
point2 = dataService.getPoint(extendedLine.endId);
|
|
@@ -68,7 +58,7 @@ export default class MoveLine {
|
|
dataService.deletePoint(extendedLine.endId);
|
|
dataService.deletePoint(extendedLine.endId);
|
|
|
|
|
|
line.startId = point1.vectorId;
|
|
line.startId = point1.vectorId;
|
|
- point1.setPointParent(line.vectorId, "start");
|
|
|
|
|
|
+ point1.setPointParent(line.vectorId, 'start');
|
|
|
|
|
|
lineGeometry = mathUtil.createLine3(lineGeometry, point1);
|
|
lineGeometry = mathUtil.createLine3(lineGeometry, point1);
|
|
}
|
|
}
|
|
@@ -79,6 +69,15 @@ export default class MoveLine {
|
|
endPoint.x = point2.x;
|
|
endPoint.x = point2.x;
|
|
endPoint.y = point2.y;
|
|
endPoint.y = point2.y;
|
|
} else {
|
|
} else {
|
|
|
|
+ //综合定位和垂线定位,拖动基准线更新位置
|
|
|
|
+ if (line.getCategory() == VectorCategory.Line.BaseLine) {
|
|
|
|
+ let points = dataService.vectorData.points;
|
|
|
|
+ for (let key in points) {
|
|
|
|
+ if (points[key].category == VectorCategory.Point.TestPoint && (points[key].locationMode == Constant.allLocationMode || points[key].locationMode == Constant.normalLocationMode)) {
|
|
|
|
+ movePoint.updatePositionByTestPoint(points[key].vectorId);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
startPoint.x += dx;
|
|
startPoint.x += dx;
|
|
startPoint.y += dy;
|
|
startPoint.y += dy;
|
|
endPoint.x += dx;
|
|
endPoint.x += dx;
|