Class PhysicalNetwork<N extends Node,​L extends Link,​LS extends LinkSegment>

    • Field Detail

      • links

        public final Links<L extends Link> links
        class instance containing all link specific functionality
      • linkSegments

        public final LinkSegments<LS extends LinkSegment> linkSegments
        class instance containing all link segment specific functionality
      • nodes

        public final Nodes<N extends Node> nodes
        class instance containing all nodes specific functionality
    • Constructor Detail

      • PhysicalNetwork

        public PhysicalNetwork​(IdGroupingToken tokenId,
                               PhysicalNetworkBuilder<N,​L,​LS> networkBuilder)
        Network Constructor
        Parameters:
        tokenId - contiguous id generation within this group for instances of this class
        networkBuilder - the builder to be used to create this network
    • Method Detail

      • getGraph

        protected DirectedGraph<N,​L,​LS> getGraph()
        collect the graph
        Returns:
        graph
      • getNetworkBuilder

        protected PhysicalNetworkBuilder<N,​L,​LS> getNetworkBuilder()
        collect the registered network builder
        Returns:
        networkBuilder the network builder registered
      • getLinks

        public final Links<L> getLinks()
        alternative to using the links public member
        Returns:
        the links
      • getLinkSegments

        public final LinkSegments<LS> getLinkSegments()
        alternative to using the linkSegments public member
        Returns:
        the linkSegments
      • getNodes

        public final Nodes<N> getNodes()
        alternative to using the nodes public member
        Returns:
        the nodes
      • getNetworkIdGroupingToken

        public IdGroupingToken getNetworkIdGroupingToken()
        Collect the id grouping token used for all entities registered on the network, i.e., this network's specific identifier for generating ids unique and contiguous within this network and this network only
        Returns:
        the network id grouping token
      • transform

        public void transform​(org.opengis.referencing.crs.CoordinateReferenceSystem fromCoordinateReferenceSystem,
                              org.opengis.referencing.crs.CoordinateReferenceSystem toCoordinateReferenceSystem)
                       throws PlanItException
        transform all underlying geometries in the layer from the given crs to the new crs
        Specified by:
        transform in interface InfrastructureLayer
        Parameters:
        fromCoordinateReferenceSystem - presumed current crs
        toCoordinateReferenceSystem - to tranform to crs
        Throws:
        PlanItException - thrown if error
      • isEmpty

        public boolean isEmpty()
        check if network is empty, meaning not a single link, node, or link segment is registered yet
        Specified by:
        isEmpty in interface InfrastructureLayer
        Returns:
        true if empty fals otherwise
      • removeDanglingSubnetworks

        public void removeDanglingSubnetworks​(Integer belowSize,
                                              Integer aboveSize,
                                              boolean alwaysKeepLargest)
                                       throws PlanItException
        remove any dangling subnetworks below a given size from the network if they exist and subsequently reorder the internal ids if needed
        Specified by:
        removeDanglingSubnetworks in interface InfrastructureLayer
        Parameters:
        belowSize - remove subnetworks below the given size
        aboveSize - remove subnetworks above the given size (typically set to maximum value)
        alwaysKeepLargest - when true the largest of the subnetworks is always kept, otherwise not
        Throws:
        PlanItException - thrown if error
      • breakLinkAt

        public Map<Long,​Set<L>> breakLinkAt​(L linkToBreak,
                                                  N nodeToBreakAt,
                                                  org.opengis.referencing.crs.CoordinateReferenceSystem crs)
                                           throws PlanItException
        Break the passed in link by inserting the passed in node in between. After completion the original links remain as (NodeA,NodeToBreakAt), and new links as inserted for (NodeToBreakAt,NodeB). Underlying link segments (if any) are also updated accordingly in the same manner
        Parameters:
        linkToBreak - the link to break
        nodeToBreakAt - the node to break at
        crs - to use to recompute link lengths of broken links
        Returns:
        the broken edges for each original edge's id
        Throws:
        PlanItException - thrown if error
      • breakLinksAt

        public Map<Long,​Set<L>> breakLinksAt​(List<? extends L> linksToBreak,
                                                   N nodeToBreakAt,
                                                   org.opengis.referencing.crs.CoordinateReferenceSystem crs)
                                            throws PlanItException
        Break the passed in links by inserting the passed in node in between. After completion the original links remain as (NodeA,NodeToBreakAt), and new links as inserted for (NodeToBreakAt,NodeB). Underlying link segments (if any) are also updated accordingly in the same manner
        Parameters:
        linksToBreak - the links to break
        nodeToBreakAt - the node to break at
        crs - to use to recompute link lengths of broken links
        Returns:
        the broken edges for each original edge's id
        Throws:
        PlanItException - thrown if error
      • validate

        public boolean validate()
        Basic validation of the network verifying if all nodes and link s are properly set and connected
        Specified by:
        validate in interface InfrastructureLayer
        Returns:
        true when valid, false otherwise
      • logInfo

        public void logInfo​(String prefix)
        invoked by entities inquiring about general information about the layer to display to users
        Specified by:
        logInfo in interface InfrastructureLayer
        Parameters:
        prefix - optional prefix to include in each line of logging