Class OsmZoningHandlerBase
- java.lang.Object
-
- de.topobyte.osm4j.core.access.DefaultOsmHandler
-
- org.goplanit.osm.converter.zoning.handler.OsmZoningHandlerBase
-
- All Implemented Interfaces:
de.topobyte.osm4j.core.access.OsmHandler
- Direct Known Subclasses:
OsmZoningPostProcessingHandler
,OsmZoningPreProcessingHandler
,OsmZoningProcessingHandler
public abstract class OsmZoningHandlerBase extends de.topobyte.osm4j.core.access.DefaultOsmHandler
Base Handler for all zoning handlers. Contains shared functionality that is used across the different zoning handlers- Author:
- markr
-
-
Constructor Summary
Constructors Constructor Description OsmZoningHandlerBase(OsmPublicTransportReaderSettings transferSettings, OsmZoningReaderData zoningReaderData, Zoning zoningToPopulate, OsmZoningHandlerProfiler profiler)
constructor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected ConnectoidHelper
getConnectoidHelper()
Get the connectoid parserprotected PlanitJtsCrsUtils
getGeoUtils()
Get geo utilsprotected OsmNetworkToZoningReaderData
getNetworkToZoningData()
Get network to zoning dataprotected OsmZoningHandlerProfiler
getProfiler()
Get profilerprotected OsmPublicTransportModeHelper
getPtModeHelper()
Get the public transport mode parserprotected OsmPublicTransportReaderSettings
getSettings()
Get PT settingsprotected TransferZoneGroupHelper
getTransferZoneGroupHelper()
Get the transfer zone group parserprotected TransferZoneHelper
getTransferZoneHelper()
Get the transfer zone parserprotected Zoning
getZoning()
Collect zoningprotected OsmZoningReaderData
getZoningReaderData()
Get zoning reader dataprotected 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 linkabstract void
initialiseBeforeParsing()
Call this BEFORE we parse the OSM network to initialise the handler properlyprotected OsmPtVersionScheme
isActivatedPublicTransportInfrastructure(Map<String,String> tags)
Verify if tags represent an infrastructure used for transfers between modes, for example PT platforms, stops, etc.protected boolean
isCoveredByZoningBoundingPolygon(de.topobyte.osm4j.core.model.iface.OsmNode osmNode)
Verify if node resides on or within the zoning bounding polygon.protected boolean
isCoveredByZoningBoundingPolygon(de.topobyte.osm4j.core.model.iface.OsmWay osmWay)
Verify if OSM way has at least one node that resides within the zoning bounding polygon.protected void
logWarningIfNotNearBoundingBox(String message, org.locationtech.jts.geom.Geometry geometry)
log the given warning message but only when it is not too close to the bounding box, because then it is too likely that it is discarded due to missing infrastructure or other missing assets that could not be parsed fully as they pass through the bounding box barrier.abstract void
reset()
reset the contents, mainly to free up unused resourcesprotected boolean
skipOsmNode(de.topobyte.osm4j.core.model.iface.OsmNode osmNode)
skip osm node when marked for exclusion in settingsprotected boolean
skipOsmPtEntity(de.topobyte.osm4j.core.model.iface.OsmRelationMember member)
Skip SOM relation member when marked for exclusion in settingsprotected boolean
skipOsmWay(de.topobyte.osm4j.core.model.iface.OsmWay osmWay)
skip osm way when marked for exclusion in settings
-
-
-
Constructor Detail
-
OsmZoningHandlerBase
public OsmZoningHandlerBase(OsmPublicTransportReaderSettings transferSettings, OsmZoningReaderData zoningReaderData, Zoning zoningToPopulate, OsmZoningHandlerProfiler profiler)
constructor- Parameters:
transferSettings
- for the handlerzoningReaderData
- gather data during parsing and utilise available data from pre-processingzoningToPopulate
- to populateprofiler
- to keep track of created/parsed entities across zone handlers
-
-
Method Detail
-
skipOsmPtEntity
protected boolean skipOsmPtEntity(de.topobyte.osm4j.core.model.iface.OsmRelationMember member)
Skip SOM relation member when marked for exclusion in settings- Parameters:
member
- to verify- Returns:
- true when it should be skipped, false otherwise
-
skipOsmNode
protected boolean skipOsmNode(de.topobyte.osm4j.core.model.iface.OsmNode osmNode)
skip osm node when marked for exclusion in settings- Parameters:
osmNode
- to verify- Returns:
- true when it should be skipped, false otherwise
-
skipOsmWay
protected boolean skipOsmWay(de.topobyte.osm4j.core.model.iface.OsmWay osmWay)
skip osm way when marked for exclusion in settings- Parameters:
osmWay
- to verify- Returns:
- true when it should be skipped, false otherwise
-
isCoveredByZoningBoundingPolygon
protected boolean isCoveredByZoningBoundingPolygon(de.topobyte.osm4j.core.model.iface.OsmNode osmNode)
Verify if node resides on or within the zoning bounding polygon. If no bounding area is defined this always returns true- Parameters:
osmNode
- to verify- Returns:
- true when no bounding area, or covered by bounding area, false otherwise
-
isCoveredByZoningBoundingPolygon
protected boolean isCoveredByZoningBoundingPolygon(de.topobyte.osm4j.core.model.iface.OsmWay osmWay)
Verify if OSM way has at least one node that resides within the zoning bounding polygon. If no bounding area is defined this always returns true- Parameters:
osmWay
- to verify- Returns:
- true when no bounding area, or covered by bounding area, false otherwise
-
hasNetworkLayersWithActiveOsmNode
protected boolean hasNetworkLayersWithActiveOsmNode(long osmNodeId) throws PlanItException
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
- Throws:
PlanItException
- thrown if error
-
isActivatedPublicTransportInfrastructure
protected OsmPtVersionScheme isActivatedPublicTransportInfrastructure(Map<String,String> tags)
Verify if tags represent an infrastructure used for transfers between modes, for example PT platforms, stops, etc. and is also activated for parsing based on the related settings- Parameters:
tags
- to verify- Returns:
- which scheme it is compatible with, NONE if none could be found or if it is not active
-
logWarningIfNotNearBoundingBox
protected void logWarningIfNotNearBoundingBox(String message, org.locationtech.jts.geom.Geometry geometry) throws PlanItException
log the given warning message but only when it is not too close to the bounding box, because then it is too likely that it is discarded due to missing infrastructure or other missing assets that could not be parsed fully as they pass through the bounding box barrier. Therefore the resulting warning message is likely more confusing than helpful in those situation and is therefore ignored- Parameters:
message
- to log if not too close to bounding boxgeometry
- to determine distance to bounding box to- Throws:
PlanItException
- thrown if error
-
getGeoUtils
protected final PlanitJtsCrsUtils getGeoUtils()
Get geo utils- Returns:
- geo utils
-
getProfiler
protected final OsmZoningHandlerProfiler getProfiler()
Get profiler- Returns:
- profiler
-
getZoningReaderData
protected final OsmZoningReaderData getZoningReaderData()
Get zoning reader data- Returns:
- data
-
getZoning
protected final Zoning getZoning()
Collect zoning- Returns:
- zoning;
-
getNetworkToZoningData
protected final OsmNetworkToZoningReaderData getNetworkToZoningData()
Get network to zoning data- Returns:
- network to zoning data
-
getSettings
protected OsmPublicTransportReaderSettings getSettings()
Get PT settings- Returns:
- settings
-
getTransferZoneHelper
protected TransferZoneHelper getTransferZoneHelper()
Get the transfer zone parser- Returns:
- transfer zone parser
-
getTransferZoneGroupHelper
protected TransferZoneGroupHelper getTransferZoneGroupHelper()
Get the transfer zone group parser- Returns:
- transfer zone group parser
-
getPtModeHelper
protected OsmPublicTransportModeHelper getPtModeHelper()
Get the public transport mode parser- Returns:
- public transport mode parser
-
getConnectoidHelper
protected ConnectoidHelper getConnectoidHelper()
Get the connectoid parser- Returns:
- connectoidParser parser
-
initialiseBeforeParsing
public abstract void initialiseBeforeParsing() throws PlanItException
Call this BEFORE we parse the OSM network to initialise the handler properly- Throws:
PlanItException
- thrown if error
-
reset
public abstract void reset()
reset the contents, mainly to free up unused resources
-
-