public abstract class LayoutGraph extends Graph implements com.yworks.yfiles.layout.IGraphLayout
LayoutGraph
is a Graph
with attached layout information that basically represents a drawing of a
graph.
It provides access to the layout information for nodes, edges and labels. This layout information consists of coordinates for the elements.
Layout algorithms
work on LayoutGraph
s and arrange their nodes and edges.
Constructor and Description |
---|
LayoutGraph()
Creates a new, empty
LayoutGraph with default settings. |
LayoutGraph(LayoutGraph subgraph)
Creates a new
LayoutGraph which is a copy of the given subgraph. |
LayoutGraph(LayoutGraph graph,
ICursor nodeSubset)
Creates a new
LayoutGraph which is a copy of the given subgraph. |
Modifier and Type | Method and Description |
---|---|
protected abstract ILabelLayoutFactory |
createLabelFactory()
Creates a new
ILabelLayoutFactory for this LayoutGraph that can be used for copying layout information
of labels. |
Rectangle2D |
getBoundingBox() |
YRectangle |
getBoundingBox(Node node)
Returns the rectangle describing the bounding box of the given node.
|
YPoint |
getCenter(Node node)
Returns the center coordinates of the given node.
|
double |
getCenterX(Node node)
Returns the x-coordinate of the given node's center.
|
double |
getCenterY(Node node)
Returns the y-coordinate of the given node's center.
|
EdgeList |
getEdgeList()
Gets a list of all edges in the graph.
|
double |
getHeight(Node node)
Returns the height of the given node.
|
abstract IEdgeLabelLayout[] |
getLabelLayout(Edge edge)
Returns the layout information for all labels associated with the given edge.
|
abstract INodeLabelLayout[] |
getLabelLayout(Node node)
Returns the layout information for all labels associated with the given node.
|
abstract IEdgeLayout |
getLayout(Edge edge)
Returns the layout information for the given edge.
|
abstract INodeLayout |
getLayout(Node node)
Returns the layout information for the given node.
|
YPoint |
getLocation(Node node)
Returns the coordinates of the given node's upper-left corner.
|
abstract Edge |
getOwner(IEdgeLabelLayout labelLayout)
Returns the edge to which the given
IEdgeLabelLayout belongs. |
abstract Node |
getOwner(INodeLabelLayout labelLayout)
Returns the node to which the given
INodeLabelLayout belongs. |
YPointPath |
getPath(Edge edge)
Returns the path of an edge, including the ports.
|
YList |
getPathList(Edge edge)
Returns the path of an edge, including the ports.
|
YList |
getPointList(Edge edge)
Returns the control points of an edge.
|
YPointPath |
getPoints(Edge edge)
Returns the control points of an edge.
|
YDimension |
getSize(Node node)
Returns the size of the given node.
|
YPoint |
getSourcePointAbs(Edge edge)
Returns the absolute coordinates of the source point of the given edge.
|
YPoint |
getSourcePointRel(Edge edge)
Returns the relative coordinates of the source point of the given edge.
|
YPoint |
getTargetPointAbs(Edge edge)
Returns the absolute coordinates of the target point of the given edge.
|
YPoint |
getTargetPointRel(Edge edge)
Returns the relative coordinates of the target point of the given edge.
|
double |
getWidth(Node node)
Returns the width of the given node.
|
double |
getX(Node node)
Returns the x-coordinate of the given node's upper-left corner.
|
double |
getY(Node node)
Returns the y-coordinate of the given node's upper-left corner.
|
void |
moveBy(Node node,
double dx,
double dy)
Moves the upper-left corner of a node by a given vector.
|
void |
setCenter(Node node,
double x,
double y)
Specifies the center coordinates of the given node.
|
void |
setCenter(Node node,
YPoint position)
Specifies the center coordinates of the given node.
|
void |
setEndPointsAbs(Edge edge,
YPoint source,
YPoint target)
Specifies the two end points of the given edge in absolute coordinates.
|
void |
setLocation(Node node,
double x,
double y)
Specifies the coordinates of the upper-left corner of the given node.
|
void |
setLocation(Node node,
YPoint position)
Specifies the coordinates of the upper-left corner of the given node.
|
void |
setPath(Edge edge,
YList path)
Sets the path of the given edge.
|
void |
setPath(Edge edge,
YPointPath path)
Sets the path of the given edge.
|
void |
setPoints(Edge edge,
YList points)
Sets the control points of the given edge.
|
void |
setPoints(Edge edge,
YPointPath points)
Sets the control points of the given edge.
|
void |
setSize(Node node,
double width,
double height)
Specifies the width and height of the given node.
|
void |
setSize(Node node,
YDimension size)
Specifies the size of the given node.
|
void |
setSourcePointAbs(Edge edge,
YPoint point)
Specifies the absolute coordinates of the source point of the given edge.
|
void |
setSourcePointRel(Edge edge,
YPoint point)
Specifies the relative coordinates of the source point of the given edge.
|
void |
setTargetPointAbs(Edge edge,
YPoint point)
Specifies the absolute coordinates of the target point of the given edge.
|
void |
setTargetPointRel(Edge edge,
YPoint point)
Specifies the relative coordinates of the target point of the given edge.
|
addDataProvider, changeEdge, changeEdge, changeEdge, clear, contains, contains, containsEdge, createCopy, createEdge, createEdge, createEdgeMap, createGraph, createNode, createNodeMap, disposeEdgeMap, disposeNodeMap, edgeCount, edgeObjects, firstEdge, firstNode, firstOutEdge, getDataProvider, getDataProviderKeys, getEdgeArray, getEdgeCursor, getEdges, getNodeArray, getNodeCursor, getNodes, getRegisteredEdgeMaps, getRegisteredNodeMaps, getSource, getTarget, hasListeners, hide, hide, isEmpty, lastEdge, lastNode, moveToFirst, moveToFirst, moveToLast, moveToLast, nodeCount, nodeObjects, printNodeSlotSize, reInsertEdge, reInsertNode, removeDataProvider, removeEdge, removeNode, reverseEdge, sortEdges, sortEdges, sortNodes, toString, unhide, unhide
public LayoutGraph()
LayoutGraph
with default settings.public LayoutGraph(LayoutGraph subgraph)
LayoutGraph
which is a copy of the given subgraph.subgraph
- the original subgraphpublic LayoutGraph(LayoutGraph graph, ICursor nodeSubset)
LayoutGraph
which is a copy of the given subgraph.graph
- the original graphnodeSubset
- the nodes that induce the subgraphprotected abstract ILabelLayoutFactory createLabelFactory()
ILabelLayoutFactory
for this LayoutGraph
that can be used for copying layout information
of labels.ILabelLayoutFactory
public final Rectangle2D getBoundingBox()
getBoundingBox
in interface com.yworks.yfiles.layout.IGraphLayout
public YRectangle getBoundingBox(Node node)
node
- the nodegetLocation(Node)
,
getSize(Node)
public YPoint getCenter(Node node)
node
- the nodeINodeLayout
,
setCenter(Node, double, double)
public double getCenterX(Node node)
node
- the nodeINodeLayout
public double getCenterY(Node node)
node
- the nodeINodeLayout
public EdgeList getEdgeList()
public double getHeight(Node node)
node
- the nodeINodeLayout.getHeight()
public abstract IEdgeLabelLayout[] getLabelLayout(Edge edge)
The layout information consists of the location, size and orientation of the label.
edge
- the edgepublic abstract INodeLabelLayout[] getLabelLayout(Node node)
The layout information consists of the location, size and orientation of the label.
node
- the nodepublic abstract IEdgeLayout getLayout(Edge edge)
The layout information consists of the locations of the control points and end points of the edge.
edge
- the edgepublic abstract INodeLayout getLayout(Node node)
The layout information consists of the location and size of the node.
node
- the nodepublic YPoint getLocation(Node node)
node
- the nodeINodeLayout.getX()
,
INodeLayout.getY()
public abstract Edge getOwner(IEdgeLabelLayout labelLayout)
IEdgeLabelLayout
belongs.labelLayout
- the label's layout informationpublic abstract Node getOwner(INodeLabelLayout labelLayout)
INodeLabelLayout
belongs.labelLayout
- the label's layout informationpublic YPointPath getPath(Edge 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.
edge
- the edgepublic YList getPathList(Edge 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.
edge
- the edgeYPoint
s representing the path of the given edgepublic YList getPointList(Edge edge)
edge
- the edgeYPoint
s representing the sequence of control points of the edgeIEdgeLayout
public YPointPath getPoints(Edge edge)
edge
- the edgeYPointPath
representing the sequence of control points of the edgeIEdgeLayout
public YDimension getSize(Node node)
node
- the nodeINodeLayout.getWidth()
,
INodeLayout.getHeight()
public YPoint getSourcePointAbs(Edge edge)
edge
- the edgepublic YPoint getSourcePointRel(Edge edge)
The coordinates are interpreted relative to the center of the source node.
edge
- the edgeIEdgeLayout.getSourcePoint()
public YPoint getTargetPointAbs(Edge edge)
edge
- the edgepublic YPoint getTargetPointRel(Edge edge)
The coordinates are interpreted relative to the center of the target node.
edge
- the edgeIEdgeLayout.getTargetPoint()
public double getWidth(Node node)
node
- the nodeINodeLayout.getWidth()
public double getX(Node node)
node
- the nodeINodeLayout.getX()
public double getY(Node node)
node
- the nodeINodeLayout.getY()
public void moveBy(Node node, double dx, double dy)
node
- the nodedx
- the x-component of the vectordy
- the y-component of the vectorpublic void setCenter(Node node, double x, double y)
node
- the nodex
- the new x-coordinate of the node's centery
- the new y-coordinate of the node's centerINodeLayout
public void setCenter(Node node, YPoint position)
node
- the nodeposition
- the new location of the node's centerINodeLayout
,
setCenter(Node, double, double)
public void setEndPointsAbs(Edge edge, YPoint source, YPoint target)
edge
- the edgesource
- the port on the source side of the edgetarget
- the port on the target side of the edgesetSourcePointAbs(Edge, YPoint)
,
setTargetPointAbs(Edge, YPoint)
public void setLocation(Node node, double x, double y)
node
- the nodex
- the new x-coordinate of the upper-left cornery
- the new y-coordinate of the upper-left cornerINodeLayout.setLocation(double, double)
public void setLocation(Node node, YPoint position)
node
- the nodeposition
- the new location of the upper-left cornerINodeLayout.setLocation(double, double)
,
setLocation(Node, double, double)
public void setPath(Edge edge, YList path)
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.
2
.edge
- an edge in the graphpath
- the list of YPoint
s representing the new path sequence of the edgepublic void setPath(Edge edge, YPointPath path)
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.
2
.edge
- an edge in the graphpath
- the new path sequence of the edgepublic void setPoints(Edge edge, YList points)
The source and target points of the edge will not be modified.
edge
- an edge in the graphpoints
- the list of YPoint
s representing the new sequence of control pointspublic void setPoints(Edge edge, YPointPath points)
The source and target points of the edge will not be modified.
edge
- an edge in the graphpoints
- the new sequence of control pointspublic void setSize(Node node, double width, double height)
node
- the nodewidth
- the new width of the nodeheight
- the new height of the nodeINodeLayout.setSize(double, double)
public void setSize(Node node, YDimension size)
node
- the nodesize
- the new size of the nodesetSize(Node, double, double)
,
INodeLayout.setSize(double, double)
public void setSourcePointAbs(Edge edge, YPoint point)
edge
- the edgepoint
- the new absolute source point coordinates of the edgepublic void setSourcePointRel(Edge edge, YPoint point)
The coordinates are interpreted relative to the center of the source node.
edge
- the edgepoint
- the new relative source point coordinates of the edgeIEdgeLayout.setSourcePoint(YPoint)
public void setTargetPointAbs(Edge edge, YPoint point)
edge
- the edgepoint
- the new absolute target point coordinates of the edgepublic void setTargetPointRel(Edge edge, YPoint point)
The coordinates are interpreted relative to the center of the target node.
edge
- the edgepoint
- the new relative target point coordinates of the edgeIEdgeLayout.setTargetPoint(YPoint)