y25.layout
Class LayeredLayoutGraph

java.lang.Object
  extended byy25.base.LayeredGraph
      extended byy25.layout.LayeredLayoutGraph
Direct Known Subclasses:
Graph25D

public abstract class LayeredLayoutGraph
extends LayeredGraph

Extends LayeredGraph with layout information.

"Layout information" means all the information that is neccessary to arrange elements of a LayeredLayoutGraph in three-dimensional space (with an X,Y,Z coordinate system). There are some rules for the arrangement of those entities in the three-dimensional space:

For every entity (layer, layer edge, node, edge) inside this LayeredLayoutGraph, layout information is stored inside objects that have the interfaces LayerLayout25D, LayerEdgeLayout25D, NodeLayout25D and EdgeLayout25D respectively. Wehereas layer and layer edge information is stored directly inside this LayeredLayoutGraph, node and edge layout information is stored inside each layer (graph).

Note that this is an abstract class and all subclasses need to implement at least the following methods form LayeredGraph

and make sure that appropriate layouts are created / removed for every graph, layer edge, node or edge that is created / removed. While the information for layers (graphs) and layer edges is stored inside the LayeredLayoutGraph directly, layout information for nodes and edges are stored inside each layer (graph). As a result of this convention, there is a natural relationship between the LayeredGraph-Hierarchy in the y25 package and the Graph-Hierarchy inside the y package: LayeredGraph stores Graphs for each layer, LayeredLayoutGraph stores LayoutGraphs for each layer and Graph25D stores Graph2Ds for each layer.


Nested Class Summary
 
Nested classes inherited from class y25.base.LayeredGraph
LayeredGraph.EdgeMapImpl, LayeredGraph.GraphMapImpl, LayeredGraph.IDAssigner, LayeredGraph.IDCreator, LayeredGraph.LayerEdgeMapImpl, LayeredGraph.NodeMapImpl
 
Field Summary
protected  BoundingBox boundingBox
          Stores the last computed bounding box for this LayeredLayoutGraph.
protected  LayerEdgeMap layerEdgeLayouts
          Stores the layout information for each layer edge.
protected  GraphMap layerLayouts
          Stores the layout information for each layer (graph).
 
Fields inherited from class y25.base.LayeredGraph
AFTER, BEFORE, EDGE_ID_DPKEY, edgeIDCreator, graphList, graphType, idAssigner, inLayerEdges, layerEdgeList, NODE_ID_DPKEY, nodeIDCreator, outLayerEdges, PARENT_ID_DPKEY
 
Constructor Summary
LayeredLayoutGraph()
          Creates an empty LayeredLayoutGraph.
 
Method Summary
 void clear()
          Resets the LayeredLayoutGraph to its initial state.
 void clearLayerEdges()
          Removes all layer edges present in this LayeredLayoutGraph.
 BoundingBox getBoundingBox()
          Returns a bounding box that encompasses all layers, layer edges, nodes and edges from this LayeredLayoutGraph.
 LayerLayout25D getLayout(Graph graph)
          Returns the layout associated with the given graph.
 LayerEdgeLayout25D getLayout(LayerEdge layerEdge)
          Returns the layout associated with the given layer edge.
 Point3D getPoint3D(Node n)
          Returns the position of the given node in three-dimensional space.
 double getZ(Graph graph)
          Returns the z-corrdinate of the geiven layer (graph).
 void recalculateBoundingBox()
          Erases the previously computed bounding box or this graph and recomputes it.
 void removeGraph(Graph graph)
          Removes the passed LayoutGraph from this LayeredLayoutGraph.
 void removeLayerEdge(LayerEdge layerEdge)
          Removes the passed layer edge from this LayeredLayoutGraph.
 void setZ(Graph graph, double z)
          Sets the z-coordinate for the given layer (graph).
 void sortGraphsByZ()
          Sorts the layers (graphs) inside this LayeredLayoutGraph with respect to their z-position.
 
Methods inherited from class y25.base.LayeredGraph
copyCreateStructureData, createEdgeMap, createGraph, createGraph, createGraphMap, createLayerEdge, createLayerEdgeMap, createNodeMap, duplicateGraph, E, edgeCount, G, getEdgeID, getGraphArray, getGraphCursorAfter, getGraphCursorBefore, getLayerEdgeArray, getNodeID, getParentID, graphCount, graphs, importGraph, inLayerEdges, layerEdgeCount, layerEdges, LE, moveBackward, moveForward, moveToBack, moveToFront, N, nodeCount, outLayerEdges, setEdgeID, setNodeID, setParentID, sortGraphs, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

layerLayouts

protected GraphMap layerLayouts
Stores the layout information for each layer (graph).


layerEdgeLayouts

protected LayerEdgeMap layerEdgeLayouts
Stores the layout information for each layer edge.


boundingBox

protected BoundingBox boundingBox
Stores the last computed bounding box for this LayeredLayoutGraph.

Constructor Detail

LayeredLayoutGraph

public LayeredLayoutGraph()
Creates an empty LayeredLayoutGraph.

Method Detail

clear

public void clear()
Resets the LayeredLayoutGraph to its initial state.

Overrides:
clear in class LayeredGraph

clearLayerEdges

public void clearLayerEdges()
Removes all layer edges present in this LayeredLayoutGraph.

Overrides:
clearLayerEdges in class LayeredGraph

removeGraph

public void removeGraph(Graph graph)
Removes the passed LayoutGraph from this LayeredLayoutGraph.

Additionally to the actions described in LayeredGraph.removeGraph this method also removes the layer layout associated with the removed graph.

Overrides:
removeGraph in class LayeredGraph
Parameters:
graph - The graph that will be removed.

removeLayerEdge

public void removeLayerEdge(LayerEdge layerEdge)
Removes the passed layer edge from this LayeredLayoutGraph.

Additionally to the actions described in LayeredGraph.removeLayerEdge this method also removes the layer edge layout associated with the removed layer edge.

Overrides:
removeLayerEdge in class LayeredGraph
Parameters:
layerEdge - The layer edge that will be removed.

sortGraphsByZ

public void sortGraphsByZ()
Sorts the layers (graphs) inside this LayeredLayoutGraph with respect to their z-position. Layers with low z-values will go before layers with higher z-values.


getBoundingBox

public BoundingBox getBoundingBox()
Returns a bounding box that encompasses all layers, layer edges, nodes and edges from this LayeredLayoutGraph.


recalculateBoundingBox

public void recalculateBoundingBox()
Erases the previously computed bounding box or this graph and recomputes it.


getLayout

public LayerLayout25D getLayout(Graph graph)
Returns the layout associated with the given graph. The graph must belong to this LayeredLayoutGraph.


getLayout

public LayerEdgeLayout25D getLayout(LayerEdge layerEdge)
Returns the layout associated with the given layer edge. The layer edge must belong to this LayeredLayoutGraph.


getPoint3D

public Point3D getPoint3D(Node n)
Returns the position of the given node in three-dimensional space. X- and y-coordinates are extracted from the NodeLayout25D of the node, the z-coordinate is extracted from the LayerLayout25D of the layer the node belongs to.


setZ

public void setZ(Graph graph,
                 double z)
Sets the z-coordinate for the given layer (graph).


getZ

public double getZ(Graph graph)
Returns the z-corrdinate of the geiven layer (graph).