Package org.goplanit.osm.converter
Class OsmModeConversionBase
- java.lang.Object
-
- org.goplanit.osm.converter.OsmModeConversionBase
-
- Direct Known Subclasses:
OsmNetworkLayerModeConversion
,OsmPublicTransportModeConversion
public class OsmModeConversionBase extends Object
Class to support parsing and other functionality that depends on the configuration of the readers regarding OSM modes and their mapping to PLANit modes as well as the subset of modes provided so limit itself to, can be all modes but also just modes for a given layer- Author:
- markr
-
-
Constructor Summary
Constructors Constructor Description OsmModeConversionBase(OsmNetworkReaderSettings settings, Iterable<Mode> layerModes)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<MacroscopicLink>
filterModeCompatibleLinks(Collection<String> referenceOsmModes, Collection<MacroscopicLink> potentialLinks, boolean allowPseudoModeMatches)
Find all links with at least one compatible mode (and PLANit mode mapped) based on the passed in reference OSM modes and potential links In case no eligible modes are provided (null), we allow any transfer zone with at least one valid mapped modeMode
getActivatedPlanitMode(String osmMode)
Convenience method that collects the currently mapped PLANit modes (road or rail) for the given OSM modesSet<Mode>
getActivatedPlanitModes(Collection<String> osmModes)
Convenience method that collects the currently mapped PLANit modes (road or rail) for the given OSM modesprotected OsmNetworkReaderSettings
getSettings()
Collect the settings containing the mapping between PLANit and OSM modesboolean
isLinkModeCompatible(Link link, Collection<String> referenceOsmModes, boolean allowPseudoMatches)
Find out if PLANit link is mode compatible with the passed in reference OSM modes.boolean
isModeCompatible(Collection<String> osmModesToCheck, Collection<String> referenceOsmModes, boolean allowPseudoMatches)
find out if link osmModesToCheck are compatible with the passed in reference osm modes.
-
-
-
Constructor Detail
-
OsmModeConversionBase
public OsmModeConversionBase(OsmNetworkReaderSettings settings, Iterable<Mode> layerModes)
Constructor- Parameters:
settings
- to uselayerModes
- in use across the network we are populating
-
-
Method Detail
-
getSettings
protected OsmNetworkReaderSettings getSettings()
Collect the settings containing the mapping between PLANit and OSM modes- Returns:
- settings used
-
getActivatedPlanitModes
public Set<Mode> getActivatedPlanitModes(Collection<String> osmModes)
Convenience method that collects the currently mapped PLANit modes (road or rail) for the given OSM modes- Parameters:
osmModes
- to collect mapped mode for (if any)- Returns:
- mapped PLANit modes, if not available empty set is returned
-
getActivatedPlanitMode
public Mode getActivatedPlanitMode(String osmMode)
Convenience method that collects the currently mapped PLANit modes (road or rail) for the given OSM modes- Parameters:
osmMode
- to collect mapped mode for (if any)- Returns:
- mapped PLANit mode, if not available null is returned
-
isModeCompatible
public boolean isModeCompatible(Collection<String> osmModesToCheck, Collection<String> referenceOsmModes, boolean allowPseudoMatches)
find out if link osmModesToCheck are compatible with the passed in reference osm modes. Mode compatible means at least one overlapping mode that is mapped to a planit mode. When one allows for pseudo comaptibility we relax the restrictions such that any rail/road/water mode is considered a match with any other rail/road/water mode. This can be useful when you do not want to make super strict matches but still want to filter out definite non-matches.- Parameters:
osmModesToCheck
- to checkreferenceOsmModes
- to map against (may be null)allowPseudoMatches
- when true, we consider all road modes compatible, i.e., bus is compatible with car, train is compatible with tram, etc., when false only exact matches are accepted- Returns:
- matched transfer zones
-
isLinkModeCompatible
public boolean isLinkModeCompatible(Link link, Collection<String> referenceOsmModes, boolean allowPseudoMatches)
Find out if PLANit link is mode compatible with the passed in reference OSM modes. Mode compatible means at least one overlapping mode that is mapped to a PLANit mode. If the zone has no known modes, it is by definition not mode compatible. When one allows for pseudo compatibility we relax the restrictions such that any rail/road/water mode is considered a match with any other rail/road/water mode. This can be useful when you do not want to make super strict matches but still want to filter out definite non-matches.- Parameters:
link
- to verifyreferenceOsmModes
- to map against (may be null)allowPseudoMatches
- when true, we consider all road modes compatible, i.e., bus is compatible with car, train is compatible with tram, etc., when false only exact matches are accepted- Returns:
- matched transfer zones
-
filterModeCompatibleLinks
public Collection<MacroscopicLink> filterModeCompatibleLinks(Collection<String> referenceOsmModes, Collection<MacroscopicLink> potentialLinks, boolean allowPseudoModeMatches)
Find all links with at least one compatible mode (and PLANit mode mapped) based on the passed in reference OSM modes and potential links In case no eligible modes are provided (null), we allow any transfer zone with at least one valid mapped mode- Parameters:
referenceOsmModes
- to map against (may be null)potentialLinks
- to extract mode compatible links fromallowPseudoModeMatches
- , when true only broad category needs to match, i.e., both have a road/rail/water mode, when false only exact matches are allowed- Returns:
- matched links that are deemed compatible
-
-