Package org.goplanit.osm.defaults
Class OsmModeAccessDefaultsCategory
- java.lang.Object
-
- org.goplanit.osm.defaults.OsmModeAccessDefaultsCategory
-
- All Implemented Interfaces:
Cloneable
public class OsmModeAccessDefaultsCategory extends Object implements Cloneable
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 type, boolean logChanges, String... osmModeCategories)
add the passed in mode categories as allowed for all its child modesvoid
addAllowedModeCategories(String wayType, String... osmModeCategories)
add the passed in mode categories as allowed for all its child modesprotected void
addAllowedModes(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 wayType, 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 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.protected void
addDisallowedModes(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(String wayType, 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.OsmModeAccessDefaultsCategory
clone()
String
getCountry()
The country for which these defaults hold.boolean
isAllowed(String osmWayValue, String osmMode)
Verify if mode is allowed for given way type.protected void
removeAllowedModeCategories(String type, boolean logChanges, String... osmModeCategories)
remove the passed in mode categories as allowed for all its child modesvoid
removeAllowedModeCategories(String wayType, String... osmModeCategories)
remove the passed in mode categories as allowed for all its child modesprotected void
removeAllowedModes(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(String wayType, String... osmModes)
remove the passed in modes as modes that are no longer allowed access for the given highway typeprotected void
removeDisallowedModes(String wayType, boolean logChanges, String... osmModes)
remove the passed in modes as modes that are NOT allowed access for the given highway typevoid
removeDisallowedModes(String wayType, String... osmModes)
Remove the passed in modes as modes that are NOT allowed access for the given highway typeprotected void
setAllowedModes(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 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 defaults
-
-
-
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 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.- Parameters:
type
- to uselogChanges
- when true changes are logged, otherwise notosmModes
- to add
-
setAllowedModes
protected void setAllowedModes(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:
type
- to uselogChanges
- when true changes are logged, otherwise notosmModes
- to add
-
addAllowedModeCategories
protected void addAllowedModeCategories(String type, boolean logChanges, String... osmModeCategories)
add the passed in mode categories as allowed for all its child modes- Parameters:
type
- to uselogChanges
- when true changes are logged, otherwise notosmModeCategories
- to add
-
removeAllowedModeCategories
protected void removeAllowedModeCategories(String type, boolean logChanges, String... osmModeCategories)
remove the passed in mode categories as allowed for all its child modes- Parameters:
type
- to uselogChanges
- when true changes are logged, otherwise notosmModeCategories
- to remove
-
removeAllowedModes
protected void removeAllowedModes(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:
wayType
- to uselogChanges
- when true changes are logged, otherwise notosmModes
- to remove
-
addDisallowedModes
protected void addDisallowedModes(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:
wayType
- to uselogChanges
- when true changes are logged, otherwise notosmModes
- to disallow
-
removeDisallowedModes
protected void removeDisallowedModes(String wayType, boolean logChanges, String... osmModes)
remove the passed in modes as modes that are NOT allowed access for the given highway type- Parameters:
wayType
- 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
-
clone
public OsmModeAccessDefaultsCategory clone() throws CloneNotSupportedException
- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
-
addAllowedModeCategories
public void addAllowedModeCategories(String wayType, String... osmModeCategories)
add the passed in mode categories as allowed for all its child modes- Parameters:
wayType
- to useosmModeCategories
- to add
-
removeAllowedModeCategories
public void removeAllowedModeCategories(String wayType, String... osmModeCategories)
remove the passed in mode categories as allowed for all its child modes- Parameters:
wayType
- to useosmModeCategories
- to remove
-
addAllowedModes
public void addAllowedModes(String wayType, 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:
wayType
- to useosmModes
- to add
-
addAllowedModes
public void addAllowedModes(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:
wayType
- to useosmModes
- to add
-
setAllowedModes
public void setAllowedModes(String wayType, List<String> osmModes)
set the passed in modes as the only modes that are explicitly allowed access and remove all categories- Parameters:
wayType
- to useosmModes
- to add
-
removeAllowedModes
public void removeAllowedModes(String wayType, String... osmModes)
remove the passed in modes as modes that are no longer allowed access for the given highway type- Parameters:
wayType
- to useosmModes
- to remove
-
addDisallowedModes
public void addDisallowedModes(String wayType, 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:
wayType
- to useosmModes
- to disallow
-
removeDisallowedModes
public void removeDisallowedModes(String wayType, String... osmModes)
Remove the passed in modes as modes that are NOT allowed access for the given highway type- Parameters:
wayType
- to useosmModes
- to remove from disallowing
-
isAllowed
public boolean isAllowed(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:
osmWayValue
- to check forosmMode
- to verify- Returns:
- true when allowed, false when disallowed, false if unknown
-
-