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(Zoning zoning, OsmZoningReaderData zoningReaderData, OsmPublicTransportReaderSettings transferSettings, OsmZoningHandlerProfiler profiler)Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description TransferZoneGroupcreateAndPopulateTransferZoneGroup(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 accessTransferZoneGroupcreatePopulateAndRegisterTransferZoneGroup(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 OsmNetworkToZoningReaderDatagetNetworkToZoningData()collect network to zoning data from settingsprotected OsmPublicTransportReaderSettingsgetSettings()Collect the pt settingsprotected booleanhasNetworkLayersWithActiveOsmNode(long osmNodeId)Verify if there exist any layers where the node is active either as an extreme node or internal to a PLANit linkbooleanregisterTransferZoneOnGroup(long osmId, de.topobyte.osm4j.core.model.iface.EntityType type, TransferZoneGroup transferZoneGroup)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.booleanregisterTransferZoneOnGroup(de.topobyte.osm4j.core.model.iface.OsmEntity osmEntity, TransferZoneGroup transferZoneGroup)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.booleanregisterTransferZoneOnGroup(de.topobyte.osm4j.core.model.iface.OsmNode osmNode, Map<String,String> tags, TransferZoneGroup transferZoneGroup)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 voidupdateTransferZoneGroupStationName(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(Zoning zoning, OsmZoningReaderData zoningReaderData, OsmPublicTransportReaderSettings transferSettings, OsmZoningHandlerProfiler profiler)
Constructor- Parameters:
zoning- to register transfer zone groups onzoningReaderData- to usetransferSettings- to useprofiler- to track stats
-
-
Method Detail
-
updateTransferZoneGroupStationName
public static void updateTransferZoneGroupStationName(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 agains (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)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 on- Returns:
- true when registered on the group, false otherwise
-
registerTransferZoneOnGroup
public boolean registerTransferZoneOnGroup(de.topobyte.osm4j.core.model.iface.OsmEntity osmEntity, TransferZoneGroup transferZoneGroup)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 on- 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)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 on- Returns:
- true when registered on the group, false otherwise
-
getSettings
protected OsmPublicTransportReaderSettings getSettings()
Collect the pt settings- Returns:
- pulibc transport settings
-
getNetworkToZoningData
protected OsmNetworkToZoningReaderData getNetworkToZoningData()
collect network to zoning data from settings- Returns:
- network to zoning data
-
hasNetworkLayersWithActiveOsmNode
protected boolean hasNetworkLayersWithActiveOsmNode(long osmNodeId) throws PlanItExceptionVerify 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
- Throws:
PlanItException- thrown if error
-
-