Class OsmZoningHandlerBase

    • Constructor Detail

      • OsmZoningHandlerBase

        public OsmZoningHandlerBase​(OsmPublicTransportReaderSettings transferSettings,
                                    OsmZoningReaderData zoningReaderData,
                                    OsmNetworkToZoningReaderData network2ZoningData,
                                    PlanitOsmNetwork referenceNetwork,
                                    Zoning zoningToPopulate,
                                    OsmZoningHandlerProfiler profiler)
        constructor
        Parameters:
        transferSettings - for the handler
        zoningReaderData - gather data during parsing and utilise available data from pre-processing
        network2ZoningData - data transferred from parsing network to be used by zoning reader.
        referenceNetwork - to use
        zoningToPopulate - to populate
        profiler - 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
      • isNearNetworkBoundingBox

        protected boolean isNearNetworkBoundingBox​(de.topobyte.osm4j.core.model.iface.OsmNode osmNode)
        Verify if node resides near the zoning bounding polygon based on #OsmNetworkReaderData. 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)
        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
      • 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)
        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 box
        geometry - to determine distance to bounding box to
      • wrapHandlePtOsmWay

        protected void wrapHandlePtOsmWay​(de.topobyte.osm4j.core.model.iface.OsmWay osmWay,
                                          TriConsumer<de.topobyte.osm4j.core.model.iface.OsmWay,​OsmPtVersionScheme,​Map<String,​String>> osmWayConsumer)
        Wrap the handling of OSM way for OSM zoning by checking if it is eligible and catch any run time PLANit exceptions, if eligible delegate to consumer.
        Parameters:
        osmWay - to parse
        osmWayConsumer - to apply to eligible OSM way
      • wrapHandlePtOsmRelation

        protected void wrapHandlePtOsmRelation​(de.topobyte.osm4j.core.model.iface.OsmRelation osmRelation,
                                               BiConsumer<de.topobyte.osm4j.core.model.iface.OsmRelation,​Map<String,​String>> osmRelationConsumer)
        Wrap the handling of OSM relation by performing basic checks on eligibility and wrapping any run time excpetions thrown
        Parameters:
        osmRelation - to wrap parsing of
        osmRelationConsumer - to apply when relation is has Ptv2 public transport tags and is either a stop area or multipolygon transport platform
      • wrapHandlePtOsmNode

        protected void wrapHandlePtOsmNode​(de.topobyte.osm4j.core.model.iface.OsmNode osmNode,
                                           TriConsumer<de.topobyte.osm4j.core.model.iface.OsmNode,​OsmPtVersionScheme,​Map<String,​String>> osmNodeConsumer)
        Wrap the handling of OSM node by checking if it is eligible (PT specific) and catch any run time PLANit exceptions, if eligible delegate to consumer.
        Parameters:
        osmNode - to parse
        osmNodeConsumer - to apply to eligible OSM way
      • getGeoUtils

        protected final PlanitJtsCrsUtils getGeoUtils()
        Get geo utils
        Returns:
        geo utils
      • 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
      • 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
      • getConnectoidHelper

        protected OsmConnectoidHelper getConnectoidHelper()
        Get the connectoid parser
        Returns:
        connectoidParser parser
      • initialiseBeforeParsing

        public abstract void initialiseBeforeParsing()
        Call this BEFORE we parse the OSM network to initialise the handler properly
      • reset

        public abstract void reset()
        reset the contents, mainly to free up unused resources