Introduce access=no restrictions
This commit is contained in:
parent
2c700f9917
commit
6e2923080e
4 changed files with 32 additions and 8 deletions
|
@ -98,6 +98,10 @@ public class RouteDataObject {
|
|||
}
|
||||
return pointTypes[ind];
|
||||
}
|
||||
|
||||
public int[] getTypes() {
|
||||
return types;
|
||||
}
|
||||
|
||||
public String getHighway() {
|
||||
String highway = null;
|
||||
|
|
|
@ -12,6 +12,7 @@ public class GeneralRouter extends VehicleRouter {
|
|||
Map<String, Double> highwaySpeed = new LinkedHashMap<String, Double>();
|
||||
Map<String, Double> highwayPriorities = new LinkedHashMap<String, Double>();
|
||||
Map<String, Double> highwayFuturePriorities = new LinkedHashMap<String, Double>();
|
||||
Map<String, Double> avoidElements = new LinkedHashMap<String, Double>();
|
||||
Map<String, Double> obstacles = new LinkedHashMap<String, Double>();
|
||||
boolean followSpeedLimitations = true;
|
||||
boolean restrictionsAware = true;
|
||||
|
@ -30,7 +31,19 @@ public class GeneralRouter extends VehicleRouter {
|
|||
|
||||
@Override
|
||||
public boolean acceptLine(RouteDataObject way) {
|
||||
return highwaySpeed.containsKey(way.getHighway());
|
||||
if(!highwaySpeed.containsKey(way.getHighway())) {
|
||||
return false;
|
||||
}
|
||||
int[] s = way.getTypes();
|
||||
|
||||
for(int i=0; i<s.length; i++) {
|
||||
RouteTypeRule r = way.region.quickGetEncodingRule(s[i]);
|
||||
String k = r.getTag() + "$" + r.getValue();
|
||||
if(avoidElements.containsKey(k)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -166,6 +166,10 @@ public class RoutingConfiguration {
|
|||
String key = attributes.getValue("tag") + "$" + attributes.getValue("value");
|
||||
currentRouter.obstacles.put(key, parseSilentDouble(attributes.getValue("penalty"),
|
||||
0));
|
||||
} else if("avoid".equals(name)) {
|
||||
String key = attributes.getValue("tag") + "$" + attributes.getValue("value");
|
||||
currentRouter.avoidElements.put(key, parseSilentDouble(attributes.getValue("coefficient"),
|
||||
0));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -48,27 +48,30 @@
|
|||
<highway value="secondary_link" speed="40" priority="1" dynamicPriority="1"/>
|
||||
|
||||
<!-- important urban roads -->
|
||||
<highway value="tertiary" speed="35" priority="0.85" dynamicPriority="0.8"/>
|
||||
<highway value="tertiary_link" speed="30" priority="0.85" dynamicPriority="0.8"/>
|
||||
<highway value="tertiary" speed="45" priority="0.85" dynamicPriority="0.8"/>
|
||||
<highway value="tertiary_link" speed="35" priority="0.85" dynamicPriority="0.8"/>
|
||||
<!-- lowest form of grid network, usually 90% of urban roads -->
|
||||
<highway value="unclassified" speed="30" priority="0.7" dynamicPriority="0.7"/>
|
||||
<highway value="unclassified" speed="35" priority="0.7" dynamicPriority="0.7"/>
|
||||
<!-- road = no type, no review and may be not accurate -->
|
||||
<highway value="road" speed="30" priority="0.4" dynamicPriority="0.7"/>
|
||||
<highway value="road" speed="35" priority="0.4" dynamicPriority="0.7"/>
|
||||
<!-- primarily for access to properties, small roads with 1/2 intersections -->
|
||||
<highway value="residential" speed="30" priority="0.4" dynamicPriority="0.7"/>
|
||||
<highway value="residential" speed="35" priority="0.4" dynamicPriority="0.7"/>
|
||||
<!-- parking + private roads -->
|
||||
<highway value="service" speed="20" priority="0.5" dynamicPriority="0.7"/>
|
||||
<highway value="service" speed="30" priority="0.5" dynamicPriority="0.7"/>
|
||||
<!-- very bad roads -->
|
||||
<highway value="track" speed="15" priority="0.3" dynamicPriority="0.5"/>
|
||||
<!-- may not be usable by cars!! -->
|
||||
<highway value="path" speed="10" priority="0.2" dynamicPriority="0.5"/>
|
||||
<!-- too small for cars usually -->
|
||||
<highway value="living_street" speed="10" priority="0.1" dynamicPriority="0.5"/>
|
||||
<highway value="living_street" speed="25" priority="0.5" dynamicPriority="0.5"/>
|
||||
<!-- car are able to enter in highway=pedestrian with restrictions -->
|
||||
|
||||
<obstacle tag="highway" value="traffic_signals" penalty="35"/>
|
||||
<obstacle tag="railway" value="crossing" penalty="25"/>
|
||||
<obstacle tag="railway" value="level_crossing" penalty="25"/>
|
||||
|
||||
<!-- in future can be multiplicator can be added (like coefficient="0.1") -->
|
||||
<avoid tag="access" value="no"/>
|
||||
</routingProfile>
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue