Class TransferZoneGroupHelper
- java.lang.Object
-
- org.goplanit.osm.converter.zoning.handler.helper.TransferZoneGroupHelper
-
public class TransferZoneGroupHelper extends Object
Class to provide functionality for parsing PLANit transfer zone groups from OSM entities- Author:
- markr
-
-
Constructor Summary
Constructors Constructor Description TransferZoneGroupHelper(PlanitOsmNetwork referenceNetwork, Zoning zoning, OsmZoningReaderData zoningReaderData, OsmNetworkToZoningReaderData network2ZoningData, OsmPublicTransportReaderSettings transferSettings, OsmZoningHandlerProfiler profiler)
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description TransferZoneGroup
createAndPopulateTransferZoneGroup(de.topobyte.osm4j.core.model.iface.OsmRelation osmRelation, Map<String,String> tags)
Create a transfer zone group based on the passed in OSM entity, tags for feature extraction and accessTransferZoneGroup
createPopulateAndRegisterTransferZoneGroup(de.topobyte.osm4j.core.model.iface.OsmRelation osmRelation, Map<String,String> tags)
Create a transfer zone group based on the passed in OSM entity, tags for feature extraction and access and register itSet<TransferZoneGroup>
findModeCompatibleTransferZoneGroups(Collection<String> referenceOsmModes, Collection<TransferZone> potentialTransferZones, boolean allowPseudoModeMatches)
Find all transfer zone groups with at least one transfer zone that is mode compatible (and planit mode mapped) with the passed in osm modes In case no eligible modes are provided (null).protected Pair<Integer,Boolean>
findOsmVerticalLayerIndexByStopPositionPlanitLinks(org.locationtech.jts.geom.Point stopPositionLocation, NetworkLayer layer)
Based on the location of the stop position, determine if the PLANit links that it resides on, or borders or reside in a particular layer.protected OsmNetworkToZoningReaderData
getNetworkToZoningData()
protected PlanitOsmNetwork
getReferenceNetwork()
protected OsmPublicTransportReaderSettings
getSettings()
Collect the pt settingsprotected boolean
hasNetworkLayersWithActiveOsmNode(long osmNodeId)
Verify if there exist any layers where the node is active either as an extreme node or internal to a PLANit linkboolean
registerTransferZoneOnGroup(long osmId, de.topobyte.osm4j.core.model.iface.EntityType type, TransferZoneGroup transferZoneGroup, boolean suppressLogging)
Register a transfer zone on a group by providing the OSM id of the transfer zone and its type, if no transfer zone is available for this combination, false is returned and it is not registered.boolean
registerTransferZoneOnGroup(de.topobyte.osm4j.core.model.iface.OsmEntity osmEntity, TransferZoneGroup transferZoneGroup, boolean suppressLogging)
Register a transfer zone on a group by providing the OSM entity, if no transfer zone is available for this combination, false is returned and it is not registered.boolean
registerTransferZoneOnGroup(de.topobyte.osm4j.core.model.iface.OsmNode osmNode, Map<String,String> tags, TransferZoneGroup transferZoneGroup, boolean suppressLogging)
Register a transfer zone on a group by providing the OSM node, if no transfer zone is available for this combination, false is returned and it is not registered.static void
updateTransferZoneGroupName(TransferZoneGroup transferZoneGroup, de.topobyte.osm4j.core.model.iface.OsmEntity osmEntityStation, Map<String,String> tags)
Process an OSM entity that is classified as a (train) station.
-
-
-
Constructor Detail
-
TransferZoneGroupHelper
public TransferZoneGroupHelper(PlanitOsmNetwork referenceNetwork, Zoning zoning, OsmZoningReaderData zoningReaderData, OsmNetworkToZoningReaderData network2ZoningData, OsmPublicTransportReaderSettings transferSettings, OsmZoningHandlerProfiler profiler)
Constructor- Parameters:
referenceNetwork
- to usezoning
- to register transfer zone groups onzoningReaderData
- to usenetwork2ZoningData
- data transferred from parsing network to be used by zoning reader.transferSettings
- to useprofiler
- to track stats
-
-
Method Detail
-
updateTransferZoneGroupName
public static void updateTransferZoneGroupName(TransferZoneGroup transferZoneGroup, de.topobyte.osm4j.core.model.iface.OsmEntity osmEntityStation, Map<String,String> tags)
Process an OSM entity that is classified as a (train) station. For this to register on the group, we only see if we can utilise its name and use it for the group, but only if the group does not already have a name- Parameters:
transferZoneGroup
- the osm station relates toosmEntityStation
- of the relation to processtags
- of the osm entity representation a station
-
createAndPopulateTransferZoneGroup
public TransferZoneGroup createAndPopulateTransferZoneGroup(de.topobyte.osm4j.core.model.iface.OsmRelation osmRelation, Map<String,String> tags)
Create a transfer zone group based on the passed in OSM entity, tags for feature extraction and access- Parameters:
osmRelation
- the stop_area is based ontags
- tags to extract features from- Returns:
- transfer zone group created
-
createPopulateAndRegisterTransferZoneGroup
public TransferZoneGroup createPopulateAndRegisterTransferZoneGroup(de.topobyte.osm4j.core.model.iface.OsmRelation osmRelation, Map<String,String> tags)
Create a transfer zone group based on the passed in OSM entity, tags for feature extraction and access and register it- Parameters:
osmRelation
- the stop_area is based ontags
- tags to extract features from- Returns:
- transfer zone group created
-
findModeCompatibleTransferZoneGroups
public Set<TransferZoneGroup> findModeCompatibleTransferZoneGroups(Collection<String> referenceOsmModes, Collection<TransferZone> potentialTransferZones, boolean allowPseudoModeMatches)
Find all transfer zone groups with at least one transfer zone that is mode compatible (and planit mode mapped) with the passed in osm modes In case no eligible modes are provided (null).- Parameters:
referenceOsmModes
- to map against (may be null)potentialTransferZones
- to extract transfer zone groups 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 transfer zone groups
-
registerTransferZoneOnGroup
public boolean registerTransferZoneOnGroup(long osmId, de.topobyte.osm4j.core.model.iface.EntityType type, TransferZoneGroup transferZoneGroup, boolean suppressLogging)
Register a transfer zone on a group by providing the OSM id of the transfer zone and its type, if no transfer zone is available for this combination, false is returned and it is not registered.- Parameters:
type
- of the OSM entityosmId
- OSM id of the transfer zonetransferZoneGroup
- to register onsuppressLogging
- when true suppress logging- Returns:
- true when registered on the group, false otherwise
-
registerTransferZoneOnGroup
public boolean registerTransferZoneOnGroup(de.topobyte.osm4j.core.model.iface.OsmEntity osmEntity, TransferZoneGroup transferZoneGroup, boolean suppressLogging)
Register a transfer zone on a group by providing the OSM entity, if no transfer zone is available for this combination, false is returned and it is not registered.- Parameters:
osmEntity
- to collect transfer zone for and registertransferZoneGroup
- to register onsuppressLogging
- when true suppress logging- Returns:
- true when registered on the group, false otherwise
-
registerTransferZoneOnGroup
public boolean registerTransferZoneOnGroup(de.topobyte.osm4j.core.model.iface.OsmNode osmNode, Map<String,String> tags, TransferZoneGroup transferZoneGroup, boolean suppressLogging)
Register a transfer zone on a group by providing the OSM node, if no transfer zone is available for this combination, false is returned and it is not registered.- Parameters:
osmNode
- to collect transfer zone for and registertags
- to usetransferZoneGroup
- to register onsuppressLogging
- when true suppress logging- Returns:
- true when registered on the group, false otherwise
-
getSettings
protected OsmPublicTransportReaderSettings getSettings()
Collect the pt settings- Returns:
- public transport settings
-
getReferenceNetwork
protected PlanitOsmNetwork getReferenceNetwork()
-
getNetworkToZoningData
protected OsmNetworkToZoningReaderData getNetworkToZoningData()
-
hasNetworkLayersWithActiveOsmNode
protected boolean hasNetworkLayersWithActiveOsmNode(long osmNodeId)
Verify if there exist any layers where the node is active either as an extreme node or internal to a PLANit link- Parameters:
osmNodeId
- to use- Returns:
- true when one or more layers are found, false otherwise
-
findOsmVerticalLayerIndexByStopPositionPlanitLinks
protected Pair<Integer,Boolean> findOsmVerticalLayerIndexByStopPositionPlanitLinks(org.locationtech.jts.geom.Point stopPositionLocation, NetworkLayer layer)
Based on the location of the stop position, determine if the PLANit links that it resides on, or borders or reside in a particular layer. If so, the OSM vertical layer index is retrieved and provided. If inconsistent indices are found across the links the user is warned, if no matching links are known on the layer null is returned.- Parameters:
stopPositionLocation
- to find layer index forlayer
- to check- Returns:
- OSM vertical layer index found, and boolean indicating if the found layer index was the same across all eligible links (true), false otherwise
-
-