Class PlanitNetworkLayerUtils


  • public class PlanitNetworkLayerUtils
    extends Object
    Utilities regarding PLANit network layers with respect to parsing OSM netities for it
    Author:
    markr
    • Constructor Detail

      • PlanitNetworkLayerUtils

        public PlanitNetworkLayerUtils()
    • Method Detail

      • getNetworkLayersWithActiveOsmNode

        public static List<? extends NetworkLayer> getNetworkLayersWithActiveOsmNode​(long osmNodeId,
                                                                                     LayeredNetwork<?,​?> network,
                                                                                     OsmNetworkToZoningReaderData networkToZoningData)
        Collect the layers where the OSM node is active in either as an extreme node or internal to a PLANit link
        Parameters:
        osmNodeId - to use
        network - to consider
        networkToZoningData - to extract layer specific data from
        Returns:
        true when one or more layers are found, false otherwise
      • hasNetworkLayersWithActiveOsmNode

        public static boolean hasNetworkLayersWithActiveOsmNode​(long osmNodeId,
                                                                LayeredNetwork<?,​?> network,
                                                                OsmNetworkToZoningReaderData networkToZoningData)
        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
        network - to consider
        networkToZoningData - to extract layer specific data from
        Returns:
        true when one or more layers are found, false otherwise
      • hasNetworkLayersWithActiveOsmNode

        public static boolean hasNetworkLayersWithActiveOsmNode​(long osmNodeId,
                                                                LayeredNetwork<?,​?> network,
                                                                OsmNetworkReaderData networkData)
        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
        network - to consider
        networkData - to extract layer specific data from
        Returns:
        true when one or more layers are found, false otherwise
      • createPopulateAndRegisterLinkSegment

        public static MacroscopicLinkSegment createPopulateAndRegisterLinkSegment​(MacroscopicLink link,
                                                                                  boolean directionAb,
                                                                                  MacroscopicLinkSegmentType linkSegmentType,
                                                                                  Double speedLimit,
                                                                                  Integer numLanes,
                                                                                  MacroscopicNetworkLayer networkLayer)
        Default way to create a link segment (and register it ) in OSM
        Parameters:
        link - link to create it on
        directionAb - direction of the segment
        linkSegmentType - type to apply
        networkLayer - to register on
        speedLimit - to apply
        numLanes - to apply
        Returns:
        created link segment
      • createPopulateAndRegisterLink

        public static MacroscopicLink createPopulateAndRegisterLink​(Node nodeA,
                                                                    Node nodeB,
                                                                    org.locationtech.jts.geom.LineString geometry,
                                                                    MacroscopicNetworkLayer layer,
                                                                    String externalId,
                                                                    String name,
                                                                    PlanitJtsCrsUtils geoUtils)
        Default way to create a link (and register it on its nodes) in OSM
        Parameters:
        nodeA - to use
        nodeB - to use
        geometry - to set
        layer - to register on
        externalId - to set (optional)
        name - to set (optional)
        geoUtils - to use
        Returns:
        created and registered link
      • 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
      • createPopulateAndRegisterNode

        public static Node createPopulateAndRegisterNode​(de.topobyte.osm4j.core.model.iface.OsmNode osmNode,
                                                         MacroscopicNetworkLayer networkLayer,
                                                         OsmNetworkReaderLayerData layerData)
        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
      • createPopulateAndRegisterNode

        public static Node createPopulateAndRegisterNode​(org.locationtech.jts.geom.Point osmNodeLocation,
                                                         MacroscopicNetworkLayer networkLayer,
                                                         OsmNetworkReaderLayerData layerData)
        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