| java.lang.Object org.geotools.graph.build.line.OptLineGraphGenerator
All known Subclasses: org.geotools.graph.build.line.OptDirectedLineGraphGenerator,
OptLineGraphGenerator | public class OptLineGraphGenerator implements LineGraphGenerator(Code) | | 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.
Since building optimized graphs requires knowing the degree of nodes before
creating them, the physical construction of the graph is delayed until a call
to generate() is made. No component is created with a call to add(Object),
only information about the object is recorded.
See Also: org.geotools.graph.structure.opt.OptEdge See Also: org.geotools.graph.structure.line.OptXYNode author: Justin Deoliveira, Refractions Research Inc, jdeolive@refractions.net |
OptLineGraphGenerator | public OptLineGraphGenerator()(Code) | | Constructs a new OptLineGraphGenerator.
|
add | public Graphable add(Object obj)(Code) | | 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.
Parameters: obj - A LineSegment object. null because the actual building of the graph components is delayed until generate() is called. |
generate | public void generate()(Code) | | Performs the actual generation of the graph.
|
generateEdge | protected Edge generateEdge(LineSegment line)(Code) | | |
generateEdges | protected void generateEdges()(Code) | | |
generateNodes | protected void generateNodes()(Code) | | |
get | public Graphable get(Object obj)(Code) | | Returns the edge which represents a line. This method must be called
after the call to generate(). Note that if the exact same line
has been added to the graph multiple times, then only one of the edges
that represents it will be returned. It is undefined which edge will be
returned.
Parameters: obj - An instance of LineSegment. Edge that represents the line. See Also: GraphGenerator.get(Object) |
getEdge | public Edge getEdge(Coordinate c1, Coordinate c2)(Code) | | |
getLines | protected List getLines()(Code) | | Returns the lines added to the graph.
A list of LineSegment objects. |
getNodeMap | public Map getNodeMap()(Code) | | Returns the coordinate to node map. Note that before the call to generate
the map does not contain any nodes.
Coordinate to node map. |
|
|