Package org.geotools.graph.build.line
Class OptDirectedLineGraphGenerator
Object
OptLineGraphGenerator
OptDirectedLineGraphGenerator
- All Implemented Interfaces:
GraphGenerator,LineGraphGenerator
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.
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.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds a line to the graph.protected EdgegenerateEdge(LineSegment line) protected voidgetEdge(Coordinate c1, Coordinate c2) Retrieve edge between the two coordinates.Returns the coordinate to in node map.Look up a Node for the provided coordinate.Returns the coordinate to out node map.Methods inherited from class OptLineGraphGenerator
generate, generateEdges, get, getGraph, getGraphBuilder, getLines, getNodeMap, remove, setGraphBuilder
-
Constructor Details
-
OptDirectedLineGraphGenerator
public OptDirectedLineGraphGenerator()Constructs a new OptLineGraphGenerator.
-
-
Method Details
-
add
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:
addin interfaceGraphGenerator- Overrides:
addin classOptLineGraphGenerator- Parameters:
obj- A LineSegment object.- Returns:
- null because the actual building of the graph components is delayed until generate() is called.
-
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
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.
-
generateNodes
protected void generateNodes()- Overrides:
generateNodesin classOptLineGraphGenerator
-
generateEdge
- Overrides:
generateEdgein classOptLineGraphGenerator
-
getNode
Description copied from interface:LineGraphGeneratorLook up a Node for the provided coordinate.- Specified by:
getNodein interfaceLineGraphGenerator- Overrides:
getNodein classOptLineGraphGenerator- Returns:
- Node
-
getEdge
Description copied from interface:LineGraphGeneratorRetrieve edge between the two coordinates.- Specified by:
getEdgein interfaceLineGraphGenerator- Overrides:
getEdgein classOptLineGraphGenerator- Returns:
- Edge
-