Class OptDirectedLineGraphGenerator

  • All Implemented Interfaces:
    GraphGenerator, LineGraphGenerator

    public class OptDirectedLineGraphGenerator
    extends OptLineGraphGenerator
    An implementation of GraphGenerator used to generate an optimized graph representing a line network. Graphs are generated by supplying the generator with objects of type LineSegment via the add(Object) method.

    For each line segment added, an edge in the graph is created. The builder records the end coordinates of each line added, and maintains a map of coordinates to nodes, creating nodes when neccessary.

    Edges created by the generator are of type OptBasicEdge. Nodes created by the generator are of type OptXYNode.
    Author:
    Justin Deoliveira, Refractions Research Inc, jdeolive@refractions.net
    See Also:
    OptEdge, OptXYNode
    • Constructor Detail

      • OptDirectedLineGraphGenerator

        public OptDirectedLineGraphGenerator()
        Constructs a new OptLineGraphGenerator.
    • Method Detail

      • add

        public Graphable add​(Object obj)
        Adds a line to the graph. Note that this method returns null since actual building of the graph components is delayed until generate() is called.
        Specified by:
        add in interface GraphGenerator
        Overrides:
        add in class OptLineGraphGenerator
        Parameters:
        obj - A LineSegment object.
        Returns:
        null because the actual building of the graph components is delayed until generate() is called.
      • getInNodeMap

        public Map<Coordinate,​Object> getInNodeMap()
        Returns the coordinate to in node map. Note that before the call to generate the map does not contain any nodes.
        Returns:
        Coordinate to in node map.
      • getOutNodeMap

        public Map<Coordinate,​Object> getOutNodeMap()
        Returns the coordinate to out node map. Note that before the call to generate the map does not contain any nodes.
        Returns:
        Coordinate to out node map.