jdsl.extension.LEDA.Layout
Class DefaultGraphLayout

java.lang.Object
  |
  +--jdsl.extension.LEDA.Layout.DefaultGraphLayout
Direct Known Subclasses:
CircleGraphLayout, RandomGraphLayout, XYGraphLayout

public class DefaultGraphLayout
extends java.lang.Object
implements java.lang.Cloneable, GraphLayout

DefaultGraphLayout provides a standard class for graph layout algorithms.


Constructor Summary
DefaultGraphLayout()
          Empty constructor.
DefaultGraphLayout(DefaultGraphLayout other)
          A Copy-Constructor.
 
Method Summary
 void calculation()
          Calculate default assignment.
 void calculation(java.util.Enumeration vertices)
          Calculate a layout based on a Vertex enumeration.
 void calculation(jdsl.graph.api.InspectableGraph graph)
          Calculate a layout based on given graph graph.
 void clearLayout()
          Resets current layout.
 java.lang.Object clone()
          Creates and returns a copy of this object.
 Point[] getPosition(jdsl.graph.api.Edge which)
          Returns current position of edge which.
 Point getPosition(jdsl.graph.api.Vertex which)
          Returns current position of vertex which.
 void merge(java.util.Enumeration objs, GraphLayout other)
          Merges current and given GraphLayout together (prefers given new layout!)
 void merge(java.util.Enumeration objs, GraphLayout other, boolean override)
          Merges current and given GraphLayout together.
protected  void setEdgeAsStraightLine(jdsl.graph.api.InspectableGraph graph)
          Calculate Edges' position in given graph.
 void setPosition(jdsl.graph.api.Edge which, Point[] where)
          Changes the position of edge which to where.
 void setPosition(jdsl.graph.api.Vertex which, Point where)
          Changes the position of vertex which to where.
 void setX(jdsl.graph.api.Vertex which, double whereX)
          Changes X-coordinate of vertex which to whereX.
 void setY(jdsl.graph.api.Vertex which, double whereY)
          Changes Y-coordinate of vertex which to whereY.
 void update(InspectableEdgeAttribute_PointArray data, jdsl.graph.api.EdgeIterator edges)
          Changes positions for all edges in edges using data.
 void update(InspectableVertexAttribute_Point data, jdsl.graph.api.VertexIterator vertices)
          Changes positions for all vertices in vertices using data.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultGraphLayout

public DefaultGraphLayout()
Empty constructor.

DefaultGraphLayout

public DefaultGraphLayout(DefaultGraphLayout other)
A Copy-Constructor.
Parameters:
other - given layout to copy
Method Detail

clone

public java.lang.Object clone()
Creates and returns a copy of this object.
Returns:
a clone of this instance.
Throws:
OutOfMemoryError - if there is not enough memory
Overrides:
clone in class java.lang.Object
See Also:
Cloneable

calculation

public void calculation()
Calculate default assignment. Here it is an empty method.

clearLayout

public void clearLayout()
Resets current layout.

calculation

public void calculation(java.util.Enumeration vertices)
Calculate a layout based on a Vertex enumeration. Here it is an empty method.
Specified by:
calculation in interface GraphLayout
Parameters:
vertices - given Vertex enumeration

calculation

public void calculation(jdsl.graph.api.InspectableGraph graph)
Calculate a layout based on given graph graph. Here all edges are representated as straight lines.
Specified by:
calculation in interface GraphLayout
Parameters:
graph - given graph

setPosition

public void setPosition(jdsl.graph.api.Vertex which,
                        Point where)
Changes the position of vertex which to where.
Specified by:
setPosition in interface GraphLayout
Parameters:
which - the vertex which position will be changed
where - new position

setX

public void setX(jdsl.graph.api.Vertex which,
                 double whereX)
Changes X-coordinate of vertex which to whereX.
Specified by:
setX in interface GraphLayout
Parameters:
which - the vertex which position will be changed
whereX - new position

setY

public void setY(jdsl.graph.api.Vertex which,
                 double whereY)
Changes Y-coordinate of vertex which to whereY.
Specified by:
setY in interface GraphLayout
Parameters:
which - the vertex which position will be changed
whereY - new position

setPosition

public void setPosition(jdsl.graph.api.Edge which,
                        Point[] where)
Changes the position of edge which to where. where is an array of Points (Interpretation is different!).
Specified by:
setPosition in interface GraphLayout
Parameters:
which - the edge which position will be changed
where - new positions.

getPosition

public Point getPosition(jdsl.graph.api.Vertex which)
Returns current position of vertex which.
Specified by:
getPosition in interface GraphLayout
Parameters:
which - the vertex which position will be returned
Returns:
current position

getPosition

public Point[] getPosition(jdsl.graph.api.Edge which)
Returns current position of edge which.
Specified by:
getPosition in interface GraphLayout
Parameters:
which - the edge which position will be returned
Returns:
current position (an array of Points

update

public void update(InspectableVertexAttribute_Point data,
                   jdsl.graph.api.VertexIterator vertices)
Changes positions for all vertices in vertices using data.
Specified by:
update in interface GraphLayout

update

public void update(InspectableEdgeAttribute_PointArray data,
                   jdsl.graph.api.EdgeIterator edges)
Changes positions for all edges in edges using data.
Specified by:
update in interface GraphLayout

merge

public void merge(java.util.Enumeration objs,
                  GraphLayout other,
                  boolean override)
Merges current and given GraphLayout together.
Specified by:
merge in interface GraphLayout
Parameters:
objs - is an enumeration of all elements (Vertices and Edges) to be inserted
other - given other GraphLayout
override - if true old positions are overridden by new position (in other).

merge

public void merge(java.util.Enumeration objs,
                  GraphLayout other)
Merges current and given GraphLayout together (prefers given new layout!)
Specified by:
merge in interface GraphLayout
Parameters:
objs - is an enumeration of all elements (Vertices and Edges) to be inserted
other - given other GraphLayout

setEdgeAsStraightLine

protected void setEdgeAsStraightLine(jdsl.graph.api.InspectableGraph graph)
Calculate Edges' position in given graph. These elements are represented by straight lines.
Parameters:
graph - given graph.