Class OsmNetworkHandlerHelper


  • public class OsmNetworkHandlerHelper
    extends Object
    Helper class for the OSM network handlers, providing static helper methods that reflect common code across various handlers that are not considered general enough to be part of a utility class.
    Author:
    markr
    • Field Detail

      • LOGGER

        public static final Logger LOGGER
        the logger to use
      • LINK_OSMWAY_TYPE_PROPERTY_KEY

        protected static final String LINK_OSMWAY_TYPE_PROPERTY_KEY
        to be able to retain the information on the osm way type to be able to identify the importance of an osm way compared to others we use the osm way type and store it as an input property on the link using this key
        See Also:
        Constant Field Values
    • Constructor Detail

      • OsmNetworkHandlerHelper

        public OsmNetworkHandlerHelper()
    • Method Detail

      • setLinkOsmWayType

        public static void setLinkOsmWayType​(Link link,
                                             String osmWayType)
        set the osm way type
        Parameters:
        link - to set for
        osmWayType - to use
      • getLinkOsmWayType

        public static String getLinkOsmWayType​(Link link)
        Collect the osm way type of the link
        Parameters:
        link - to collect from
        Returns:
        osm way type, null if not present
      • breakLinksWithInternalNode

        public static Map<Long,​Set<Link>> breakLinksWithInternalNode​(Node theNode,
                                                                           List<Link> linksToBreak,
                                                                           MacroscopicNetworkLayer networkLayer,
                                                                           org.opengis.referencing.crs.CoordinateReferenceSystem crs)
                                                                    throws PlanItException
        Check if we should break any links for the passed in node and if so, do it
        Parameters:
        theNode - to verify
        linksToBreak - contains the links that (at least at some point) had theNode as an internal link
        networkLayer - the node resides on
        crs - of the network layer
        Returns:
        newly broken PLANit links by their original osmWayId
        Throws:
        PlanItException - thrown if error
      • createAndPopulateNode

        public static Node createAndPopulateNode​(de.topobyte.osm4j.core.model.iface.OsmNode osmNode,
                                                 MacroscopicNetworkLayer networkLayer)
        Extract a PLANit node from the osmNode information
        Parameters:
        osmNode - to create PLANit node for
        networkLayer - to create node on
        Returns:
        created node, null when something went wrong
      • createAndPopulateNode

        public static Node createAndPopulateNode​(org.locationtech.jts.geom.Point geometry,
                                                 MacroscopicNetworkLayer networkLayer)
        Extract a PLANit node from the osmNode information
        Parameters:
        geometry - to place on PLANit node
        networkLayer - to create node on
        Returns:
        created node, null when something went wrong
      • createPopulateAndRegisterNode

        public static Node createPopulateAndRegisterNode​(de.topobyte.osm4j.core.model.iface.OsmNode osmNode,
                                                         MacroscopicNetworkLayer networkLayer,
                                                         OsmNetworkReaderLayerData layerData)
                                                  throws PlanItException
        Extract a PLANit node from the osmNode information and register it on the provided layer
        Parameters:
        osmNode - to create PLANit node for
        networkLayer - to create node on
        layerData - to register on
        Returns:
        created node, null when something went wrong
        Throws:
        PlanItException - thrown if error
      • createPopulateAndRegisterNode

        public static Node createPopulateAndRegisterNode​(org.locationtech.jts.geom.Point osmNodeLocation,
                                                         MacroscopicNetworkLayer networkLayer,
                                                         OsmNetworkReaderLayerData layerData)
                                                  throws PlanItException
        Extract a PLANit node from the location information and register it on the provided layer
        Parameters:
        osmNodeLocation - to create PLANit node for
        networkLayer - to create node on
        layerData - to register on
        Returns:
        created node, null when something went wrong
        Throws:
        PlanItException - thrown if error
      • addAllTo

        public static void addAllTo​(Map<Long,​Set<Link>> addition,
                                    Map<Long,​Set<Link>> destination)
        add addition to destination
        Parameters:
        addition - to add
        destination - to add to