Class OsmNetworkPreProcessingHandler

  • All Implemented Interfaces:
    de.topobyte.osm4j.core.access.OsmHandler

    public class OsmNetworkPreProcessingHandler
    extends OsmNetworkBaseHandler
    Preprocessing Handler that identifies which nodes of osm ways - that are marked for inclusion even if they fall (partially) outside the bounding polygon - are to be kept. Since we only know what nodes these are after parsing OSM ways (and nodes are parsed before the ways), this pre-processing is the only way that we can identify these nodes before the main parsing pass.
    Author:
    markr
    • Constructor Detail

      • OsmNetworkPreProcessingHandler

        public OsmNetworkPreProcessingHandler​(PlanitOsmNetwork networkToPopulate,
                                              OsmNetworkReaderData networkData,
                                              OsmNetworkReaderSettings settings)
        Constructor
        Parameters:
        networkToPopulate - the network to populate
        networkData - to populate
        settings - for the handler
    • Method Detail

      • handleEligibleOsmWay

        protected void handleEligibleOsmWay​(de.topobyte.osm4j.core.model.iface.OsmWay osmWay,
                                            Map<String,​String> tags)
        Mark all nodes of eligible OSM ways (e.g., road, rail, etc.) to be parsed during the main processing phase
        Parameters:
        osmWay - to handle
        tags - of the OSM way
      • handle

        public void handle​(de.topobyte.osm4j.core.model.iface.OsmNode node)
        Count total number of nodes in OSM file
        Specified by:
        handle in interface de.topobyte.osm4j.core.access.OsmHandler
        Overrides:
        handle in class de.topobyte.osm4j.core.access.DefaultOsmHandler
      • handle

        public void handle​(de.topobyte.osm4j.core.model.iface.OsmWay osmWay)
        for all OSM ways that are explicitly marked for inclusion despite falling outside the bounding polygon we extract their nodes and mark them for inclusion as exceptions to the bounding polygon filter that is applied during the main parsing pass in the regular PlanitOsmNetworkHandler
        Specified by:
        handle in interface de.topobyte.osm4j.core.access.OsmHandler
        Overrides:
        handle in class de.topobyte.osm4j.core.access.DefaultOsmHandler
      • complete

        public void complete()
                      throws IOException
        Log total number of parsed nodes and percentage retained
        Specified by:
        complete in interface de.topobyte.osm4j.core.access.OsmHandler
        Overrides:
        complete in class de.topobyte.osm4j.core.access.DefaultOsmHandler
        Throws:
        IOException
      • reset

        public void reset()
        reset the contents, mainly to free up unused resources
        Overrides:
        reset in class OsmNetworkBaseHandler