|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectBasicLineGraphGenerator
public class BasicLineGraphGenerator
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.
BasicXYNode
,
BasicEdge
,
LineSegment
,
Coordinate
Constructor Summary | |
---|---|
BasicLineGraphGenerator()
Constructs a new BasicLineGraphGenerator. |
|
BasicLineGraphGenerator(double tolerance)
Constructs a new BasicLineGraphGenerator. |
Method Summary | |
---|---|
Graphable |
add(Object obj)
Adds a line to the graph. |
protected LineSegment |
alterLine(LineSegment line,
Node n1,
Node n2)
|
Graphable |
get(Object obj)
Returns the edge which represents a line. |
Edge |
getEdge(Coordinate c1,
Coordinate c2)
Retrieve edge between the two coordinates. |
Graph |
getGraph()
Returns the graph being generated. |
GraphBuilder |
getGraphBuilder()
Returns the underlying builder. |
Node |
getNode(Coordinate c)
Look up a Node for the provided coordinate. |
Map |
getNodeMap()
Returns the coordinate to node map used to build nodes representing line endpoint coordinates. |
Graphable |
remove(Object obj)
Removes the edge from the graph that represents a line. |
void |
setGraphBuilder(GraphBuilder builder)
Sets the underlying builder used to physically construct the graph. |
protected void |
setObject(Edge e,
Object obj)
|
protected void |
setObject(Node n,
Object obj)
|
protected boolean |
useTolerance()
|
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BasicLineGraphGenerator()
Tolerance is 0.0 as default, meaning coordinates must be equal for lines to connect at a node.
public BasicLineGraphGenerator(double tolerance)
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.
tolerance
- threshold distance value for coordinates to be considered equalMethod Detail |
---|
public Graphable add(Object obj)
add
in interface GraphGenerator
obj
- An instance of LineSegment.
LineSegment
,
GraphGenerator.add(Object)
protected LineSegment alterLine(LineSegment line, Node n1, Node n2)
public Graphable get(Object obj)
get
in interface GraphGenerator
obj
- An instance of LineSegment.
GraphGenerator.get(Object)
public Graphable remove(Object obj)
remove
in interface GraphGenerator
obj
- The object modelled by the component.
GraphGenerator.remove(Object)
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 Map getNodeMap()
public Node getNode(Coordinate c)
LineGraphGenerator
getNode
in interface LineGraphGenerator
public Edge getEdge(Coordinate c1, Coordinate c2)
LineGraphGenerator
getEdge
in interface LineGraphGenerator
protected void setObject(Edge e, Object obj)
protected void setObject(Node n, Object obj)
protected boolean useTolerance()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |