Class OsmWaterwaySettings
- java.lang.Object
-
- org.goplanit.osm.converter.network.OsmWaySettings
-
- org.goplanit.osm.converter.network.OsmWaterwaySettings
-
public class OsmWaterwaySettings extends OsmWaySettings
Settings specific to waterways when parsing OSM files and converting them to a PLANit memory model- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
DEFAULT_WATERWAYS_PARSER_ACTIVE
by default the ferry parser is deactivated-
Fields inherited from class org.goplanit.osm.converter.network.OsmWaySettings
overwriteOsmWayTypeCapacityDensityDefaults
-
-
Constructor Summary
Constructors Constructor Description OsmWaterwaySettings(OsmSpeedLimitDefaultsCategory waterwaySpeedLimitDefaults, OsmModeAccessDefaultsCategory osmModeAccessWaterwayDefaults)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activateAllOsmWaterwayTypes()
activate all known OSM waterway typesvoid
activateOsmWaterMode(String osmWaterMode)
activate an OSM water way mode based on its (default) mapping to a PLANit mode.void
activateOsmWaterwayType(String osmWayValue)
Choose to add given waterway type to parsed types on top of the defaults, e.g.void
activateOsmWaterwayTypes(String... osmWaterwayValueTypes)
activate all passed in waterway typesvoid
activateOsmWaterwayTypes(List<String> osmWaterwayValueTypes)
activate all passed in waterway typesCollection<String>
collectAllowedOsmWaterwayModes(String osmWaterwayType)
Collect all OSM modes that are allowed for the given OSM waterway type as configured by the user.void
deactivateAllOsmWaterModes()
remove all water modes from mappingvoid
deactivateAllOsmWaterModesExcept(String... remainingOsmWaterModes)
remove all water modes from mapping except for the passed in onesvoid
deactivateAllOsmWaterModesExcept(List<String> remainingOsmWaterModes)
remove all water modes from mapping except for the passed in onesvoid
deactivateAllOsmWaterwayTypes()
deactivate all types for waterwaysvoid
deactivateAllOsmWaterwayTypesExcept(String... osmWaterwayTypes)
deactivate all types for railway except the ones providesvoid
deactivateAllOsmWaterwayTypesExcept(List<String> osmWaterwayTypes)
deactivate all types for waterway except the ones providesvoid
deactivateOsmWaterMode(String osmWaterMode)
Remove a mapping from OSM water mode to PLANit mode.void
deactivateOsmWaterModes(String... osmWaterModes)
deactivate provided water modesvoid
deactivateOsmWaterModes(List<String> osmWaterModes)
remove a mapping from OSM water modes to PLANit modes.void
deactivateOsmWaterwayType(String osmWayValue)
Choose to not parse the given waterway type, e.g.Double
getDefaultSpeedLimitByOsmWaterwayType(String waterwayValue)
Collect the default speed limit for waterwaysCollection<String>
getMappedOsmWaterModes(PredefinedModeType planitModeType)
Convenience method that collects the currently mapped OSM water modes for the given PLANit modePredefinedModeType
getMappedPlanitWaterMode(String osmMode)
convenience method that collects the currently mapped PLANit mode for the given OSM modePair<Double,Double>
getOverwrittenCapacityMaxDensityByOsmWaterwayRouteType(String osmWayRouteType)
Collect the overwritten type values that should be usedprotected void
initialiseDefaultMappingFromOsmWaterModes2PlanitModes()
each OSM water based mode is mapped (or not) to a PLANit mode by default so that the memory model's modes are user configurable yet linked to the original format.boolean
isDefaultCapacityOrMaxDensityOverwrittenByOsmWaterwayRouteType(String osmWayType)
check if defaults should be overwrittenboolean
isOsmWaterwayTypeActivated(String osmWayValue)
Verify if the passed in OSM waterway type is explicitly activated.boolean
isOsmWaterwayTypeDeactivated(String osmWaterWayValue)
Verify if the passed in OSM waterway type is explicitly deactivated.void
logSettings()
log way specific settings for derived classesvoid
logUnsupportedOsmWaterwayTypes()
Log all de-activated OSM waterway typesvoid
overwriteCapacityMaxDensityDefaults(String osmWaterwayType, Number capacityPcuPerLanePerHour, Number maxDensityPcuPerLane)
Choose to overwrite the given waterway route type defaults with the given values-
Methods inherited from class org.goplanit.osm.converter.network.OsmWaySettings
activateAllOsmWayTypes, activateOsmMode, activateOsmWayType, activateOsmWayTypes, activateOsmWayTypes, activateParser, addAllowedOsmWayModes, addDefaultOsmMode2PlanitPredefinedModeTypeMapping, collectAllowedOsmWayModes, deactivateAllModesExcept, deactivateAllOsmWayTypes, deactivateOsmMode, deactivateOsmModes, deactivateOsmWayType, excludeOsmWayTypesWithoutActivatedModes, getAcivatedOsmModes, getAcivatedOsmModes, getActivatedPlanitModeTypesStream, getDefaultSpeedLimitByOsmTypeValue, getDefaultSpeedLimitByOsmWayType, getOverwrittenCapacityMaxDensityByOsmWayType, getPlanitModeTypeIfActivated, getSetOfActivatedOsmWayLikeTypes, hasActivatedOsmModeOtherThan, isDefaultCapacityOrMaxDensityOverwrittenByOsmWayType, isModeAllowedOnOsmWay, isOsmModeActivated, isOsmWayTypeActivated, isOsmWayTypeDeactivated, isParserActive, logUnsupportedOsmWayTypes, overwriteOsmWayTypeDefaultCapacityMaxDensity, setOsmMode2PlanitModeTypeMapping
-
-
-
-
Constructor Detail
-
OsmWaterwaySettings
public OsmWaterwaySettings(OsmSpeedLimitDefaultsCategory waterwaySpeedLimitDefaults, OsmModeAccessDefaultsCategory osmModeAccessWaterwayDefaults)
Constructor- Parameters:
waterwaySpeedLimitDefaults
- as they are initially providedosmModeAccessWaterwayDefaults
- configuration
-
-
Method Detail
-
initialiseDefaultMappingFromOsmWaterModes2PlanitModes
protected void initialiseDefaultMappingFromOsmWaterModes2PlanitModes()
each OSM water based mode is mapped (or not) to a PLANit mode by default so that the memory model's modes are user configurable yet linked to the original format. Note that when the reader is used i.c.w. a network writer to convert one network to the other. It is paramount that the PLANit modes that are mapped here are also mapped by the writer to the output format to ensure a correct I/O mapping of modes The default mapping is provided below. In contrast to road modes, rail modes do not have specific restrictions. Hence, we can map more exotic OSM rail modes to more common PLANit rail modes, without imposing its restrictions on this common mode.- FERRY to FerryMode
-
isOsmWaterwayTypeDeactivated
public boolean isOsmWaterwayTypeDeactivated(String osmWaterWayValue)
Verify if the passed in OSM waterway type is explicitly deactivated. Deactivated route types will be ignored when processing ways.- Parameters:
osmWaterWayValue
- , e.g. ferry (waterways are directly linked to modes) or a highway type (Assuming the key was ferry, e.g. ferry=_a_highway_type_- Returns:
- true when unSupported, false if not (which means it is either supported, or not registered)
-
isOsmWaterwayTypeActivated
public boolean isOsmWaterwayTypeActivated(String osmWayValue)
Verify if the passed in OSM waterway type is explicitly activated. Activated types will be processed and converted into link(segments).- Parameters:
osmWayValue
- , e.g. ferry (waterways are directly linked to modes) or a highway type (Assuming the key was ferry, e.g. ferry=_a_highway_type_- Returns:
- true when supported, false if not (which means it is unsupported, or not registered)
-
deactivateOsmWaterwayType
public void deactivateOsmWaterwayType(String osmWayValue)
Choose to not parse the given waterway type, e.g. ferry=primary.- Parameters:
osmWayValue
- to use
-
deactivateAllOsmWaterwayTypesExcept
public void deactivateAllOsmWaterwayTypesExcept(String... osmWaterwayTypes)
deactivate all types for railway except the ones provides- Parameters:
osmWaterwayTypes
- to not deactivate
-
deactivateAllOsmWaterwayTypesExcept
public void deactivateAllOsmWaterwayTypesExcept(List<String> osmWaterwayTypes)
deactivate all types for waterway except the ones provides- Parameters:
osmWaterwayTypes
- to not deactivate
-
activateOsmWaterwayType
public void activateOsmWaterwayType(String osmWayValue)
Choose to add given waterway type to parsed types on top of the defaults, e.g. ferry=primary.- Parameters:
osmWayValue
- to use
-
activateOsmWaterwayTypes
public void activateOsmWaterwayTypes(String... osmWaterwayValueTypes)
activate all passed in waterway types- Parameters:
osmWaterwayValueTypes
- to activate
-
activateOsmWaterwayTypes
public void activateOsmWaterwayTypes(List<String> osmWaterwayValueTypes)
activate all passed in waterway types- Parameters:
osmWaterwayValueTypes
- to activate
-
activateAllOsmWaterwayTypes
public void activateAllOsmWaterwayTypes()
activate all known OSM waterway types
-
deactivateAllOsmWaterwayTypes
public void deactivateAllOsmWaterwayTypes()
deactivate all types for waterways
-
logUnsupportedOsmWaterwayTypes
public void logUnsupportedOsmWaterwayTypes()
Log all de-activated OSM waterway types
-
overwriteCapacityMaxDensityDefaults
public void overwriteCapacityMaxDensityDefaults(String osmWaterwayType, Number capacityPcuPerLanePerHour, Number maxDensityPcuPerLane)
Choose to overwrite the given waterway route type defaults with the given values- Parameters:
osmWaterwayType
- the type to set these values forcapacityPcuPerLanePerHour
- new value in pcu/lane/hmaxDensityPcuPerLane
- new value pcu/km/lane
-
isDefaultCapacityOrMaxDensityOverwrittenByOsmWaterwayRouteType
public boolean isDefaultCapacityOrMaxDensityOverwrittenByOsmWaterwayRouteType(String osmWayType)
check if defaults should be overwritten- Parameters:
osmWayType
- to check- Returns:
- true when new defaults are provided, false otherwise
-
getOverwrittenCapacityMaxDensityByOsmWaterwayRouteType
public final Pair<Double,Double> getOverwrittenCapacityMaxDensityByOsmWaterwayRouteType(String osmWayRouteType)
Collect the overwritten type values that should be used- Parameters:
osmWayRouteType
- to collect overwrite values for- Returns:
- the new values capacity (pcu/lane/h) and maxDensity (pcu/km/lane)
-
getDefaultSpeedLimitByOsmWaterwayType
public Double getDefaultSpeedLimitByOsmWaterwayType(String waterwayValue)
Collect the default speed limit for waterways- Parameters:
waterwayValue
- value to use- Returns:
- speedLimit in km/h
-
activateOsmWaterMode
public void activateOsmWaterMode(String osmWaterMode)
activate an OSM water way mode based on its (default) mapping to a PLANit mode. This means that the osmMode will be added to the PLANit network- Parameters:
osmWaterMode
- to activate
-
deactivateOsmWaterMode
public void deactivateOsmWaterMode(String osmWaterMode)
Remove a mapping from OSM water mode to PLANit mode. This means that the osmMode will not be added to the PLANit network You can only remove a mode when it is already added, either manually or through the default mapping- Parameters:
osmWaterMode
- to remove
-
deactivateOsmWaterModes
public void deactivateOsmWaterModes(List<String> osmWaterModes)
remove a mapping from OSM water modes to PLANit modes. This means that the osmModes will not be added to the PLANit network You can only remove modes when they are already added, either manually or through the default mapping- Parameters:
osmWaterModes
- to remove
-
deactivateOsmWaterModes
public void deactivateOsmWaterModes(String... osmWaterModes)
deactivate provided water modes- Parameters:
osmWaterModes
- to explicitly deactivate
-
deactivateAllOsmWaterModes
public void deactivateAllOsmWaterModes()
remove all water modes from mapping
-
deactivateAllOsmWaterModesExcept
public void deactivateAllOsmWaterModesExcept(String... remainingOsmWaterModes)
remove all water modes from mapping except for the passed in ones- Parameters:
remainingOsmWaterModes
- to explicitly keep if present
-
deactivateAllOsmWaterModesExcept
public void deactivateAllOsmWaterModesExcept(List<String> remainingOsmWaterModes)
remove all water modes from mapping except for the passed in ones- Parameters:
remainingOsmWaterModes
- to explicitly keep if present
-
getMappedPlanitWaterMode
public PredefinedModeType getMappedPlanitWaterMode(String osmMode)
convenience method that collects the currently mapped PLANit mode for the given OSM mode- Parameters:
osmMode
- to collect mapped mode type for (if any)- Returns:
- mapped PLANit mode, if not available null is returned
-
getMappedOsmWaterModes
public final Collection<String> getMappedOsmWaterModes(PredefinedModeType planitModeType)
Convenience method that collects the currently mapped OSM water modes for the given PLANit mode- Parameters:
planitModeType
- to collect mapped mode for (if any)- Returns:
- mapped OSM modes, if not available empty collection is returned
-
collectAllowedOsmWaterwayModes
public Collection<String> collectAllowedOsmWaterwayModes(String osmWaterwayType)
Collect all OSM modes that are allowed for the given OSM waterway type as configured by the user. Note we allow tagging values related to the key route=_mode_, e.g., ferry, as well as the de-factor standard where the 'ferry' is used as keyword and the way type reflects the equivalent of highway options, e.g., trunk, as in ferry=trunk.- Parameters:
osmWaterwayType
- to use- Returns:
- allowed OsmModes found, empty if none
-
logSettings
public void logSettings()
log way specific settings for derived classes- Specified by:
logSettings
in classOsmWaySettings
-
-