feat: add bicycle filter
This commit is contained in:
parent
429a22fcd9
commit
c223936743
1 changed files with 37 additions and 0 deletions
|
@ -143,6 +143,42 @@ public class ArcInspectorFactory {
|
||||||
}
|
}
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
// Non-private roads for bicycles:
|
||||||
|
static ArcInspector forBicyclesCustomT = new ArcInspector() {
|
||||||
|
|
||||||
|
static final int maxPedestrianSpeed = 25 ; // need for speed
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAllowed(Arc arc) {
|
||||||
|
return arc.getRoadInformation().getAccessRestrictions()
|
||||||
|
.isAllowedForAny(AccessMode.BICYCLE, EnumSet.complementOf(EnumSet
|
||||||
|
.of(AccessRestriction.FORBIDDEN, AccessRestriction.PRIVATE)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getCost(Arc arc) {
|
||||||
|
return arc.getTravelTime(
|
||||||
|
Math.min(maxPedestrianSpeed, arc.getRoadInformation().getMaximumSpeed()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Fastest path for cyclists";
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
@Override
|
||||||
|
public int getMaximumSpeed() {
|
||||||
|
return 5;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Mode getMode() {
|
||||||
|
return Mode.TIME;
|
||||||
|
}
|
||||||
|
} ;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return List of all arc filters in this factory.
|
* @return List of all arc filters in this factory.
|
||||||
*/
|
*/
|
||||||
|
@ -156,6 +192,7 @@ public class ArcInspectorFactory {
|
||||||
filters.add(forCarsL) ;
|
filters.add(forCarsL) ;
|
||||||
filters.add(forCarsT) ;
|
filters.add(forCarsT) ;
|
||||||
filters.add(forBicyclesT);
|
filters.add(forBicyclesT);
|
||||||
|
filters.add(forBicyclesCustomT);
|
||||||
|
|
||||||
// Add your own filters here (do not forget to implement toString()
|
// Add your own filters here (do not forget to implement toString()
|
||||||
// to get an understandable output!):
|
// to get an understandable output!):
|
||||||
|
|
Loading…
Reference in a new issue