|
@@ -465,12 +465,16 @@ export default class CurveRoadService extends RoadService {
|
|
let curveRoadId = curvePoint.getParent();
|
|
let curveRoadId = curvePoint.getParent();
|
|
let curveRoad = dataService.getCurveRoad(curveRoadId);
|
|
let curveRoad = dataService.getCurveRoad(curveRoadId);
|
|
|
|
|
|
|
|
+ let index = curvePoint.getIndex();
|
|
let dx = position.x - curvePoint.x;
|
|
let dx = position.x - curvePoint.x;
|
|
let dy = position.y - curvePoint.y;
|
|
let dy = position.y - curvePoint.y;
|
|
- let index = curvePoint.getIndex();
|
|
|
|
|
|
|
|
curvePoint.setPosition(position);
|
|
curvePoint.setPosition(position);
|
|
|
|
|
|
|
|
+ let line = null;
|
|
|
|
+ let join = null;
|
|
|
|
+ let len = curveRoad.points.length;
|
|
|
|
+
|
|
const leftCurveEdge = dataService.getCurveEdge(curveRoad.leftEdgeId);
|
|
const leftCurveEdge = dataService.getCurveEdge(curveRoad.leftEdgeId);
|
|
leftCurveEdge.points[index].x += dx;
|
|
leftCurveEdge.points[index].x += dx;
|
|
leftCurveEdge.points[index].y += dy;
|
|
leftCurveEdge.points[index].y += dy;
|
|
@@ -480,6 +484,36 @@ export default class CurveRoadService extends RoadService {
|
|
curveRoad.leftLanesCurves[i] = mathUtil.getCurvesByPoints(
|
|
curveRoad.leftLanesCurves[i] = mathUtil.getCurvesByPoints(
|
|
curveRoad.leftLanes[i]
|
|
curveRoad.leftLanes[i]
|
|
);
|
|
);
|
|
|
|
+
|
|
|
|
+ //需要修改端点
|
|
|
|
+ if (
|
|
|
|
+ index == 0 ||
|
|
|
|
+ index == 1 ||
|
|
|
|
+ index == curveRoad.points.length - 1 ||
|
|
|
|
+ index == curveRoad.points.length - 2
|
|
|
|
+ ) {
|
|
|
|
+ if (index == 0 || index == 1) {
|
|
|
|
+ line = mathUtil.createLine1(
|
|
|
|
+ curveRoad.leftLanes[i][0],
|
|
|
|
+ curveRoad.leftLanes[i][1]
|
|
|
|
+ );
|
|
|
|
+ join = mathUtil.getJoinLinePoint(curveRoad.points[0], line);
|
|
|
|
+ curveRoad.leftLanes[i][0].x = join.x;
|
|
|
|
+ curveRoad.leftLanes[i][0].y = join.y;
|
|
|
|
+ }
|
|
|
|
+ if (
|
|
|
|
+ index == curveRoad.points.length - 1 ||
|
|
|
|
+ index == curveRoad.points.length - 2
|
|
|
|
+ ) {
|
|
|
|
+ line = mathUtil.createLine1(
|
|
|
|
+ curveRoad.leftLanes[i][len - 2],
|
|
|
|
+ curveRoad.leftLanes[i][len - 1]
|
|
|
|
+ );
|
|
|
|
+ join = mathUtil.getJoinLinePoint(curveRoad.points[len - 1], line);
|
|
|
|
+ curveRoad.leftLanes[i][len - 1].x = join.x;
|
|
|
|
+ curveRoad.leftLanes[i][len - 1].y = join.y;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
const rightCurveEdge = dataService.getCurveEdge(curveRoad.rightEdgeId);
|
|
const rightCurveEdge = dataService.getCurveEdge(curveRoad.rightEdgeId);
|
|
@@ -491,6 +525,75 @@ export default class CurveRoadService extends RoadService {
|
|
curveRoad.rightLanesCurves[i] = mathUtil.getCurvesByPoints(
|
|
curveRoad.rightLanesCurves[i] = mathUtil.getCurvesByPoints(
|
|
curveRoad.rightLanes[i]
|
|
curveRoad.rightLanes[i]
|
|
);
|
|
);
|
|
|
|
+
|
|
|
|
+ //需要修改端点
|
|
|
|
+ if (
|
|
|
|
+ index == 0 ||
|
|
|
|
+ index == 1 ||
|
|
|
|
+ index == curveRoad.points.length - 1 ||
|
|
|
|
+ index == curveRoad.points.length - 2
|
|
|
|
+ ) {
|
|
|
|
+ if (index == 0 || index == 1) {
|
|
|
|
+ line = mathUtil.createLine1(
|
|
|
|
+ curveRoad.rightLanes[i][0],
|
|
|
|
+ curveRoad.rightLanes[i][1]
|
|
|
|
+ );
|
|
|
|
+ join = mathUtil.getJoinLinePoint(curveRoad.points[0], line);
|
|
|
|
+ curveRoad.rightLanes[i][0].x = join.x;
|
|
|
|
+ curveRoad.rightLanes[i][0].y = join.y;
|
|
|
|
+ }
|
|
|
|
+ if (
|
|
|
|
+ index == curveRoad.points.length - 1 ||
|
|
|
|
+ index == curveRoad.points.length - 2
|
|
|
|
+ ) {
|
|
|
|
+ line = mathUtil.createLine1(
|
|
|
|
+ curveRoad.rightLanes[i][len - 2],
|
|
|
|
+ curveRoad.rightLanes[i][len - 1]
|
|
|
|
+ );
|
|
|
|
+ join = mathUtil.getJoinLinePoint(curveRoad.points[len - 1], line);
|
|
|
|
+ curveRoad.rightLanes[i][len - 1].x = join.x;
|
|
|
|
+ curveRoad.rightLanes[i][len - 1].y = join.y;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (index == 0 || index == 1) {
|
|
|
|
+ line = mathUtil.createLine1(
|
|
|
|
+ leftCurveEdge.points[0],
|
|
|
|
+ leftCurveEdge.points[1]
|
|
|
|
+ );
|
|
|
|
+ join = mathUtil.getJoinLinePoint(curveRoad.points[0], line);
|
|
|
|
+ leftCurveEdge.points[0].x = join.x;
|
|
|
|
+ leftCurveEdge.points[0].y = join.y;
|
|
|
|
+
|
|
|
|
+ line = mathUtil.createLine1(
|
|
|
|
+ rightCurveEdge.points[0],
|
|
|
|
+ rightCurveEdge.points[1]
|
|
|
|
+ );
|
|
|
|
+ join = mathUtil.getJoinLinePoint(curveRoad.points[0], line);
|
|
|
|
+ rightCurveEdge.points[0].x = join.x;
|
|
|
|
+ rightCurveEdge.points[0].y = join.y;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (
|
|
|
|
+ index == curveRoad.points.length - 1 ||
|
|
|
|
+ index == curveRoad.points.length - 2
|
|
|
|
+ ) {
|
|
|
|
+ line = mathUtil.createLine1(
|
|
|
|
+ leftCurveEdge.points[len - 2],
|
|
|
|
+ leftCurveEdge.points[len - 1]
|
|
|
|
+ );
|
|
|
|
+ join = mathUtil.getJoinLinePoint(curveRoad.points[len - 1], line);
|
|
|
|
+ leftCurveEdge.points[len - 1].x = join.x;
|
|
|
|
+ leftCurveEdge.points[len - 1].y = join.y;
|
|
|
|
+
|
|
|
|
+ line = mathUtil.createLine1(
|
|
|
|
+ rightCurveEdge.points[len - 2],
|
|
|
|
+ rightCurveEdge.points[len - 1]
|
|
|
|
+ );
|
|
|
|
+ join = mathUtil.getJoinLinePoint(curveRoad.points[len - 1], line);
|
|
|
|
+ rightCurveEdge.points[len - 1].x = join.x;
|
|
|
|
+ rightCurveEdge.points[len - 1].y = join.y;
|
|
}
|
|
}
|
|
|
|
|
|
this.setCurves(curveRoad);
|
|
this.setCurves(curveRoad);
|