|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecty25.base.LayeredGraph
y25.layout.LayeredLayoutGraph
y25.view.Graph25D
Represents a LayeredLayoutGraph
with additional 2.5D support.
Instances of this class can be displayed within a Graph25DView
. The
layout and visual representation of nodes, edges, layer edges and layers are
encapsulated in so called realizer objects, which implement the respective
Layout25D interfaces defined in the y25.layout
package. Every
node has a NodeRealizer25D
, every edge an
EdgeRealizer25D
, every layer edge a
LayerEdgeRealizer25D
and every layer (graph) a
LayerRealizer25D
associated with it.
All geometric or visual changes hat are performed on this Graph25D result in
an attribute or type change of an associated realizer. If nodes, edges, layer
edges or layers (graphs) get newly created in this Graph25D then a default
node, edge, layer edge or layer realizer 25D will be automatically associated
with these elements. To change the default appearance of these elements, one
can assign different default realizers by using the methods
setDefault[Node|Edge|LayerEdge|Layer]Realizer
.
In order to be able to assign node and edge realizers to nodes and edges
inside different layers, every graph this class class stores internally is of
type Graph2D
, so when iterating over this Graph25D's layers,
casting to Graph2D
is always allowed.
There is one subtle implementation detail worth noting: Since compatibility
with the yFiles package was one of the major goals in designing this package,
every Graph2D
that is stored inside this Graph25D
can be displayed and modified in a separate Graph2DView
. To
allow for this usage, node and edge realizers stored inside the
Graph2D
s have to be of type NodeRealizer
and
EdgeRealizer
respectively. The same realizers, however, are
used when displaying the Graph2D
s inside the
Graph25DView
. For this to be possible, every realizer stored
inside a Graph2D
needs to extend NodeRealizer
and implement the NodeRealizer25D
interface. (ShapeNodeRealizer25D
and PolyLineEdgeRealizer25D
are examples for this).
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 |
Fields inherited from class y25.layout.LayeredLayoutGraph |
boundingBox, layerEdgeLayouts, layerLayouts |
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 | |
Graph25D()
Creates a new Graph25D . |
Method Summary | |
void |
clear()
Resets the Graph25D to its initial state. |
void |
clearLayerEdges()
Removes all layer edges present in this Graph25D . |
Graph |
createGraph()
Creates a new Graph2D and returns it. |
Graph |
createGraph(int where,
Graph reference)
Creates a new Graph2D at a specified location inside the
graph list and returns it. |
LayerEdge |
createLayerEdge(Node source,
Node target)
Creates a new layer edge from the source to the target node. |
Graph |
duplicateGraph(Graph original)
Creates a new Graph2D by copying the passed
Graph2D . |
EdgeRealizer |
getDefaultEdgeRealizer25D()
Returns a copy of the default edge realizer used in this Graph25D . |
LayerEdgeRealizer25D |
getDefaultLayerEdgeRealizer25D()
Returns a copy of the default layer edge realizer used in this Graph25D . |
LayerRealizer25D |
getDefaultLayerRealizer25D()
Returns a copy of the default layer realizer used in this Graph25D . |
NodeRealizer |
getDefaultNodeRealizer25D()
Returns a copy of the default node realizer used in this Graph25D . |
EdgeRealizer |
getRealizer(Edge edge)
Returns the EdgeRealizer that is associated with the
passed edge. |
LayerRealizer25D |
getRealizer(Graph graph)
Returns the LayerRealizer25D that is associated with the
passed graph. |
LayerEdgeRealizer25D |
getRealizer(LayerEdge layerEdge)
Returns the LayerEdgeRealizer25D that is associated with
the passed layer edge. |
NodeRealizer |
getRealizer(Node node)
Returns the NodeRealizer that is associated with the
passed node. |
Graph |
importGraph(Graph graph)
Creates a new Graph2D by copying the passed
Graph2D . |
void |
removeGraph(Graph graph)
Removes the passed Graph2D from this Graph25D . |
void |
removeLayerEdge(LayerEdge layerEdge)
Removes the passed layer edge from this Graph25D. |
void |
setDefaultEdgeRealizer25D(EdgeRealizer er)
Sets the default EdgeRealizer for this
Graph25D and all its associated Graph2D s
to the passsed realizer. |
void |
setDefaultLayerEdgeRealizer25D(LayerEdgeRealizer25D ler)
Sets the default LayerEdgeRealizer25D for this
Graph25D to the passsed realizer. |
void |
setDefaultLayerRealizer25D(LayerRealizer25D lr)
Sets the default LayerRealizer25D for this
Graph25D to the passsed realizer. |
void |
setDefaultNodeRealizer25D(NodeRealizer nr)
Sets the default NodeRealizer for this
Graph25D and all its associated Graph2D s
to the passsed realizer. |
void |
setRealizer(Edge edge,
EdgeRealizer er)
Sets the passed edge's realizer to the passed edge realizer. |
void |
setRealizer(Graph graph,
LayerRealizer25D lr)
Sets the passed graph's realizer to the passed layer realizer. |
void |
setRealizer(LayerEdge layerEdge,
LayerEdgeRealizer25D ler)
Sets the passed layer edge's realizer to the passed layer edge realizer. |
void |
setRealizer(Node node,
NodeRealizer nr)
Sets the passed node's realizer to the passed node realizer. |
Methods inherited from class y25.layout.LayeredLayoutGraph |
getBoundingBox, getLayout, getLayout, getPoint3D, getZ, recalculateBoundingBox, setZ, sortGraphsByZ |
Methods inherited from class y25.base.LayeredGraph |
copyCreateStructureData, createEdgeMap, createGraphMap, createLayerEdgeMap, createNodeMap, E, edgeCount, G, getEdgeID, getGraphArray, getGraphCursorAfter, getGraphCursorBefore, getLayerEdgeArray, getNodeID, getParentID, graphCount, graphs, 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 |
Constructor Detail |
public Graph25D()
Graph25D
.
Method Detail |
public void clear()
Graph25D
to its initial state.
clear
in class LayeredLayoutGraph
public void clearLayerEdges()
Graph25D
.
clearLayerEdges
in class LayeredLayoutGraph
public Graph createGraph()
Graph2D
and returns it. The new graph will
be located at the end of the graph list inside this Graph2D
.
The returned graph automatically assigns new and unique IDs to nodes and
edges as soon as they are created. After creation, changing these
automatically assigned IDs is accomplished by calling the LayeredGraph
methods setNodeID
, setParentID
and
setEdgeID
.
The created graph is automatically assigned the default layer realizer.
Also, newly created nodes and edges inside the Graph2D
will automatically receive the default node and edge realizers associated
with this Graph25D
.
The z-position of the returned graph is set to 0
.
createGraph
in class LayeredGraph
public Graph createGraph(int where, Graph reference)
Graph2D
at a specified location inside the
graph list and returns it.
The returned graph automatically assigns new and unique IDs to nodes and
edges as soon as they are created. After creation, changing these
automatically assigned IDs is accomplished by calling the LayeredGraph
methods setNodeID
, setParentID
and
setEdgeID
.
The created graph is automatically assigned the default layer realizer.
Also, newly created nodes and edges inside the Graph2D
will automatically receive the default node and edge realizers associated
with this Graph25D
.
createGraph
in class LayeredGraph
where
- Can be either LayeredGraph.BEFORE
or
LayeredGraph.AFTER
. In the fromer case, the
new graph is inserted into the list right before the passed
reference graph, in the latter case it is inserted after the
passed reference graph.reference
- A graph that is already in the graph list of this Graph25D. If
null
is passed, the newly created graph is
inserted at the very beginning of the list if
where
is LayeredGraph.BEFORE
or
at the very end of the graph list if where
is
LayeredGraph.AFTER
.
public Graph duplicateGraph(Graph original)
Graph2D
by copying the passed
Graph2D
. The passed graph has to be part of this
Graph25D
. The new graph's location inside the graph list
will be right after the original graph.
The created graph is assigned a copy of the layer realizer of the
original graph. Newly created nodes and edges inside the
Graph2D
will automatically receive the default node and
edge realizers associated with the original graph.
The new graph is then returned. It has exactly the same nodes and edges
as the original graph. All node, edge and parent IDs are also identical
to the original. The returned graph automatically assigns new and unique
IDs to newlu created nodes and edges. After creation, changing these
automatically assigned IDs is accomplished by calling the LayeredGraph
methods setNodeID
, setParentID
and
setEdgeID
.
duplicateGraph
in class LayeredGraph
original
- the graph that will be copied.
public Graph importGraph(Graph graph)
Graph2D
by copying the passed
Graph2D
. The difference to the
duplicateGraph
method is, that the passed graph is not
part of this Graph25D
. If you already have code that
generates a Graph2D
and you want to use that graph inside
this Graph25D
, this is the method you have to use. (It is
an error to pass a graph that is already inside this
Graph25D
to this method.)
The new graph will be located at the end of the graph list inside this
Graph25D
. It has exactly the same nodes and edges as the
original graph.
Regarding node, edge and parent IDs, there are two possibilities:
DataProvider
s for the
keys LayeredGraph.NODE_ID_DPKEY
,
LayeredGraph.PARENT_ID_DPKEY
and
LayeredGraph.EDGE_ID_DPKEY
, new IDs will be created for
every node and edge in the copied graph. The parent IDs will all be set
to 0
. DataProvider
s for the following keys:
LayeredGraph.NODE_ID_DPKEY
,
LayeredGraph.PARENT_ID_DPKEY
,
LayeredGraph.EDGE_ID_DPKEY
. Then you can assign node,
edge and parent IDs as you like. These IDs will then be copied to the new
graph that is created. Note that you have to perform these steps
before you call this method. setNodeID
, setParentID
and
setEdgeID
.
importGraph
in class LayeredGraph
graph
- the graph that will be copied.
public void removeGraph(Graph graph)
Graph2D
from this Graph25D
.
See LayeredGraph.removeGraph
and
LayeredLayoutGraph.removeGraph
for a description of what exactly this method does.
removeGraph
in class LayeredLayoutGraph
graph
- The graph that will be removed.public LayerEdge createLayerEdge(Node source, Node target)
Graph2D
s that belong to this
Graph25D
.
The created layer edge is automatically assigned the default layer edge realizer.
createLayerEdge
in class LayeredGraph
source
- The source node for the layer edge.target
- The target node for the layer edge.
public void removeLayerEdge(LayerEdge layerEdge)
See
LayeredGraph.removeLayerEdge
for a description of what exactly this method does.
removeLayerEdge
in class LayeredLayoutGraph
layerEdge
- The layer edge that will be removed.public void setRealizer(Node node, NodeRealizer nr)
Note that the passed NodeRealizer has to implement the NodeRealizer25D
interface. If this is not the case, an attempt is made to create an
analog 25D version of the passed realizer via an instance of
Realizer25DFactory
. If this fails too, the default layer
realizer of this Graph25D
is used.
public void setRealizer(Edge edge, EdgeRealizer er)
Note that the passed EdgeRealizer has to implement the EdgeRealizer25D
interface. If this is not the case, an attempt is made to create an
analog 25D version of the passed realizer via an instance of
Realizer25DFactory
. If this fails too, the default layer
realizer of this Graph25D
is used.
public void setRealizer(LayerEdge layerEdge, LayerEdgeRealizer25D ler)
public void setRealizer(Graph graph, LayerRealizer25D lr)
public NodeRealizer getRealizer(Node node)
NodeRealizer
that is associated with the
passed node.
All NodeRealizer
s stored inside this
Graph25D
(or inside the node's Graph2D
for
that matter) implement the NodeRealizer25D
interface, so
casting the result to that type is always safe.
public EdgeRealizer getRealizer(Edge edge)
EdgeRealizer
that is associated with the
passed edge.
All EdgeRealizer
s stored inside this
Graph25D
(or inside the edge's Graph2D
for
that matter) implement the EdgeRealizer25D
interface, so
casting the result to that type is always safe.
public LayerEdgeRealizer25D getRealizer(LayerEdge layerEdge)
LayerEdgeRealizer25D
that is associated with
the passed layer edge.
public LayerRealizer25D getRealizer(Graph graph)
LayerRealizer25D
that is associated with the
passed graph.
public void setDefaultNodeRealizer25D(NodeRealizer nr)
NodeRealizer
for this
Graph25D
and all its associated Graph2D
s
to the passsed realizer.
Note that the passed NodeRealizer has to implement the NodeRealizer25D
interface. If this is not the case, an attempt is made to create an
analog 25D version of the passed realizer via an instance of
Realizer25DFactory
. If this fails too, the default layer
realizer of this Graph25D
is used.
public void setDefaultEdgeRealizer25D(EdgeRealizer er)
EdgeRealizer
for this
Graph25D
and all its associated Graph2D
s
to the passsed realizer.
Note that the passed EdgeRealizer has to implement the EdgeRealizer25D
interface. If this is not the case, an attempt is made to create an
analog 25D version of the passed realizer via an instance of
Realizer25DFactory
. If this fails too, the default layer
realizer of this Graph25D
is used.
public void setDefaultLayerEdgeRealizer25D(LayerEdgeRealizer25D ler)
LayerEdgeRealizer25D
for this
Graph25D
to the passsed realizer.
public void setDefaultLayerRealizer25D(LayerRealizer25D lr)
LayerRealizer25D
for this
Graph25D
to the passsed realizer.
public NodeRealizer getDefaultNodeRealizer25D()
Graph25D
.
All NodeRealizer
s stored inside this
Graph25D
and its associated Graph2D
s
implement the NodeRealizer25D
interface, so casting the
result to that type is always safe.
Note that this method doesn't work like its corresponding
Graph2D
method, since a copy of the default
realizer is returned at not the realizer itself. This is done in order to
prevent unexpected behavior. If the the goal is to change the default
realizer of this Graph25D
and all its associated
Graph2D
s by modifying a parameter of the default node
realizer, the following steps have to be performed:
setDefaultNodeRealizer25D
and pass it the
modified copy
public EdgeRealizer getDefaultEdgeRealizer25D()
Graph25D
.
All EdgeRealizer
s stored inside this
Graph25D
and its associated Graph2D
s
implement the EdgeRealizer25D
interface, so casting the
result to that type is always safe.
Note that this method doesn't work like its corresponding
Graph2D
method, since a copy of the default
realizer is returned at not the realizer itself. This is done in order to
prevent unexpected behavior. If the the goal is to change the default
realizer of this Graph25D
and all its associated
Graph2D
s by modifying a parameter of the default edge
realizer, the following steps have to be performed:
setDefaultEdgeRealizer25D
and pass it the
modified copy
public LayerEdgeRealizer25D getDefaultLayerEdgeRealizer25D()
Graph25D
.
Note that this method doesn't necessarily work as you might expect. It is
important to realize that a copy of the default realizer is
returned. If the the goal is to change the default layer realizer of this
Graph25D
and all its associated Graph2D
s
by modifying a parameter of the default layer edge realizer, the
following steps have to be performed:
setDefaultLayerEdgeRealizer25D
and pass it
the modified copy
public LayerRealizer25D getDefaultLayerRealizer25D()
Graph25D
.
Note that this method doesn't necessarily work as you might expect. It is
important to realize that a copy of the default realizer is
returned. If the the goal is to change the default layer realizer of this
Graph25D
and all its associated Graph2D
s
by modifying a parameter of the default layer realizer, the following
steps have to be performed:
setDefaultLayerRealizer25D
and pass it the
modified copy
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |