Search this API

y.layout
Class LayoutGraph

java.lang.Object
  extended by y.base.Graph
      extended by y.layout.LayoutGraph
All Implemented Interfaces:
GraphInterface, GraphLayout
Direct Known Subclasses:
CopiedLayoutGraph, DefaultLayoutGraph, Graph2D

public abstract class LayoutGraph
extends Graph
implements GraphLayout

This class represents a drawing of a graph.


Field Summary
 
Fields inherited from class y.base.Graph
AFTER, BEFORE
 
Constructor Summary
LayoutGraph()
          Creates a new Layout Graph
LayoutGraph(LayoutGraph argGraph)
          Creates a copy of the given subgraph.
LayoutGraph(LayoutGraph graph, YCursor nodeSubset)
          Creates a copy of the given subgraph.
 
Method Summary
protected abstract  GraphCopier.CopyFactory createGraphCopyFactory()
          Factory method that is called by Graph.getGraphCopyFactory() to create a (possibly shared) instance.
 Rectangle getBoundingBox()
          Returns the bounding box of the diagram.
 YPoint getCenter(Node node)
          Returns the position of a node in a drawing.
 double getCenterX(Node v)
          Returns the center x-coordinate of the given node.
 double getCenterY(Node v)
          Returns the center y-coordinate of the given node.
 EdgeLabelLayout[] getEdgeLabelLayout(Object edge)
          Returns EdgeLabelLayout objects which describe the layouts of the labels that belong to the given edge.
 EdgeLayout getEdgeLayout(Object edge)
          Returns the layout information for an edge in the drawing.
 EdgeList getEdgeList()
          Returns a list, which contains the edges of the graph.
abstract  Edge getFeature(EdgeLabelLayout labelLayout)
          Returns the edge which is described by a given label layout.
abstract  Node getFeature(NodeLabelLayout labelLayout)
          Returns the node which is described by a given label layout.
 double getHeight(Node v)
          Returns the height of the given node
abstract  EdgeLabelLayout[] getLabelLayout(Edge edge)
          Returns EdgeLabelLayout objects which describe the layouts of the labels that belong to the given edge.
abstract  NodeLabelLayout[] getLabelLayout(Node node)
          Returns NodeLabelLayout objects which describe the layouts of the labels that belong to the given node.
abstract  EdgeLayout getLayout(Edge edge)
          Returns the layout information for an edge in the drawing.
abstract  NodeLayout getLayout(Node node)
          Returns the layout information for a node in the drawing.
 YPoint getLocation(Node node)
          Returns the position of the node in a drawing.
 NodeLabelLayout[] getNodeLabelLayout(Object node)
          Returns NodeLabelLayout objects which describe the layouts of the labels that belong to the given node.
 NodeLayout getNodeLayout(Object node)
          Returns the layout information for a node in the drawing.
 YPointPath getPath(Edge edge)
          Returns the path of an edge.
 YList getPathList(Edge edge)
          Returns the path of an edge.
 YList getPointList(Edge edge)
          Returns the control points of an edge.
 YPointPath getPoints(Edge edge)
          Returns the control points of an edge.
 YRectangle getRectangle(Node node)
          Returns the bounding box of a node.
 YDimension getSize(Node node)
          Returns the size of the node in a drawing.
 YPoint getSourcePointAbs(Edge edge)
          Returns the coordinates of the source end point of an edge in absolute coordinates.
 YPoint getSourcePointRel(Edge edge)
          Returns the coordinates of the source end point of an edge in relative coordinates to the center of the source node.
 YPoint getTargetPointAbs(Edge edge)
          Returns the coordinates of the target end point of an edge in absolute coordinates.
 YPoint getTargetPointRel(Edge edge)
          Returns the coordinates of the target end point of an edge in relative coordinates to the center of the target node.
 double getWidth(Node v)
          Returns the width of the given node.
 double getX(Node v)
          Returns the upper left x-coordinate of the given node.
 double getY(Node v)
          Returns the upper left y-coordinate of the given node.
 void moveBy(Node node, double dx, double dy)
          Moves the location of a node by a given vector
 void setCenter(Node v, double x, double y)
          Sets the center coordinates of the given node.
 void setCenter(Node node, YPoint position)
          Sets the position of a node in a drawing.
 void setEndPointsAbs(Edge edge, YPoint source, YPoint target)
          Set the two end points of an edge in absolute coordinates.
 void setLocation(Node v, double x, double y)
          Sets the upper left coordinates of the given node.
 void setLocation(Node node, YPoint position)
          Set the position of the node in a drawing.
 void setPath(Edge edge, YList path)
          Sets the path of an edge.
 void setPath(Edge edge, YPointPath path)
          Sets the path of an edge.
 void setPoints(Edge edge, YList points)
          Sets the control points of an edge.
 void setPoints(Edge edge, YPointPath points)
          Sets the control points of an edge.
 void setSize(Node v, double w, double h)
          Sets the size of the given node.
 void setSize(Node node, YDimension size)
          Set the size of the node in a drawing.
 void setSourcePointAbs(Edge edge, YPoint point)
          Sets the coordinates of the source end point of an edge in absolute coordinates.
 void setSourcePointRel(Edge edge, YPoint point)
          Sets the coordinates of the source end point of an edge in relative coordinates to the center of the source node.
 void setTargetPointAbs(Edge edge, YPoint point)
          Sets the coordinates of the target end point of an edge in absolute coordinates.
 void setTargetPointRel(Edge edge, YPoint point)
          Sets the coordinates of the target end point of an edge in relative coordinates to the center of the target node.
 
Methods inherited from class y.base.Graph
addDataProvider, addGraphListener, changeEdge, changeEdge, changeEdge, clear, contains, contains, containsEdge, createCopy, createEdge, createEdge, createEdgeMap, createGraph, createNode, createNodeMap, disposeEdgeMap, disposeNodeMap, E, edgeCount, edgeObjects, edges, fireGraphEvent, firePostEvent, firePostEvent, firePreEvent, firePreEvent, firstEdge, firstNode, firstOutEdge, getDataProvider, getDataProviderKeys, getEdgeArray, getGraphCopyFactory, getGraphListeners, getNodeArray, getRegisteredEdgeMaps, getRegisteredNodeMaps, getSource, getTarget, hasListeners, hide, hide, isEmpty, lastEdge, lastNode, moveSubGraph, moveToFirst, moveToFirst, moveToLast, moveToLast, N, nodeCount, nodeObjects, nodes, printNodeSlotSize, reInsertEdge, reInsertNode, removeDataProvider, removeEdge, removeGraphListener, removeNode, reverseEdge, setGraphCopyFactory, sortEdges, sortEdges, sortNodes, toString, unhide, unhide
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LayoutGraph

public LayoutGraph()
Creates a new Layout Graph


LayoutGraph

public LayoutGraph(LayoutGraph argGraph)
Creates a copy of the given subgraph.


LayoutGraph

public LayoutGraph(LayoutGraph graph,
                   YCursor nodeSubset)
Creates a copy of the given subgraph.

Method Detail

createGraphCopyFactory

protected abstract GraphCopier.CopyFactory createGraphCopyFactory()
Description copied from class: Graph
Factory method that is called by Graph.getGraphCopyFactory() to create a (possibly shared) instance.

Overrides:
createGraphCopyFactory in class Graph
Returns:
the (possibly shared) instance.

getLayout

public abstract NodeLayout getLayout(Node node)
Returns the layout information for a node in the drawing.

Parameters:
node - a node in the drawing.
Returns:
the layout information for node.

getLayout

public abstract EdgeLayout getLayout(Edge edge)
Returns the layout information for an edge in the drawing.

Parameters:
edge - a edge in the drawing.
Returns:
the layout information for edge.

getLabelLayout

public abstract NodeLabelLayout[] getLabelLayout(Node node)
Returns NodeLabelLayout objects which describe the layouts of the labels that belong to the given node.

Parameters:
node - a node in the drawing.
Returns:
the node label layout information for node.

getLabelLayout

public abstract EdgeLabelLayout[] getLabelLayout(Edge edge)
Returns EdgeLabelLayout objects which describe the layouts of the labels that belong to the given edge.

Parameters:
edge - an edge in the drawing.
Returns:
the edge label layout information for edge.

getFeature

public abstract Node getFeature(NodeLabelLayout labelLayout)
Returns the node which is described by a given label layout.


getFeature

public abstract Edge getFeature(EdgeLabelLayout labelLayout)
Returns the edge which is described by a given label layout.


getNodeLayout

public NodeLayout getNodeLayout(Object node)
Returns the layout information for a node in the drawing.

Specified by:
getNodeLayout in interface GraphLayout
Parameters:
node - a node in the drawing.
Returns:
the layout information for node.

getEdgeLayout

public EdgeLayout getEdgeLayout(Object edge)
Returns the layout information for an edge in the drawing.

Specified by:
getEdgeLayout in interface GraphLayout
Parameters:
edge - a edge in the drawing.
Returns:
the layout information for edge.

getNodeLabelLayout

public NodeLabelLayout[] getNodeLabelLayout(Object node)
Returns NodeLabelLayout objects which describe the layouts of the labels that belong to the given node.

Specified by:
getNodeLabelLayout in interface GraphLayout
Parameters:
node - a node in the drawing.
Returns:
the node label layout information for node.

getEdgeLabelLayout

public EdgeLabelLayout[] getEdgeLabelLayout(Object edge)
Returns EdgeLabelLayout objects which describe the layouts of the labels that belong to the given edge.

Specified by:
getEdgeLabelLayout in interface GraphLayout
Parameters:
edge - an edge in the drawing.
Returns:
the edge label layout information for edge.

getCenterX

public double getCenterX(Node v)
Returns the center x-coordinate of the given node.


getCenterY

public double getCenterY(Node v)
Returns the center y-coordinate of the given node.


getCenter

public YPoint getCenter(Node node)
Returns the position of a node in a drawing. The position is defined by the center of the node.

Parameters:
node - a node in the graph
Returns:
the center of the node in the drawing of the node

getX

public double getX(Node v)
Returns the upper left x-coordinate of the given node.


getY

public double getY(Node v)
Returns the upper left y-coordinate of the given node.


getLocation

public YPoint getLocation(Node node)
Returns the position of the node in a drawing. The position is defined by the upper left corner of the node.

Parameters:
node - a node in the graph
Returns:
the upper left corner of the drawing of the node

getWidth

public double getWidth(Node v)
Returns the width of the given node.


getHeight

public double getHeight(Node v)
Returns the height of the given node


getSize

public YDimension getSize(Node node)
Returns the size of the node in a drawing.

Parameters:
node - a node in the graph.
Returns:
the size of the node.

getRectangle

public YRectangle getRectangle(Node node)
Returns the bounding box of a node.

Parameters:
node - a node in the graph.
Returns:
a box.

setCenter

public void setCenter(Node node,
                      YPoint position)
Sets the position of a node in a drawing. The position is defined by the center of the node.

Parameters:
node - a node in the graph
position - the center of the node in the drawing of the node

setCenter

public void setCenter(Node v,
                      double x,
                      double y)
Sets the center coordinates of the given node.


setSize

public void setSize(Node v,
                    double w,
                    double h)
Sets the size of the given node.


setSize

public void setSize(Node node,
                    YDimension size)
Set the size of the node in a drawing.

Parameters:
node - a node in the graph
size - the size of the node.

setLocation

public void setLocation(Node v,
                        double x,
                        double y)
Sets the upper left coordinates of the given node.


setLocation

public void setLocation(Node node,
                        YPoint position)
Set the position of the node in a drawing. The position is defined by the upper left corner of the node.

Parameters:
node - a node in the graph
position - the upper left corner of the drawing of the node

moveBy

public void moveBy(Node node,
                   double dx,
                   double dy)
Moves the location of a node by a given vector

Parameters:
node - a node in the graph
dx - the x-component of the vector
dy - the y-component of the vector

getPoints

public YPointPath getPoints(Edge edge)
Returns the control points of an edge.

Parameters:
edge - an edge in the graph
Returns:
the sequence of control points.

getPointList

public YList getPointList(Edge edge)
Returns the control points of an edge.

Parameters:
edge - an edge in the graph
Returns:
the sequence of control points as a YList

getPath

public YPointPath getPath(Edge edge)
Returns the path of an edge. The path of an edge is the position of the source port, followed by the positions of the bends, followed by the position of the target port.

Parameters:
edge - an edge in the graph
Returns:
the path

getPathList

public YList getPathList(Edge edge)
Returns the path of an edge. The path of an edge is the position of the source port, followed by the positions of the bends, followed by the position of the target port.

Parameters:
edge - an edge in the graph
Returns:
the path as a YList

setPath

public void setPath(Edge edge,
                    YPointPath path)
Sets the path of an edge. The path of an edge is the position of the source port, followed by the positions of the bends, followed by the position of the target port. Both source and target port are expected to be given in absolute coordinates.

Parameters:
edge - an edge in the graph
path - the path sequence.
Precondition:
The length of the path must be 2 at least.

setPath

public void setPath(Edge edge,
                    YList path)
Sets the path of an edge. The path of an edge is the position of the source port, followed by the positions of the bends, followed by the position of the target port. Both source and target port are expected to be given in absolute coordinates.

Parameters:
edge - an edge in the graph
path - the path sequence given as a YList
Precondition:
The length of the path must be 2 at least.

setPoints

public void setPoints(Edge edge,
                      YPointPath points)
Sets the control points of an edge.

Parameters:
edge - an edge in the graph
points - the sequence of control points.

setPoints

public void setPoints(Edge edge,
                      YList points)
Sets the control points of an edge.

Parameters:
edge - an edge in the graph
points - the sequence of control points as a YList

setEndPointsAbs

public void setEndPointsAbs(Edge edge,
                            YPoint source,
                            YPoint target)
Set the two end points of an edge in absolute coordinates.

Parameters:
edge - an edge in the graph.
source - the port on the source side of the edge.
target - the port on the target side of the edge.

getSourcePointRel

public YPoint getSourcePointRel(Edge edge)
Returns the coordinates of the source end point of an edge in relative coordinates to the center of the source node.

Parameters:
edge - an edge in the graph

getTargetPointRel

public YPoint getTargetPointRel(Edge edge)
Returns the coordinates of the target end point of an edge in relative coordinates to the center of the target node.

Parameters:
edge - an edge in the graph

setSourcePointRel

public void setSourcePointRel(Edge edge,
                              YPoint point)
Sets the coordinates of the source end point of an edge in relative coordinates to the center of the source node.

Parameters:
edge - an edge in the graph
point -

setTargetPointRel

public void setTargetPointRel(Edge edge,
                              YPoint point)
Sets the coordinates of the target end point of an edge in relative coordinates to the center of the target node.

Parameters:
edge - an edge in the graph

getSourcePointAbs

public YPoint getSourcePointAbs(Edge edge)
Returns the coordinates of the source end point of an edge in absolute coordinates.

Parameters:
edge - an edge in the graph

getTargetPointAbs

public YPoint getTargetPointAbs(Edge edge)
Returns the coordinates of the target end point of an edge in absolute coordinates.

Parameters:
edge - an edge in the graph

setSourcePointAbs

public void setSourcePointAbs(Edge edge,
                              YPoint point)
Sets the coordinates of the source end point of an edge in absolute coordinates.

Parameters:
edge - an edge in the graph
point -

setTargetPointAbs

public void setTargetPointAbs(Edge edge,
                              YPoint point)
Sets the coordinates of the target end point of an edge in absolute coordinates.

Parameters:
edge - an edge in the graph
point -

getEdgeList

public EdgeList getEdgeList()
Returns a list, which contains the edges of the graph.


getBoundingBox

public Rectangle getBoundingBox()
Returns the bounding box of the diagram. This is the smallest rectangle containing the entire diagram. If the graph does not contain any nodes (and therefore no edges either), the bounding box will have negative width and/or height.

Specified by:
getBoundingBox in interface GraphLayout

© Copyright 2000-2013,
yWorks GmbH.
All rights reserved.