|
@@ -34,7 +34,9 @@ export default class CurveRoadService extends RoadService {
|
|
edgePoints = mathUtil.RectangleVertex(
|
|
edgePoints = mathUtil.RectangleVertex(
|
|
startPoint,
|
|
startPoint,
|
|
endPoint,
|
|
endPoint,
|
|
- curveRoad.leftWidth + curveRoad.rightWidth + curveRoad.midDivideWidth
|
|
|
|
|
|
+ curveRoad.leftWidth +
|
|
|
|
+ curveRoad.rightWidth +
|
|
|
|
+ curveRoad.midDivide.midDivideWidth
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -256,7 +258,7 @@ export default class CurveRoadService extends RoadService {
|
|
}
|
|
}
|
|
const leftRatio =
|
|
const leftRatio =
|
|
curveRoad.leftWidth /
|
|
curveRoad.leftWidth /
|
|
- (curveRoad.leftWidth + curveRoad.midDivideWidth / 2);
|
|
|
|
|
|
+ (curveRoad.leftWidth + curveRoad.midDivide.midDivideWidth / 2);
|
|
const leftdx =
|
|
const leftdx =
|
|
((leftEdgePoints[j].x - points[j].x) * leftRatio) / leftCount;
|
|
((leftEdgePoints[j].x - points[j].x) * leftRatio) / leftCount;
|
|
const leftdy =
|
|
const leftdy =
|
|
@@ -279,7 +281,7 @@ export default class CurveRoadService extends RoadService {
|
|
for (let j = 0; j < points.length; ++j) {
|
|
for (let j = 0; j < points.length; ++j) {
|
|
const leftRatio =
|
|
const leftRatio =
|
|
curveRoad.leftWidth /
|
|
curveRoad.leftWidth /
|
|
- (curveRoad.leftWidth + curveRoad.midDivideWidth / 2);
|
|
|
|
|
|
+ (curveRoad.leftWidth + curveRoad.midDivide.midDivideWidth / 2);
|
|
const middx = (leftEdgePoints[j].x - points[j].x) * (1 - leftRatio);
|
|
const middx = (leftEdgePoints[j].x - points[j].x) * (1 - leftRatio);
|
|
const middy = (leftEdgePoints[j].y - points[j].y) * (1 - leftRatio);
|
|
const middy = (leftEdgePoints[j].y - points[j].y) * (1 - leftRatio);
|
|
leftMidDivide[j] = {};
|
|
leftMidDivide[j] = {};
|
|
@@ -303,7 +305,7 @@ export default class CurveRoadService extends RoadService {
|
|
}
|
|
}
|
|
const rightRatio =
|
|
const rightRatio =
|
|
curveRoad.rightWidth /
|
|
curveRoad.rightWidth /
|
|
- (curveRoad.rightWidth + curveRoad.midDivideWidth / 2);
|
|
|
|
|
|
+ (curveRoad.rightWidth + curveRoad.midDivide.midDivideWidth / 2);
|
|
const rightdx =
|
|
const rightdx =
|
|
((rightEdgePoints[j].x - points[j].x) * rightRatio) / rightCount;
|
|
((rightEdgePoints[j].x - points[j].x) * rightRatio) / rightCount;
|
|
const rightdy =
|
|
const rightdy =
|
|
@@ -325,7 +327,7 @@ export default class CurveRoadService extends RoadService {
|
|
for (let j = 0; j < points.length; ++j) {
|
|
for (let j = 0; j < points.length; ++j) {
|
|
const rightRatio =
|
|
const rightRatio =
|
|
curveRoad.rightWidth /
|
|
curveRoad.rightWidth /
|
|
- (curveRoad.rightWidth + curveRoad.midDivideWidth / 2);
|
|
|
|
|
|
+ (curveRoad.rightWidth + curveRoad.midDivide.midDivideWidth / 2);
|
|
const middx = (rightEdgePoints[j].x - points[j].x) * (1 - rightRatio);
|
|
const middx = (rightEdgePoints[j].x - points[j].x) * (1 - rightRatio);
|
|
const middy = (rightEdgePoints[j].y - points[j].y) * (1 - rightRatio);
|
|
const middy = (rightEdgePoints[j].y - points[j].y) * (1 - rightRatio);
|
|
rightMidDivide[j] = {};
|
|
rightMidDivide[j] = {};
|
|
@@ -370,7 +372,7 @@ export default class CurveRoadService extends RoadService {
|
|
lanes = curveRoad.leftLanes;
|
|
lanes = curveRoad.leftLanes;
|
|
ratio =
|
|
ratio =
|
|
curveRoad.leftWidth /
|
|
curveRoad.leftWidth /
|
|
- (curveRoad.leftWidth + curveRoad.midDivideWidth / 2);
|
|
|
|
|
|
+ (curveRoad.leftWidth + curveRoad.midDivide.midDivideWidth / 2);
|
|
} else if (dir == "right") {
|
|
} else if (dir == "right") {
|
|
curveEdge = dataService.getCurveRoadEdge(curveRoad.rightEdgeId);
|
|
curveEdge = dataService.getCurveRoadEdge(curveRoad.rightEdgeId);
|
|
oldCount = curveRoad.rightDrivewayCount;
|
|
oldCount = curveRoad.rightDrivewayCount;
|
|
@@ -378,7 +380,7 @@ export default class CurveRoadService extends RoadService {
|
|
lanes = curveRoad.rightLanes;
|
|
lanes = curveRoad.rightLanes;
|
|
ratio =
|
|
ratio =
|
|
curveRoad.rightWidth /
|
|
curveRoad.rightWidth /
|
|
- (curveRoad.rightWidth + curveRoad.midDivideWidth / 2);
|
|
|
|
|
|
+ (curveRoad.rightWidth + curveRoad.midDivide.midDivideWidth / 2);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -419,12 +421,12 @@ export default class CurveRoadService extends RoadService {
|
|
if (dir == "left") {
|
|
if (dir == "left") {
|
|
const leftWidth =
|
|
const leftWidth =
|
|
mathUtil.getDisForPoinLine(leftCurveEdge.start, line) -
|
|
mathUtil.getDisForPoinLine(leftCurveEdge.start, line) -
|
|
- curveRoad.midDivideWidth / 2;
|
|
|
|
|
|
+ curveRoad.midDivide.midDivideWidth / 2;
|
|
curveRoad.setWidth(leftWidth, "left");
|
|
curveRoad.setWidth(leftWidth, "left");
|
|
} else if (dir == "right") {
|
|
} else if (dir == "right") {
|
|
const rightWidth =
|
|
const rightWidth =
|
|
mathUtil.getDisForPoinLine(rightCurveEdge.start, line) -
|
|
mathUtil.getDisForPoinLine(rightCurveEdge.start, line) -
|
|
- curveRoad.midDivideWidth / 2;
|
|
|
|
|
|
+ curveRoad.midDivide.midDivideWidth / 2;
|
|
curveRoad.setWidth(rightWidth, "right");
|
|
curveRoad.setWidth(rightWidth, "right");
|
|
}
|
|
}
|
|
} else if (curveRoad.way == Constant.oneWay) {
|
|
} else if (curveRoad.way == Constant.oneWay) {
|
|
@@ -510,8 +512,8 @@ export default class CurveRoadService extends RoadService {
|
|
if (curveRoad.way == Constant.oneWay) {
|
|
if (curveRoad.way == Constant.oneWay) {
|
|
edgePoints = mathUtil.getOffset(
|
|
edgePoints = mathUtil.getOffset(
|
|
curveRoad.points,
|
|
curveRoad.points,
|
|
- curveRoad.leftWidth + curveRoad.midDivideWidth / 2,
|
|
|
|
- curveRoad.rightWidth + curveRoad.midDivideWidth / 2
|
|
|
|
|
|
+ curveRoad.leftWidth + curveRoad.midDivide.midDivideWidth / 2,
|
|
|
|
+ curveRoad.rightWidth + curveRoad.midDivide.midDivideWidth / 2
|
|
);
|
|
);
|
|
} else if (curveRoad.way == Constant.twoWay) {
|
|
} else if (curveRoad.way == Constant.twoWay) {
|
|
const line = mathUtil.createLine1(
|
|
const line = mathUtil.createLine1(
|
|
@@ -551,12 +553,12 @@ export default class CurveRoadService extends RoadService {
|
|
//需要考虑中间带
|
|
//需要考虑中间带
|
|
if (dir == "left") {
|
|
if (dir == "left") {
|
|
ratio =
|
|
ratio =
|
|
- (newWidth + curveRoad.midDivideWidth / 2) /
|
|
|
|
- (curveRoad.leftWidth + curveRoad.midDivideWidth / 2);
|
|
|
|
|
|
+ (newWidth + curveRoad.midDivide.midDivideWidth / 2) /
|
|
|
|
+ (curveRoad.leftWidth + curveRoad.midDivide.midDivideWidth / 2);
|
|
} else if (dir == "right") {
|
|
} else if (dir == "right") {
|
|
ratio =
|
|
ratio =
|
|
- (newWidth + curveRoad.midDivideWidth / 2) /
|
|
|
|
- (curveRoad.rightWidth + curveRoad.midDivideWidth / 2);
|
|
|
|
|
|
+ (newWidth + curveRoad.midDivide.midDivideWidth / 2) /
|
|
|
|
+ (curveRoad.rightWidth + curveRoad.midDivide.midDivideWidth / 2);
|
|
} else {
|
|
} else {
|
|
if (curveRoad.way == Constant.oneWay) {
|
|
if (curveRoad.way == Constant.oneWay) {
|
|
ratio = newWidth / curveRoad.singleRoadWidth;
|
|
ratio = newWidth / curveRoad.singleRoadWidth;
|
|
@@ -587,16 +589,18 @@ export default class CurveRoadService extends RoadService {
|
|
} else if (curveRoad.way == Constant.twoWay) {
|
|
} else if (curveRoad.way == Constant.twoWay) {
|
|
ratio = newWidth / (curveRoad.leftWidth + curveRoad.rightWidth);
|
|
ratio = newWidth / (curveRoad.leftWidth + curveRoad.rightWidth);
|
|
ratio =
|
|
ratio =
|
|
- (curveRoad.leftWidth * ratio + curveRoad.midDivideWidth / 2) /
|
|
|
|
- (curveRoad.leftWidth + curveRoad.midDivideWidth / 2);
|
|
|
|
|
|
+ (curveRoad.leftWidth * ratio +
|
|
|
|
+ curveRoad.midDivide.midDivideWidth / 2) /
|
|
|
|
+ (curveRoad.leftWidth + curveRoad.midDivide.midDivideWidth / 2);
|
|
dx = (leftCurveEdge.points[i].x - curveRoad.points[i].x) * ratio;
|
|
dx = (leftCurveEdge.points[i].x - curveRoad.points[i].x) * ratio;
|
|
leftCurveEdge.points[i].x = curveRoad.points[i].x + dx;
|
|
leftCurveEdge.points[i].x = curveRoad.points[i].x + dx;
|
|
dy = (leftCurveEdge.points[i].y - curveRoad.points[i].y) * ratio;
|
|
dy = (leftCurveEdge.points[i].y - curveRoad.points[i].y) * ratio;
|
|
leftCurveEdge.points[i].y = curveRoad.points[i].y + dy;
|
|
leftCurveEdge.points[i].y = curveRoad.points[i].y + dy;
|
|
ratio = newWidth / (curveRoad.leftWidth + curveRoad.rightWidth);
|
|
ratio = newWidth / (curveRoad.leftWidth + curveRoad.rightWidth);
|
|
ratio =
|
|
ratio =
|
|
- (curveRoad.rightWidth * ratio + curveRoad.midDivideWidth / 2) /
|
|
|
|
- (curveRoad.rightWidth + curveRoad.midDivideWidth / 2);
|
|
|
|
|
|
+ (curveRoad.rightWidth * ratio +
|
|
|
|
+ curveRoad.midDivide.midDivideWidth / 2) /
|
|
|
|
+ (curveRoad.rightWidth + curveRoad.midDivide.midDivideWidth / 2);
|
|
dx = (rightCurveEdge.points[i].x - curveRoad.points[i].x) * ratio;
|
|
dx = (rightCurveEdge.points[i].x - curveRoad.points[i].x) * ratio;
|
|
rightCurveEdge.points[i].x = curveRoad.points[i].x + dx;
|
|
rightCurveEdge.points[i].x = curveRoad.points[i].x + dx;
|
|
dy = (rightCurveEdge.points[i].y - curveRoad.points[i].y) * ratio;
|
|
dy = (rightCurveEdge.points[i].y - curveRoad.points[i].y) * ratio;
|