jwo.landserf.structure.msn
Class GraphEdge

java.lang.Object
  extended byjwo.landserf.structure.msn.GraphEdge

public class GraphEdge
extends Object

Structure to store the link between surface nodes. Contains the locations of the two end points, the vector line linking them as well as 'from' and 'to' pointers.

Version:
2.2, 3rd May, 2004.
Author:
Jo Wood

Constructor Summary
GraphEdge(GISVector path, int type1, int type2, float z1, float z2)
          Creates an unconnected graph edge represented by the given geometry and feature types.
GraphEdge(GraphNetwork graphNetwork, GISVector path, int type1, int type2, float z1, float z2)
          Creates a graph edge represented by the given geometry and feature types.
GraphEdge(GraphNetwork graphNetwork, GraphNode node1, GraphNode node2)
          Creates a graph edge from the given nodes.
 
Method Summary
 Vector getInternalEdges()
          Returns a list of internal edges that make up this edge.
 GraphNode getNode1()
          Reports the first node.
 GraphNode getNode2()
          Reports the second node.
 GISVector getPath()
          Reports the geometry of the path connecting locations.
 int getType()
          Reports the type of edge connecting nodes.
 int getType1()
          Reports the type of feature at the first node.
 int getType2()
          Reports the type of feature at the second node.
 float getX1()
          Reports the x coordinate of the first node.
 float getX2()
          Reports the x coordinate of the second node.
 float getY1()
          Reports the y coordinate of the first node.
 float getY2()
          Reports the y coordinate of the second node.
 float getZ1()
          Reports the z coordinate of the first node.
 float getZ2()
          Reports the z coordinate of the second node.
 Vector intersectWith(GraphEdge otherEdge)
          Reports a list of new edges that would result if this edge intersects with the given edge.
 Vector intersectWith(GraphEdge otherEdge, boolean thin)
          Reports a list of new edges that would result if this edge intersects with the given edge.
 String toString()
          Provides a text summary of the edge.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GraphEdge

public GraphEdge(GraphNetwork graphNetwork,
                 GraphNode node1,
                 GraphNode node2)
Creates a graph edge from the given nodes.

Parameters:
graphNetwork - Network graph connecting graph edges.
node1 - First node in edge.
node2 - Second node in edge.

GraphEdge

public GraphEdge(GraphNetwork graphNetwork,
                 GISVector path,
                 int type1,
                 int type2,
                 float z1,
                 float z2)
Creates a graph edge represented by the given geometry and feature types.

Parameters:
graphNetwork - Network graph connecting graph edges.
path - Vector path connecting nodes.
type1 - Type of node at one end.
type2 - Type of node at the other end.
z1 - Height at one end.
z2 - Height at the other end.

GraphEdge

public GraphEdge(GISVector path,
                 int type1,
                 int type2,
                 float z1,
                 float z2)
Creates an unconnected graph edge represented by the given geometry and feature types. This edge cannot be directly linked to others in a network graph. To link them, call the addEdge() method in GraphNetwork, specifying the path, node attributes and heights stored in this edge.

Parameters:
path - Vector path connecting nodes.
type1 - Type of node at one end.
type2 - Type of node at the other end.
z1 - Height at one end.
z2 - Height at the other end.
Method Detail

intersectWith

public Vector intersectWith(GraphEdge otherEdge)
Reports a list of new edges that would result if this edge intersects with the given edge. Null is returned if edges do not intersect.

Parameters:
otherEdge - Edge with which to intersect.
Returns:
List of intersecting edges, or null if lines do not intersect.

intersectWith

public Vector intersectWith(GraphEdge otherEdge,
                            boolean thin)
Reports a list of new edges that would result if this edge intersects with the given edge. If thin is true, the links between the first and last intersections will be merged.

Parameters:
otherEdge - Edge with which to intersect.
thin - Links between the first and last intersections merged if set to true.
Returns:
List of intersecting edges, or null if lines do not intersect.

toString

public String toString()
Provides a text summary of the edge.

Returns:
String representation of the edge

getPath

public GISVector getPath()
Reports the geometry of the path connecting locations.

Returns:
Path connecting nodes.

getType

public int getType()
Reports the type of edge connecting nodes.

Returns:
type of edge connecting node.

getX1

public float getX1()
Reports the x coordinate of the first node.

Returns:
x coordinate of the first node.

getY1

public float getY1()
Reports the y coordinate of the first node.

Returns:
y coordinate of the first node.

getZ1

public float getZ1()
Reports the z coordinate of the first node.

Returns:
z coordinate of the first node.

getType1

public int getType1()
Reports the type of feature at the first node.

Returns:
type of feature at the first node.

getNode1

public GraphNode getNode1()
Reports the first node.

Returns:
The first node.

getX2

public float getX2()
Reports the x coordinate of the second node.

Returns:
x coordinate of the second node.

getY2

public float getY2()
Reports the y coordinate of the second node.

Returns:
y coordinate of the second node.

getZ2

public float getZ2()
Reports the z coordinate of the second node.

Returns:
z coordinate of the second node.

getType2

public int getType2()
Reports the type of feature at the second node.

Returns:
type of feature at the second node.

getNode2

public GraphNode getNode2()
Reports the second node.

Returns:
The second node.

getInternalEdges

public Vector getInternalEdges()
Returns a list of internal edges that make up this edge. This edge is returned if edge contains no intersections with edge of the same type.

Returns:
List of internal edges.


Copyright Jo Wood, 1996-2005, last modified, 11th March, 2005