|
@@ -1169,12 +1169,36 @@ export default class MoveRoad {
|
|
|
const parent = edge.getParent();
|
|
|
const road = dataService.getRoad(parent);
|
|
|
const line = roadService.getMidLine(road);
|
|
|
+ let join = mathUtil.getJoinLinePoint(position, line);
|
|
|
|
|
|
let dir = "left";
|
|
|
if (road.rightEdgeId == edgeId) {
|
|
|
dir = "right";
|
|
|
}
|
|
|
|
|
|
+ let leftEdge = dataService.getRoadEdge(road.leftEdgeId);
|
|
|
+ const line1 = mathUtil.createLine1(leftEdge.start, leftEdge.end);
|
|
|
+ let leftJoin = mathUtil.getJoinLinePoint(position, line1);
|
|
|
+ let rightEdge = dataService.getRoadEdge(road.rightEdgeId);
|
|
|
+ const line2 = mathUtil.createLine1(rightEdge.start, rightEdge.end);
|
|
|
+ let rightJoin = mathUtil.getJoinLinePoint(position, line2);
|
|
|
+
|
|
|
+ if (
|
|
|
+ dir == "left" &&
|
|
|
+ (mathUtil.isContainForSegment(position, join, rightJoin) ||
|
|
|
+ mathUtil.isContainForSegment(rightJoin, join, position))
|
|
|
+ ) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (
|
|
|
+ dir == "right" &&
|
|
|
+ (mathUtil.isContainForSegment(position, join, leftJoin) ||
|
|
|
+ mathUtil.isContainForSegment(leftJoin, join, position))
|
|
|
+ ) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
const newWidth = mathUtil.getDisForPoinLine(position, line);
|
|
|
if (
|
|
|
newWidth > Constant.minRoadSideWidth &&
|
|
@@ -1188,25 +1212,87 @@ export default class MoveRoad {
|
|
|
const curveEdge = dataService.getCurveRoadEdge(curveEdgeId);
|
|
|
const parent = curveEdge.getParent();
|
|
|
const curveRoad = dataService.getCurveRoad(parent);
|
|
|
- let joinInfo = null;
|
|
|
+ //let joinInfo = null;
|
|
|
let dir = "left";
|
|
|
if (curveRoad.rightEdgeId == curveEdgeId) {
|
|
|
dir = "right";
|
|
|
}
|
|
|
|
|
|
- if (dir == "left") {
|
|
|
- joinInfo = mathUtil.getHitInfoForCurve(
|
|
|
- position,
|
|
|
- curveRoad.curves[index],
|
|
|
- curveRoad.leftWidth
|
|
|
- );
|
|
|
- } else if (dir == "right") {
|
|
|
- joinInfo = mathUtil.getHitInfoForCurve(
|
|
|
- position,
|
|
|
- curveRoad.curves[index],
|
|
|
- curveRoad.rightWidth
|
|
|
- );
|
|
|
+ // if (dir == "left") {
|
|
|
+ // joinInfo = mathUtil.getHitInfoForCurve(
|
|
|
+ // position,
|
|
|
+ // curveRoad.curves[index],
|
|
|
+ // curveRoad.leftWidth
|
|
|
+ // );
|
|
|
+ // } else if (dir == "right") {
|
|
|
+ // joinInfo = mathUtil.getHitInfoForCurve(
|
|
|
+ // position,
|
|
|
+ // curveRoad.curves[index],
|
|
|
+ // curveRoad.rightWidth
|
|
|
+ // );
|
|
|
+ // }
|
|
|
+
|
|
|
+ const leftCurveEdge = dataService.getCurveRoadEdge(curveRoad.leftEdgeId);
|
|
|
+ const rightCurveEdge = dataService.getCurveRoadEdge(curveRoad.rightEdgeId);
|
|
|
+ let joinInfo = mathUtil.getHitInfoForCurve(
|
|
|
+ position,
|
|
|
+ curveRoad.curves[index],
|
|
|
+ Math.max(curveRoad.leftWidth, curveRoad.rightWidth)
|
|
|
+ );
|
|
|
+
|
|
|
+ let leftJoinInfo = mathUtil.getHitInfoForCurve(
|
|
|
+ position,
|
|
|
+ leftCurveEdge.curves[index],
|
|
|
+ curveRoad.leftWidth
|
|
|
+ );
|
|
|
+ let leftLine = mathUtil.createLine1(
|
|
|
+ leftJoinInfo.position,
|
|
|
+ joinInfo.position
|
|
|
+ );
|
|
|
+ let leftJoin = mathUtil.getJoinLinePoint(position, leftLine);
|
|
|
+
|
|
|
+ let rightJoinInfo = mathUtil.getHitInfoForCurve(
|
|
|
+ position,
|
|
|
+ rightCurveEdge.curves[index],
|
|
|
+ curveRoad.rightWidth
|
|
|
+ );
|
|
|
+ let rightLine = mathUtil.createLine1(
|
|
|
+ rightJoinInfo.position,
|
|
|
+ joinInfo.position
|
|
|
+ );
|
|
|
+ let rightJoin = mathUtil.getJoinLinePoint(position, rightLine);
|
|
|
+ if (
|
|
|
+ dir == "left" &&
|
|
|
+ (mathUtil.isContainForSegment(
|
|
|
+ rightJoin,
|
|
|
+ rightJoinInfo.position,
|
|
|
+ joinInfo.position
|
|
|
+ ) ||
|
|
|
+ mathUtil.isContainForSegment(
|
|
|
+ rightJoinInfo.position,
|
|
|
+ rightJoin,
|
|
|
+ joinInfo.position
|
|
|
+ ))
|
|
|
+ ) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (
|
|
|
+ dir == "right" &&
|
|
|
+ (mathUtil.isContainForSegment(
|
|
|
+ leftJoin,
|
|
|
+ leftJoinInfo.position,
|
|
|
+ joinInfo.position
|
|
|
+ ) ||
|
|
|
+ mathUtil.isContainForSegment(
|
|
|
+ leftJoinInfo.position,
|
|
|
+ leftJoin,
|
|
|
+ joinInfo.position
|
|
|
+ ))
|
|
|
+ ) {
|
|
|
+ return;
|
|
|
}
|
|
|
+
|
|
|
const newWidth = mathUtil.getDistance(joinInfo.position, position);
|
|
|
if (
|
|
|
newWidth > Constant.minRoadSideWidth &&
|