count lines differenetly
This commit is contained in:
parent
e27a425465
commit
19ef80c33f
1 changed files with 18 additions and 4 deletions
|
@ -516,7 +516,7 @@ public class RouteResultPreparation {
|
|||
kl = true;
|
||||
int lns = attached.getObject().getLanes();
|
||||
if(attached.getObject().getOneway() == 0) {
|
||||
lns = (lns + 1) / 2;
|
||||
lns = countLines(attached, lns);
|
||||
}
|
||||
if (lns > 0) {
|
||||
right += lns;
|
||||
|
@ -526,7 +526,7 @@ public class RouteResultPreparation {
|
|||
kr = true;
|
||||
int lns = attached.getObject().getLanes();
|
||||
if(attached.getObject().getOneway() == 0) {
|
||||
lns = (lns + 1) / 2;
|
||||
lns = countLines(attached, lns);
|
||||
}
|
||||
if (lns > 0) {
|
||||
left += lns;
|
||||
|
@ -542,8 +542,9 @@ public class RouteResultPreparation {
|
|||
right = 1;
|
||||
}
|
||||
int current = currentSegm.getObject().getLanes();
|
||||
if(currentSegm.getObject().getOneway() == 0) {
|
||||
current = (current + 1) / 2;
|
||||
// attachedRoutes covers all allowed outbound routes at that point except currentSegm.
|
||||
if (currentSegm.getObject().getOneway() == 0) {
|
||||
current = countLines(currentSegm, current);
|
||||
}
|
||||
if (current <= 0) {
|
||||
current = 1;
|
||||
|
@ -579,6 +580,19 @@ public class RouteResultPreparation {
|
|||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
protected int countLines(RouteSegmentResult attached, int lns) {
|
||||
try {
|
||||
if (attached.isForwardDirection() && attached.getObject().getValue("lanes:forward") != null) {
|
||||
return Integer.parseInt(attached.getObject().getValue("lanes:forward"));
|
||||
} else if (!attached.isForwardDirection() && attached.getObject().getValue("lanes:backward") != null) {
|
||||
return Integer.parseInt(attached.getObject().getValue("lanes:backward"));
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return (lns + 1) / 2;
|
||||
}
|
||||
|
||||
private boolean isMotorway(RouteSegmentResult s){
|
||||
String h = s.getObject().getHighway();
|
||||
|
|
Loading…
Reference in a new issue