Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
f7b19c59c1
4 changed files with 56 additions and 25 deletions
|
@ -705,21 +705,37 @@ public class RouteResultPreparation {
|
||||||
active.activeStartIndex = active.activeStartIndex + target.activeStartIndex;
|
active.activeStartIndex = active.activeStartIndex + target.activeStartIndex;
|
||||||
changed = true;
|
changed = true;
|
||||||
} else {
|
} else {
|
||||||
// cause the next-turn goes forward exclude left most and right most lane
|
int straightActiveLen = 0;
|
||||||
if(active.activeStartIndex == 0) {
|
int straightActiveBegin = -1;
|
||||||
active.activeStartIndex ++;
|
for(int i = active.activeStartIndex; i <= active.activeEndIndex; i++) {
|
||||||
active.activeLen--;
|
if(TurnType.hasAnyTurnLane(active.originalLanes[i], TurnType.C)) {
|
||||||
|
straightActiveLen++;
|
||||||
|
if(straightActiveBegin == -1) {
|
||||||
|
straightActiveBegin = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(active.activeEndIndex == active.originalLanes.length - 1) {
|
if(straightActiveLen == target.activeLen) {
|
||||||
active.activeEndIndex --;
|
active.activeStartIndex = straightActiveBegin;
|
||||||
active.activeLen--;
|
active.activeEndIndex = straightActiveBegin + target.activeLen - 1;
|
||||||
|
changed = true;
|
||||||
|
} else {
|
||||||
|
// cause the next-turn goes forward exclude left most and right most lane
|
||||||
|
if (active.activeStartIndex == 0) {
|
||||||
|
active.activeStartIndex++;
|
||||||
|
active.activeLen--;
|
||||||
|
}
|
||||||
|
if (active.activeEndIndex == active.originalLanes.length - 1) {
|
||||||
|
active.activeEndIndex--;
|
||||||
|
active.activeLen--;
|
||||||
|
}
|
||||||
|
float ratio = (active.activeLen - target.activeLen) / 2f;
|
||||||
|
if (ratio > 0) {
|
||||||
|
active.activeEndIndex = (int) Math.ceil(active.activeEndIndex - ratio);
|
||||||
|
active.activeStartIndex = (int) Math.floor(active.activeStartIndex + ratio);
|
||||||
|
}
|
||||||
|
changed = true;
|
||||||
}
|
}
|
||||||
float ratio = (active.activeLen - target.activeLen) / 2f;
|
|
||||||
if(ratio > 0) {
|
|
||||||
active.activeEndIndex = (int) Math.ceil(active.activeEndIndex - ratio);
|
|
||||||
active.activeStartIndex = (int) Math.floor(active.activeStartIndex + ratio);
|
|
||||||
}
|
|
||||||
changed = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1042,8 +1058,17 @@ public class RouteResultPreparation {
|
||||||
String[] splitLaneOptions = turnLanes.split("\\|", -1);
|
String[] splitLaneOptions = turnLanes.split("\\|", -1);
|
||||||
int activeBeginIndex = findActiveIndex(rawLanes, splitLaneOptions, rs.leftLanes, true,
|
int activeBeginIndex = findActiveIndex(rawLanes, splitLaneOptions, rs.leftLanes, true,
|
||||||
rs.leftLanesInfo, rs.roadsOnLeft, rs.addRoadsOnLeft);
|
rs.leftLanesInfo, rs.roadsOnLeft, rs.addRoadsOnLeft);
|
||||||
|
|
||||||
|
if(!rs.keepLeft && activeBeginIndex != -1 &&
|
||||||
|
splitLaneOptions.length > 0 && !splitLaneOptions[splitLaneOptions.length - 1].contains(";")) {
|
||||||
|
activeBeginIndex = Math.max(activeBeginIndex, 1);
|
||||||
|
}
|
||||||
int activeEndIndex = findActiveIndex(rawLanes, splitLaneOptions, rs.rightLanes, false,
|
int activeEndIndex = findActiveIndex(rawLanes, splitLaneOptions, rs.rightLanes, false,
|
||||||
rs.rightLanesInfo, rs.roadsOnRight, rs.addRoadsOnRight);
|
rs.rightLanesInfo, rs.roadsOnRight, rs.addRoadsOnRight);
|
||||||
|
if(!rs.keepRight && activeEndIndex != -1 &&
|
||||||
|
splitLaneOptions.length > 0 && !splitLaneOptions[0].contains(";") ) {
|
||||||
|
activeEndIndex = Math.min(activeEndIndex, rawLanes.length - 1);
|
||||||
|
}
|
||||||
if (activeBeginIndex == -1 || activeEndIndex == -1 || activeBeginIndex > activeEndIndex) {
|
if (activeBeginIndex == -1 || activeEndIndex == -1 || activeBeginIndex > activeEndIndex) {
|
||||||
// something went wrong
|
// something went wrong
|
||||||
return createSimpleKeepLeftRightTurn(leftSide, prevSegm, currentSegm, rs);
|
return createSimpleKeepLeftRightTurn(leftSide, prevSegm, currentSegm, rs);
|
||||||
|
@ -1116,8 +1141,7 @@ public class RouteResultPreparation {
|
||||||
for (int i = 0; i < rawLanes.length; i++) {
|
for (int i = 0; i < rawLanes.length; i++) {
|
||||||
int ind = left ? i : (rawLanes.length - i - 1);
|
int ind = left ? i : (rawLanes.length - i - 1);
|
||||||
if (!lookupSlightTurn ||
|
if (!lookupSlightTurn ||
|
||||||
TurnType.isSlightTurn(TurnType.getPrimaryTurn(rawLanes[ind]))
|
TurnType.hasAnySlightTurnLane(rawLanes[ind])) {
|
||||||
|| TurnType.isSlightTurn(TurnType.getSecondaryTurn(rawLanes[ind]))) {
|
|
||||||
String[] laneTurns = splitLaneOptions[ind].split(";");
|
String[] laneTurns = splitLaneOptions[ind].split(";");
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
for(String lTurn : laneTurns) {
|
for(String lTurn : laneTurns) {
|
||||||
|
@ -1127,14 +1151,8 @@ public class RouteResultPreparation {
|
||||||
diffTurnRoads --;
|
diffTurnRoads --;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// int cnt = countOccurrences(splitLaneOptions[ind], ';') + 1;
|
|
||||||
// if(cnt > 1) {
|
|
||||||
// // sometimes slight right turn goes to the road with 2 lanes
|
|
||||||
// // the better situation to group all the lanes and
|
|
||||||
// // when ';' we know for sure the lane combines 2 group
|
|
||||||
// roads --;
|
|
||||||
// }
|
|
||||||
lanes -= cnt;
|
lanes -= cnt;
|
||||||
|
//lanes--;
|
||||||
// we already found slight turn others are turn in different direction
|
// we already found slight turn others are turn in different direction
|
||||||
lookupSlightTurn = false;
|
lookupSlightTurn = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -357,6 +357,18 @@ public class TurnType {
|
||||||
public static boolean isSlightTurn(int type) {
|
public static boolean isSlightTurn(int type) {
|
||||||
return type == TSLL || type == TSLR || type == C || type == KL || type == KR;
|
return type == TSLL || type == TSLR || type == C || type == KL || type == KR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean hasAnySlightTurnLane(int type) {
|
||||||
|
return TurnType.isSlightTurn(TurnType.getPrimaryTurn(type))
|
||||||
|
|| TurnType.isSlightTurn(TurnType.getSecondaryTurn(type))
|
||||||
|
|| TurnType.isSlightTurn(TurnType.getTertiaryTurn(type));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean hasAnyTurnLane(int type, int turn) {
|
||||||
|
return TurnType.getPrimaryTurn(type) == turn
|
||||||
|
|| TurnType.getSecondaryTurn(type) == turn
|
||||||
|
|| TurnType.getTertiaryTurn(type) == turn;
|
||||||
|
}
|
||||||
|
|
||||||
public static void collectTurnTypes(int lane, TIntHashSet set) {
|
public static void collectTurnTypes(int lane, TIntHashSet set) {
|
||||||
int pt = TurnType.getPrimaryTurn(lane);
|
int pt = TurnType.getPrimaryTurn(lane);
|
||||||
|
|
|
@ -100,7 +100,7 @@
|
||||||
"longitude": 35.49527125060558
|
"longitude": 35.49527125060558
|
||||||
},
|
},
|
||||||
"expectedResults": {
|
"expectedResults": {
|
||||||
"26717": "C:+C,TSLL|C|C",
|
"26717": "C:C,TSLL|+C|C",
|
||||||
"26821": "TSLL:+TSLL,C|C|C",
|
"26821": "TSLL:+TSLL,C|C|C",
|
||||||
"29088": "C|C|C|C|+C"
|
"29088": "C|C|C|C|+C"
|
||||||
}
|
}
|
||||||
|
@ -494,6 +494,7 @@
|
||||||
"longitude": 35.5013644695282
|
"longitude": 35.5013644695282
|
||||||
},
|
},
|
||||||
"expectedResults": {
|
"expectedResults": {
|
||||||
|
"61820398":"C|+C|+C|+C|TSLR|TSLR",
|
||||||
"4400154": "C|C|+TSLR,C|+TSLR|+TSLR"
|
"4400154": "C|C|+TSLR,C|+TSLR|+TSLR"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -583,7 +584,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"testName": "32.Motorway TR South Kent Des Moines Road",
|
"testName": "32.Motorway TR South Kent Des Moines Road (1st turn incorrect)",
|
||||||
"startPoint": {
|
"startPoint": {
|
||||||
"latitude": 45.64518099200965,
|
"latitude": 45.64518099200965,
|
||||||
"longitude": 35.668448954820605
|
"longitude": 35.668448954820605
|
||||||
|
@ -593,7 +594,7 @@
|
||||||
"longitude": 35.66181853413579
|
"longitude": 35.66181853413579
|
||||||
},
|
},
|
||||||
"expectedResults": {
|
"expectedResults": {
|
||||||
"222244": "TL|TL|+C",
|
"222244": "TL|+TL|C",
|
||||||
"222243": "TL|TL|+C|C|TSLR",
|
"222243": "TL|TL|+C|C|TSLR",
|
||||||
"222164": "TL|TL|+C|C"
|
"222164": "TL|TL|+C|C"
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.9 KiB |
Loading…
Reference in a new issue