|
@@ -66,49 +66,7 @@ export default class MoveRoad {
|
|
|
point.setPosition(position);
|
|
|
}
|
|
|
|
|
|
- // let newPosition = null;
|
|
|
if (modifyPoint == null) {
|
|
|
- // //90°或者180°纠正
|
|
|
- // //不考虑当前角度
|
|
|
-
|
|
|
- // //当前点的parent只有一个,考虑邻居点
|
|
|
- // let neighPoints = roadService.getNeighPoints(pointId);
|
|
|
- // if (neighPoints.length == 1) {
|
|
|
- // newPosition = elementService.checkAngle(
|
|
|
- // position,
|
|
|
- // neighPoints[0].vectorId,
|
|
|
- // pointId
|
|
|
- // );
|
|
|
- // }
|
|
|
- // //当前点的parent有两个
|
|
|
- // else if (neighPoints.length == 2) {
|
|
|
- // newPosition = elementService.checkAngle(
|
|
|
- // position,
|
|
|
- // neighPoints[0].vectorId,
|
|
|
- // pointId
|
|
|
- // );
|
|
|
- // if (!newPosition) {
|
|
|
- // newPosition = elementService.checkAngle(
|
|
|
- // position,
|
|
|
- // neighPoints[1].vectorId,
|
|
|
- // pointId
|
|
|
- // );
|
|
|
- // }
|
|
|
- // }
|
|
|
-
|
|
|
- // if (newPosition) {
|
|
|
- // flag = this.canMoveForPoint(
|
|
|
- // pointId,
|
|
|
- // newPosition,
|
|
|
- // linkedPointId,
|
|
|
- // linkedRoadId
|
|
|
- // );
|
|
|
- // if (!flag) {
|
|
|
- // return false;
|
|
|
- // }
|
|
|
- // mathUtil.clonePoint(position, newPosition);
|
|
|
- // }
|
|
|
-
|
|
|
point.setPosition(position);
|
|
|
}
|
|
|
// 与别的墙角重合
|
|
@@ -243,7 +201,7 @@ export default class MoveRoad {
|
|
|
const angle = roadService.AngleForRoad(tempRoad.vectorId, roadId);
|
|
|
startLimitLine = roadService.getMidLine(tempRoad);
|
|
|
limitInfos.startRoadId = tempRoad.vectorId;
|
|
|
- if (angle > (Constant.maxAngle / 180) * Math.PI) {
|
|
|
+ if (angle > Constant.maxAngle) {
|
|
|
startLimitLine = mathUtil.getVerticalLine(roadLine, startPoint);
|
|
|
limitInfos.startRoadId = null;
|
|
|
limitInfos.newStartRoadId = true;
|
|
@@ -273,11 +231,11 @@ export default class MoveRoad {
|
|
|
if (join1 == null && join2 == null) {
|
|
|
let angle0 = roadService.AngleForRoad(roadId, info.min0.roadId);
|
|
|
let angle1 = roadService.AngleForRoad(roadId, info.min1.roadId);
|
|
|
- if (angle0 > Math.PI) {
|
|
|
- angle0 = Math.PI - angle0;
|
|
|
+ if (angle0 > 180) {
|
|
|
+ angle0 = 180 - angle0;
|
|
|
}
|
|
|
- if (angle1 > Math.PI) {
|
|
|
- angle1 = Math.PI - angle1;
|
|
|
+ if (angle1 > 180) {
|
|
|
+ angle1 = 180 - angle1;
|
|
|
}
|
|
|
if (angle0 < angle1) {
|
|
|
tempRoadId = info.min0.roadId;
|
|
@@ -307,7 +265,7 @@ export default class MoveRoad {
|
|
|
const tempStartPoint = dataService.getPoint(tempRoad.startId);
|
|
|
const tempEndPoint = dataService.getPoint(tempRoad.endId);
|
|
|
if (
|
|
|
- angle > (Constant.maxAngle / 180) * Math.PI ||
|
|
|
+ angle > Constant.maxAngle ||
|
|
|
!mathUtil.isPointOnSegment(join, tempStartPoint, tempEndPoint)
|
|
|
) {
|
|
|
startLimitLine = mathUtil.getVerticalLine(roadLine, startPoint);
|
|
@@ -330,7 +288,7 @@ export default class MoveRoad {
|
|
|
const angle = roadService.AngleForRoad(tempRoad.vectorId, roadId);
|
|
|
endLimitLine = roadService.getMidLine(tempRoad);
|
|
|
limitInfos.endRoadId = tempRoad.vectorId;
|
|
|
- if (angle > (Constant.maxAngle / 180) * Math.PI) {
|
|
|
+ if (angle > Constant.maxAngle) {
|
|
|
endLimitLine = mathUtil.getVerticalLine(roadLine, endPoint);
|
|
|
limitInfos.endRoadId = null;
|
|
|
limitInfos.newEndRoadId = true;
|
|
@@ -360,11 +318,11 @@ export default class MoveRoad {
|
|
|
if (join1 == null && join2 == null) {
|
|
|
let angle0 = roadService.AngleForRoad(roadId, info.min0.roadId);
|
|
|
let angle1 = roadService.AngleForRoad(roadId, info.min1.roadId);
|
|
|
- if (angle0 > Math.PI) {
|
|
|
- angle0 = Math.PI - angle0;
|
|
|
+ if (angle0 > 180) {
|
|
|
+ angle0 = 180 - angle0;
|
|
|
}
|
|
|
- if (angle1 > Math.PI) {
|
|
|
- angle1 = Math.PI - angle1;
|
|
|
+ if (angle1 > 180) {
|
|
|
+ angle1 = 180 - angle1;
|
|
|
}
|
|
|
if (angle0 < angle1) {
|
|
|
tempRoadId = info.min0.roadId;
|
|
@@ -394,7 +352,7 @@ export default class MoveRoad {
|
|
|
const tempEndPoint = dataService.getPoint(tempRoad.end);
|
|
|
|
|
|
if (
|
|
|
- angle > (Constant.maxAngle / 180) * Math.PI ||
|
|
|
+ angle > Constant.maxAngle ||
|
|
|
!mathUtil.isPointOnSegment(join, tempStartPoint, tempEndPoint)
|
|
|
) {
|
|
|
endLimitLine = mathUtil.getVerticalLine(roadLine, endPoint);
|
|
@@ -432,7 +390,7 @@ export default class MoveRoad {
|
|
|
const parent = point.parent;
|
|
|
|
|
|
const angle = this.getMinAngle(pointId, position);
|
|
|
- if (Math.abs(angle) < (Constant.minAngle / 180) * Math.PI) {
|
|
|
+ if (Math.abs(angle) < Constant.minAngle) {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
@@ -441,7 +399,7 @@ export default class MoveRoad {
|
|
|
const road = dataService.getRoad(key);
|
|
|
const otherPointId = road.getOtherPointId(pointId);
|
|
|
const info = this.getNeighMinAngle(otherPointId, key, position);
|
|
|
- if (info && Math.abs(info.angle) < (Constant.minAngle / 180) * Math.PI) {
|
|
|
+ if (info && Math.abs(info.angle) < Constant.minAngle) {
|
|
|
return false;
|
|
|
} else {
|
|
|
const otherPoint = dataService.getPoint(otherPointId);
|
|
@@ -460,7 +418,7 @@ export default class MoveRoad {
|
|
|
const parent = point.parent;
|
|
|
let angle = null;
|
|
|
if (Object.keys(parent).length == 1) {
|
|
|
- return 2 * Math.PI;
|
|
|
+ return 360;
|
|
|
} else if (Object.keys(parent).length == 2) {
|
|
|
const road1 = dataService.getRoad(Object.keys(parent)[0]);
|
|
|
const road2 = dataService.getRoad(Object.keys(parent)[1]);
|
|
@@ -489,7 +447,7 @@ export default class MoveRoad {
|
|
|
let angle = mathUtil.Angle(position, _position, otherPoint);
|
|
|
// 统一按照逆时针顺序
|
|
|
if (otherPoint.y < position.y) {
|
|
|
- angle = 2 * Math.PI - angle;
|
|
|
+ angle = 360 - angle;
|
|
|
}
|
|
|
angles.push(angle);
|
|
|
}
|
|
@@ -497,7 +455,7 @@ export default class MoveRoad {
|
|
|
|
|
|
angles = angles.sort(sortNumber);
|
|
|
|
|
|
- let minAngle = 2 * Math.PI;
|
|
|
+ let minAngle = 360;
|
|
|
for (let i = 0; i < angles.length - 1; ++i) {
|
|
|
for (let j = i + 1; j < angles.length; ++j) {
|
|
|
const _angle = angles[j] - angles[i];
|
|
@@ -509,8 +467,8 @@ export default class MoveRoad {
|
|
|
|
|
|
const angle1 = angles[0];
|
|
|
const angle2 = angles[angles.length - 1];
|
|
|
- if (angle1 < Math.PI && angle2 > Math.PI) {
|
|
|
- const dAngle = 2 * Math.PI + angle1 - angle2;
|
|
|
+ if (angle1 < 180 && angle2 > 180) {
|
|
|
+ const dAngle = 360 + angle1 - angle2;
|
|
|
if (dAngle < minAngle) {
|
|
|
minAngle = dAngle;
|
|
|
}
|
|
@@ -866,7 +824,7 @@ export default class MoveRoad {
|
|
|
const otherPointId = road.getOtherPointId(pointId);
|
|
|
const otherPoint = dataService.getPoint(otherPointId);
|
|
|
const angle = mathUtil.Angle(point, otherPoint, newPoint2);
|
|
|
- if (Math.abs(angle) < (Constant.minAngle / 180) * Math.PI) {
|
|
|
+ if (Math.abs(angle) < Constant.minAngle) {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
@@ -899,7 +857,7 @@ export default class MoveRoad {
|
|
|
let parent = adsorbPoint.parent;
|
|
|
for (const key in parent) {
|
|
|
const angle = roadService.AngleForRoad3(roadId, key);
|
|
|
- if (Math.abs(angle) < (Constant.minAngle / 180) * Math.PI) {
|
|
|
+ if (Math.abs(angle) < Constant.minAngle) {
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
@@ -908,7 +866,7 @@ export default class MoveRoad {
|
|
|
parent = adsorbPoint.parent;
|
|
|
for (const key in parent) {
|
|
|
const angle = roadService.AngleForRoad3(roadId, key);
|
|
|
- if (Math.abs(angle) < (Constant.minAngle / 180) * Math.PI) {
|
|
|
+ if (Math.abs(angle) < Constant.minAngle) {
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
@@ -1069,7 +1027,7 @@ export default class MoveRoad {
|
|
|
// 只更新坐标
|
|
|
if (
|
|
|
Object.keys(point.parent).length == 3 &&
|
|
|
- angle > (Constant.maxAngle / 180) * Math.PI
|
|
|
+ angle > Constant.maxAngle
|
|
|
) {
|
|
|
point.setPosition(virtualInfo.virtualPosition);
|
|
|
}
|