Class TransferZoneGroupHelper


  • public class TransferZoneGroupHelper
    extends Object
    Class to provide functionality for parsing PLANit transfer zone groups from OSM entities
    Author:
    markr
    • Method Detail

      • updateTransferZoneGroupName

        public static void updateTransferZoneGroupName​(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 to
        osmEntityStation - of the relation to process
        tags - 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 on
        tags - 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 on
        tags - 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 against (may be null)
        potentialTransferZones - to extract transfer zone groups from
        allowPseudoModeMatches - , 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,
                                                   boolean suppressLogging)
        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 entity
        osmId - OSM id of the transfer zone
        transferZoneGroup - to register on
        suppressLogging - when true suppress logging
        Returns:
        true when registered on the group, false otherwise
      • registerTransferZoneOnGroup

        public boolean registerTransferZoneOnGroup​(de.topobyte.osm4j.core.model.iface.OsmEntity osmEntity,
                                                   TransferZoneGroup transferZoneGroup,
                                                   boolean suppressLogging)
        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 register
        transferZoneGroup - to register on
        suppressLogging - when true suppress logging
        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,
                                                   boolean suppressLogging)
        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 register
        tags - to use
        transferZoneGroup - to register on
        suppressLogging - when true suppress logging
        Returns:
        true when registered on the group, 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
      • findOsmVerticalLayerIndexByStopPositionPlanitLinks

        protected Pair<Integer,​Boolean> findOsmVerticalLayerIndexByStopPositionPlanitLinks​(org.locationtech.jts.geom.Point stopPositionLocation,
                                                                                                 NetworkLayer layer)
        Based on the location of the stop position, determine if the PLANit links that it resides on, or borders or reside in a particular layer. If so, the OSM vertical layer index is retrieved and provided. If inconsistent indices are found across the links the user is warned, if no matching links are known on the layer null is returned.
        Parameters:
        stopPositionLocation - to find layer index for
        layer - to check
        Returns:
        OSM vertical layer index found, and boolean indicating if the found layer index was the same across all eligible links (true), false otherwise