|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.geotools.graph.build.line.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.
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.
OptEdge
,
OptXYNode
Constructor Summary | |
OptLineGraphGenerator()
Constructs a new OptLineGraphGenerator. |
Method Summary | |
Graphable |
add(java.lang.Object obj)
Adds a line to the graph. |
void |
generate()
Performs the actual generation of the graph. |
protected Edge |
generateEdge(com.vividsolutions.jts.geom.LineSegment line)
|
protected void |
generateEdges()
|
protected void |
generateNodes()
|
Graphable |
get(java.lang.Object obj)
Returns the edge which represents a line. |
Edge |
getEdge(com.vividsolutions.jts.geom.Coordinate c1,
com.vividsolutions.jts.geom.Coordinate c2)
|
Graph |
getGraph()
Returns the graph being generated. |
GraphBuilder |
getGraphBuilder()
Returns the underlying builder. |
protected java.util.List |
getLines()
Returns the lines added to the graph. |
Node |
getNode(com.vividsolutions.jts.geom.Coordinate c)
|
java.util.Map |
getNodeMap()
Returns the coordinate to node map. |
Graphable |
remove(java.lang.Object obj)
Unsupported operation. |
void |
setGraphBuilder(GraphBuilder builder)
Sets the underlying builder used to physically construct the graph. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public OptLineGraphGenerator()
Method Detail |
public Graphable add(java.lang.Object obj)
add
in interface GraphGenerator
obj
- The object to be modelled in the graph.
public Graphable get(java.lang.Object obj)
get
in interface GraphGenerator
obj
- An instance of LineSegment.
GraphGenerator.get(Object)
public Graphable remove(java.lang.Object obj)
remove
in interface GraphGenerator
obj
- The object modelled by the component.
java.lang.UnsupportedOperationException
public void setGraphBuilder(GraphBuilder builder)
GraphGenerator
setGraphBuilder
in interface GraphGenerator
builder
- The new underlying GraphBuilder.GraphGenerator.setGraphBuilder(GraphBuilder)
public GraphBuilder getGraphBuilder()
GraphGenerator
getGraphBuilder
in interface GraphGenerator
GraphGenerator.getGraphBuilder()
public Graph getGraph()
GraphGenerator
getGraph
in interface GraphGenerator
GraphGenerator.getGraph()
public void generate()
public java.util.Map getNodeMap()
protected java.util.List getLines()
protected void generateNodes()
protected void generateEdges()
protected Edge generateEdge(com.vividsolutions.jts.geom.LineSegment line)
public Node getNode(com.vividsolutions.jts.geom.Coordinate c)
getNode
in interface LineGraphGenerator
public Edge getEdge(com.vividsolutions.jts.geom.Coordinate c1, com.vividsolutions.jts.geom.Coordinate c2)
getEdge
in interface LineGraphGenerator
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |