org.geotools.graph.build.line
Class OptDirectedLineGraphGenerator

java.lang.Object
  extended byorg.geotools.graph.build.line.OptLineGraphGenerator
      extended byorg.geotools.graph.build.line.OptDirectedLineGraphGenerator
All Implemented Interfaces:
GraphGenerator, LineGraphGenerator

public class OptDirectedLineGraphGenerator
extends 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.

Author:
Justin Deoliveira, Refractions Research Inc, jdeolive@refractions.net
See Also:
OptEdge, OptXYNode

Constructor Summary
OptDirectedLineGraphGenerator()
          Constructs a new OptLineGraphGenerator.
 
Method Summary
 Graphable add(java.lang.Object obj)
          Adds a line to the graph.
protected  Edge generateEdge(com.vividsolutions.jts.geom.LineSegment line)
           
protected  void generateNodes()
           
 Edge getEdge(com.vividsolutions.jts.geom.Coordinate c1, com.vividsolutions.jts.geom.Coordinate c2)
           
 java.util.Map getInNodeMap()
          Returns the coordinate to in node map.
 Node getNode(com.vividsolutions.jts.geom.Coordinate c)
           
 java.util.Map getOutNodeMap()
          Returns the coordinate to out node map.
 
Methods inherited from class org.geotools.graph.build.line.OptLineGraphGenerator
generate, generateEdges, get, getGraph, getGraphBuilder, getLines, getNodeMap, remove, setGraphBuilder
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OptDirectedLineGraphGenerator

public OptDirectedLineGraphGenerator()
Constructs a new OptLineGraphGenerator.

Method Detail

add

public Graphable add(java.lang.Object obj)
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 interface GraphGenerator
Overrides:
add in class OptLineGraphGenerator
Returns:
null

getInNodeMap

public java.util.Map 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

public java.util.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 class OptLineGraphGenerator

generateEdge

protected Edge generateEdge(com.vividsolutions.jts.geom.LineSegment line)
Overrides:
generateEdge in class OptLineGraphGenerator

getNode

public Node getNode(com.vividsolutions.jts.geom.Coordinate c)
Specified by:
getNode in interface LineGraphGenerator
Overrides:
getNode in class OptLineGraphGenerator

getEdge

public Edge getEdge(com.vividsolutions.jts.geom.Coordinate c1,
                    com.vividsolutions.jts.geom.Coordinate c2)
Specified by:
getEdge in interface LineGraphGenerator
Overrides:
getEdge in class OptLineGraphGenerator


Copyright © GeoTools. All Rights Reserved.