Package org.goplanit.osm.defaults
Class OsmModeAccessDefaultsCategory
- java.lang.Object
-
- org.goplanit.osm.defaults.OsmModeAccessDefaultsCategory
-
public class OsmModeAccessDefaultsCategory extends Object
Class representing the default mode access restrictions/allowance for modes for a given category of OSM ways, e.g. highway, railway etc., although the class itself is agnostic to what category it belongs Disallowed modes take precedence over any other setting, allowed modes take precedence over mode category settings and mode category settings define groups of allowed modes (when not present, it is assumed the category is not allowed as a whole)- Author:
- markr
-
-
Constructor Summary
Constructors Constructor Description OsmModeAccessDefaultsCategory()
Default constructorOsmModeAccessDefaultsCategory(String countryName)
Default constructorOsmModeAccessDefaultsCategory(OsmModeAccessDefaultsCategory other)
Copy constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addAllowedModeCategories(String key, String type, boolean logChanges, String... osmModeCategories)
Add the passed in mode categories as allowed for all its child modes (currently only road modes have categories)void
addAllowedModeCategories(Pair<String,String> osmKeyValueType, String... osmModeCategories)
add the passed in mode categories as allowed for all its child modesprotected void
addAllowedModes(String key, String type, boolean logChanges, List<String> osmModes)
Add the passed in modes as modes that are explicitly allowed access regardless of the mode category, i.e., this takes precedence over the categories.void
addAllowedModes(String key, String wayType, List<String> osmModes)
add the passed in modes as modes that are explicitly allowed access regardless of the mode category, i.e., this takes precedence over the categories.void
addAllowedModes(Pair<String,String> osmKeyValueType, String... osmModes)
add the passed in modes as modes that are explicitly allowed access regardless of the mode category, i.e., this takes precedence over the categories.protected void
addDisallowedModes(String key, String wayType, boolean logChanges, String... osmModes)
Add the passed in modes as modes that are explicitly NOT allowed access regardless of the mode category or allowed modes, i.e., this takes precedence over all other settings.void
addDisallowedModes(Pair<String,String> osmKeyValueType, String... osmModes)
add the passed in modes as modes that are explicitly NOT allowed access regardless of the mode category or allowed modes, i.e., this takes precedence over all other settings.String
getCountry()
The country for which these defaults hold.boolean
isAllowed(String key, String osmWayValue, String osmMode)
Verify if mode is allowed for given way type.protected void
removeAllowedModeCategories(String key, String type, boolean logChanges, String... osmModeCategories)
remove the passed in mode categories as allowed for all its child modesvoid
removeAllowedModeCategories(Pair<String,String> osmKeyValueType, String... osmModeCategories)
remove the passed in mode categories as allowed for all its child modesprotected void
removeAllowedModes(String key, String wayType, boolean logChanges, String... osmModes)
remove the passed in modes as modes that are no longer allowed access for the given way typevoid
removeAllowedModes(Pair<String,String> osmKeyValueType, String... osmModes)
remove the passed in modes as modes that are no longer allowed access for the given highway typeprotected void
removeDisallowedModes(String key, String wayType, boolean logChanges, String... osmModes)
remove the passed in modes as modes that are NOT allowed access for the given highway typevoid
removeDisallowedModes(Pair<String,String> osmKeyValueType, String... osmModes)
Remove the passed in modes as modes that are NOT allowed access for the given highway typeprotected void
setAllowedModes(String key, String type, boolean logChanges, List<String> osmModes)
Set the passed in modes as the only modes that are explicitly allowed access regardless of the mode category,void
setAllowedModes(String key, String wayType, List<String> osmModes)
set the passed in modes as the only modes that are explicitly allowed access and remove all categoriesvoid
setCountry(String countryName)
Set the country name that represents these defaultsOsmModeAccessDefaultsCategory
shallowClone()
Shallow copy
-
-
-
Constructor Detail
-
OsmModeAccessDefaultsCategory
public OsmModeAccessDefaultsCategory()
Default constructor
-
OsmModeAccessDefaultsCategory
public OsmModeAccessDefaultsCategory(String countryName)
Default constructor- Parameters:
countryName
- to use
-
OsmModeAccessDefaultsCategory
public OsmModeAccessDefaultsCategory(OsmModeAccessDefaultsCategory other)
Copy constructor- Parameters:
other
- to copy from
-
-
Method Detail
-
addAllowedModes
protected void addAllowedModes(String key, String type, boolean logChanges, List<String> osmModes)
Add the passed in modes as modes that are explicitly allowed access regardless of the mode category, i.e., this takes precedence over the categories.We must use key and type, because type alone does not uniquely define a situation, e.g., ferry=primary and highway=primary both exist, but ref;ect different road/waterway types
- Parameters:
key
- to usetype
- to uselogChanges
- when true changes are logged, otherwise notosmModes
- to add
-
setAllowedModes
protected void setAllowedModes(String key, String type, boolean logChanges, List<String> osmModes)
Set the passed in modes as the only modes that are explicitly allowed access regardless of the mode category,- Parameters:
key
- to usetype
- to uselogChanges
- when true changes are logged, otherwise notosmModes
- to add
-
addAllowedModeCategories
protected void addAllowedModeCategories(String key, String type, boolean logChanges, String... osmModeCategories)
Add the passed in mode categories as allowed for all its child modes (currently only road modes have categories)- Parameters:
key
- to usetype
- to uselogChanges
- when true changes are logged, otherwise notosmModeCategories
- to add
-
removeAllowedModeCategories
protected void removeAllowedModeCategories(String key, String type, boolean logChanges, String... osmModeCategories)
remove the passed in mode categories as allowed for all its child modes- Parameters:
key
- to usetype
- to uselogChanges
- when true changes are logged, otherwise notosmModeCategories
- to remove
-
removeAllowedModes
protected void removeAllowedModes(String key, String wayType, boolean logChanges, String... osmModes)
remove the passed in modes as modes that are no longer allowed access for the given way type- Parameters:
key
- to usewayType
- to uselogChanges
- when true changes are logged, otherwise notosmModes
- to remove
-
addDisallowedModes
protected void addDisallowedModes(String key, String wayType, boolean logChanges, String... osmModes)
Add the passed in modes as modes that are explicitly NOT allowed access regardless of the mode category or allowed modes, i.e., this takes precedence over all other settings. Note that rail modes are by definition disallowed unless explicitly allowed, so they need never be added as disallowed modes.- Parameters:
key
- to usewayType
- to uselogChanges
- when true changes are logged, otherwise notosmModes
- to disallow
-
removeDisallowedModes
protected void removeDisallowedModes(String key, String wayType, boolean logChanges, String... osmModes)
remove the passed in modes as modes that are NOT allowed access for the given highway type- Parameters:
key
- to usewayType
- to uselogChanges
- when true changes are logged, otherwise notosmModes
- to remove from disallowing
-
getCountry
public String getCountry()
The country for which these defaults hold. In absence of a country, it should return CountryNames.GLOBAL- Returns:
- country name
-
setCountry
public void setCountry(String countryName)
Set the country name that represents these defaults- Parameters:
countryName
- to set
-
shallowClone
public OsmModeAccessDefaultsCategory shallowClone()
Shallow copy- Returns:
- shallow copy
-
addAllowedModeCategories
public void addAllowedModeCategories(Pair<String,String> osmKeyValueType, String... osmModeCategories)
add the passed in mode categories as allowed for all its child modes- Parameters:
osmKeyValueType
- key value combination to useosmModeCategories
- to add
-
removeAllowedModeCategories
public void removeAllowedModeCategories(Pair<String,String> osmKeyValueType, String... osmModeCategories)
remove the passed in mode categories as allowed for all its child modes- Parameters:
osmKeyValueType
- key value combination to useosmModeCategories
- to remove
-
addAllowedModes
public void addAllowedModes(Pair<String,String> osmKeyValueType, String... osmModes)
add the passed in modes as modes that are explicitly allowed access regardless of the mode category, i.e., this takes precedence over the categories. Note that rail modes can be explicitly allowed onto roads, e.g. tram, lightrail, indicating a track embedded in the road.- Parameters:
osmKeyValueType
- key value combination to useosmModes
- to add
-
addAllowedModes
public void addAllowedModes(String key, String wayType, List<String> osmModes)
add the passed in modes as modes that are explicitly allowed access regardless of the mode category, i.e., this takes precedence over the categories. Note that rail modes can be explicitly allowed onto roads, e.g. tram, lightrail, indicating a track embedded in the road.- Parameters:
key
- to usewayType
- to useosmModes
- to add
-
setAllowedModes
public void setAllowedModes(String key, String wayType, List<String> osmModes)
set the passed in modes as the only modes that are explicitly allowed access and remove all categories- Parameters:
key
- to usewayType
- to useosmModes
- to add
-
removeAllowedModes
public void removeAllowedModes(Pair<String,String> osmKeyValueType, String... osmModes)
remove the passed in modes as modes that are no longer allowed access for the given highway type- Parameters:
osmKeyValueType
- key value combination to useosmModes
- to remove
-
addDisallowedModes
public void addDisallowedModes(Pair<String,String> osmKeyValueType, String... osmModes)
add the passed in modes as modes that are explicitly NOT allowed access regardless of the mode category or allowed modes, i.e., this takes precedence over all other settings. Note that rail modes are by definition disallowed unless explicitly allowed, so they need never be added as disallowed modes.- Parameters:
osmKeyValueType
- key value combination to useosmModes
- to disallow
-
removeDisallowedModes
public void removeDisallowedModes(Pair<String,String> osmKeyValueType, String... osmModes)
Remove the passed in modes as modes that are NOT allowed access for the given highway type- Parameters:
osmKeyValueType
- key value combination to useosmModes
- to remove from disallowing
-
isAllowed
public boolean isAllowed(String key, String osmWayValue, String osmMode)
Verify if mode is allowed for given way type. If none of the allowed/disallowed configuration options includes the passed in mode it is assumed the mode is not allowed- Parameters:
key
- to useosmWayValue
- to check forosmMode
- to verify- Returns:
- true when allowed, false when disallowed, false if unknown
-
-