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 Edge
generateEdge
(LineSegment line) protected void
getEdge
(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:
add
in interfaceGraphGenerator
- Overrides:
add
in 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:
generateNodes
in classOptLineGraphGenerator
-
generateEdge
- Overrides:
generateEdge
in classOptLineGraphGenerator
-
getNode
Description copied from interface:LineGraphGenerator
Look up a Node for the provided coordinate.- Specified by:
getNode
in interfaceLineGraphGenerator
- Overrides:
getNode
in classOptLineGraphGenerator
- Returns:
- Node
-
getEdge
Description copied from interface:LineGraphGenerator
Retrieve edge between the two coordinates.- Specified by:
getEdge
in interfaceLineGraphGenerator
- Overrides:
getEdge
in classOptLineGraphGenerator
- Returns:
- Edge
-