Class OsmModeHelper
- java.lang.Object
-
- org.goplanit.osm.converter.helper.OsmModeHelper
-
- Direct Known Subclasses:
OsmNetworkLayerModeParser
,OsmPublicTransportModeHelper
public class OsmModeHelper extends Object
Class to support parsing and other functionality that depends on the configuration of the readers regarding OSM modes and their mappng to PLANit modes- Author:
- markr
-
-
Constructor Summary
Constructors Constructor Description OsmModeHelper(OsmNetworkReaderSettings settings)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<Link>
filterModeCompatibleLinks(Collection<String> referenceOsmModes, Collection<Link> 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 modeprotected 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
-
OsmModeHelper
public OsmModeHelper(OsmNetworkReaderSettings settings)
Constructor- Parameters:
settings
- to use
-
-
Method Detail
-
getSettings
protected OsmNetworkReaderSettings getSettings()
Collect the settings containing the mapping between PLANit and OSM modes- Returns:
- settings used
-
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<Link> filterModeCompatibleLinks(Collection<String> referenceOsmModes, Collection<Link> 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
-
-