Class OsmZoningReaderPlanitData


  • public class OsmZoningReaderPlanitData
    extends Object
    Data specifically required in the zoning reader while parsing OSM data
    Author:
    markr
    • Constructor Detail

      • OsmZoningReaderPlanitData

        public OsmZoningReaderPlanitData()
    • Method Detail

      • initialiseSpatiallyIndexedLinks

        protected void initialiseSpatiallyIndexedLinks​(PlanitOsmNetwork osmNetwork)
        initialise based on links in provided network
        Parameters:
        osmNetwork - to use
      • getIncompleteTransferZoneByOsmId

        public TransferZone getIncompleteTransferZoneByOsmId​(de.topobyte.osm4j.core.model.iface.EntityType entityType,
                                                             long osmEntityId)
        Collect the potentially incomplete transfer zone by entity type and osm id
        Parameters:
        entityType - to collect for (node, way)
        osmEntityId - id (node id/way id)
        Returns:
        transfer zone registered, null if not present
      • getCompleteTransferZoneByOsmId

        public TransferZone getCompleteTransferZoneByOsmId​(de.topobyte.osm4j.core.model.iface.EntityType entityType,
                                                           long osmEntityId)
        Collect the complete transfer zone by entity type and osm id
        Parameters:
        entityType - to collect for (node, way)
        osmEntityId - id (node id/way id)
        Returns:
        transfer zone registered, null if not present
      • getTransferZoneByOsmId

        public TransferZone getTransferZoneByOsmId​(de.topobyte.osm4j.core.model.iface.EntityType type,
                                                   long osmId)
        Find transfer zone either incomplete or complete by osm is
        Parameters:
        type - OSM entity type
        osmId - OSM id of transfer zone
        Returns:
        transfer zone if present as incomplete or complete, null otherwise
      • getTransferZonesByOsmId

        public SortedSet<TransferZone> getTransferZonesByOsmId​(de.topobyte.osm4j.core.model.iface.EntityType entityType)
        Collect the transfer zones by entity type, unmodifiable
        Parameters:
        entityType - to collect for
        Returns:
        available transfer zones by osm id
      • getTransferZonesSpatially

        public Collection<TransferZone> getTransferZonesSpatially​(org.locationtech.jts.geom.Envelope boundingBox)
        Collect the transfer zones by spatial bounding box. Collect all created transfer zones that fall within or intersect with this bounding box. They might or might not have connectoids at this point.
        Parameters:
        boundingBox - to identify transfer zones spatially
        Returns:
        list of found transfer zones, caller needs to cast entries to TransferZone type
      • addTransferZoneByOsmId

        public TransferZone addTransferZoneByOsmId​(de.topobyte.osm4j.core.model.iface.EntityType entityType,
                                                   long osmEntityId,
                                                   TransferZone transferZone)
        add a incomplete transfer zone to the tracking container
        Parameters:
        entityType - to register for
        osmEntityId - osm id
        transferZone - the transfer zone
        Returns:
        previous entry in container, if any
      • getDirectedConnectoidsByLocation

        public Map<org.locationtech.jts.geom.Point,​List<DirectedConnectoid>> getDirectedConnectoidsByLocation​(MacroscopicNetworkLayer networkLayer)
        collect the registered connectoids indexed by their locations for a given network layer (unmodifiable)
        Parameters:
        networkLayer - to use
        Returns:
        registered directed connectoids indexed by location
      • getDirectedConnectoidsByLocation

        public List<DirectedConnectoid> getDirectedConnectoidsByLocation​(org.locationtech.jts.geom.Point nodeLocation,
                                                                         MacroscopicNetworkLayer networkLayer)
        Collect the registered connectoids by given locations and network layer (unmodifiable)
        Parameters:
        nodeLocation - to verify
        networkLayer - to extract from
        Returns:
        found connectoids (if any), otherwise null or empty set
      • addDirectedConnectoidByLocation

        public boolean addDirectedConnectoidByLocation​(MacroscopicNetworkLayer networkLayer,
                                                       org.locationtech.jts.geom.Point connectoidLocation,
                                                       DirectedConnectoid connectoid)
        Add a connectoid to the registered connectoids indexed by their OSM id
        Parameters:
        networkLayer - to register for
        connectoidLocation - this connectoid relates to
        connectoid - to add
        Returns:
        true when successful, false otherwise
      • hasAnyDirectedConnectoidsForLocation

        public boolean hasAnyDirectedConnectoidsForLocation​(org.locationtech.jts.geom.Point location)
        Check if any connectoids have been registered for the given location on any layer
        Parameters:
        location - to verify
        Returns:
        true when present, false otherwise
      • hasDirectedConnectoidForLocation

        public boolean hasDirectedConnectoidForLocation​(NetworkLayer networkLayer,
                                                        org.locationtech.jts.geom.Point point)
        Check if any connectoid has been registered for the given location for this layer
        Parameters:
        networkLayer - to check for
        point - to use
        Returns:
        true when present, false otherwise
      • addConnectoidByTransferZone

        public void addConnectoidByTransferZone​(TransferZone transferZone,
                                                DirectedConnectoid connectoid)
        Register a known mapping from transfer zone to connectoid
        Parameters:
        transferZone - to map to...
        connectoid - ...this connectoid
      • hasConnectoids

        public boolean hasConnectoids​(TransferZone transferZone)
        Verify if transfer zone has connectoids present
        Parameters:
        transferZone - to check for
        Returns:
        true when there exist connectoids that reference this transfer zone, false otherwise
      • getConnectoidsByTransferZone

        public Collection<DirectedConnectoid> getConnectoidsByTransferZone​(TransferZone transferZone)
        Collect transfer zone's registered connectoids
        Parameters:
        transferZone - to map to...
        Returns:
        connectoids found
      • getTransferZoneGroupByOsmId

        public TransferZoneGroup getTransferZoneGroupByOsmId​(long osmId)
        collect a parsed transfer zone group by OSM id
        Parameters:
        osmId - to use
        Returns:
        transfer zone group
      • addTransferZoneGroupByOsmId

        public TransferZoneGroup addTransferZoneGroupByOsmId​(long osmId,
                                                             TransferZoneGroup transferZoneGroup)
        Add a transfer zone group by its OSM id
        Parameters:
        osmId - to use
        transferZoneGroup - group to add
        Returns:
        group in container location before this one was added, null if none existed
      • reset

        public void reset()
        Reset the PLANit data tracking containers
      • removeLinksFromSpatialLinkIndex

        public void removeLinksFromSpatialLinkIndex​(Collection<MacroscopicLink> links)
        Remove provided links from local spatial index based on links
        Parameters:
        links - to remove
      • addLinksToSpatialLinkIndex

        public void addLinksToSpatialLinkIndex​(Collection<MacroscopicLink> links)
        Add provided links to local spatial index based on their bounding box
        Parameters:
        links - to add
      • findLinksSpatially

        public Collection<MacroscopicLink> findLinksSpatially​(org.locationtech.jts.geom.Envelope searchBoundingBox)
        Find links spatially based on the provided bounding box
        Parameters:
        searchBoundingBox - to use
        Returns:
        links found intersecting or within bounding box provided
      • registerTransferZoneVerticalLayerIndex

        public void registerTransferZoneVerticalLayerIndex​(TransferZone transferZone,
                                                           de.topobyte.osm4j.core.model.iface.OsmEntity osmEntity,
                                                           Map<String,​String> tags)
        Given a transfer zone and the OSM entity it is based on (including tags), we register its vertical layer index if explicitly tagged. Used to filter eligible road/rail infrastructure when mapping waiting areas (transfer zones) to the network via connectoids
        Parameters:
        transferZone - to extract layer information for
        osmEntity - the OSM entity the transfer zone is based on
        tags - to extract the layer information from
      • getTransferZoneVerticalLayerIndex

        public Integer getTransferZoneVerticalLayerIndex​(TransferZone transferZone)
        Collect vertical layer index for this transfer zone
        Parameters:
        transferZone - to collect layer index for
        Returns:
        found layer index, when nothing is registered, null is returned, this may indicate the default level or absence of information that should be obtained otherwise and does not reflect the default layer