Class BasicLineGraphGenerator

  • All Implemented Interfaces:
    GraphGenerator, LineGraphGenerator
    Direct Known Subclasses:
    BasicDirectedLineGraphGenerator, LineStringGraphGenerator

    public class BasicLineGraphGenerator
    extends Object
    implements LineGraphGenerator
    An implementation of GraphGenerator used to generate a 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.

    If a tolerance distance is set, the end coordinates matched to nodes with a tolerance distance (using a spatial index).

    Edges created by the generator are of type BasicEdge and contain an object of type LineSegment.
    Nodes created by the generator are of type BasicXYNode and contain an object of type Coordinate.
    Author:
    Justin Deoliveira, Refractions Research Inc, jdeolive@refractions.net, Anders Bakkevold, Bouvet AS, bakkedev@gmail.com
    See Also:
    BasicXYNode, BasicEdge, LineSegment, Coordinate
    • Constructor Detail

      • BasicLineGraphGenerator

        public BasicLineGraphGenerator()
        Constructs a new BasicLineGraphGenerator.

        Tolerance is 0.0 as default, meaning coordinates must be equal for lines to connect at a node.

      • BasicLineGraphGenerator

        public BasicLineGraphGenerator​(double tolerance)
        Constructs a new BasicLineGraphGenerator.

        If two coordinates are considered equal (and should be snapped to the same Node), the distance between them must be less than the tolerance value.

        Parameters:
        tolerance - threshold distance value for coordinates to be considered equal