
Search this API  
PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
java.lang.Object y.layout.LayoutTool
public class LayoutTool
The LayoutTool
provides several helper and utility functions for LayoutGraph
and the
layout algorithms
.
LayoutGraph
Field Summary  

static byte 
ALIGN_NODES_CENTERED
Node alignment policy that results in centeraligned nodes. 
static byte 
ALIGN_NODES_DISTRIBUTED
Node alignment policy that results in vertically or horizontally distributed nodes. 
static byte 
ALIGN_NODES_LEADING
Node alignment policy that results in topaligned nodes for vertical alignment and leftaligned nodes for horizontal alignments. 
static byte 
ALIGN_NODES_TRAILING
Node alignment policy that results in bottomaligned nodes for vertical alignment and rightaligned nodes for horizontal alignments. 
static int 
CENTER
Row alignment specifier which defines that each row will be aligned with its center. 
static byte 
FLOW_DOWN
Edge flow specifier which defines that the flow direction of most edges is down. 
static byte 
FLOW_LEFT
Edge flow specifier which defines that the flow direction of most edges is left. 
static byte 
FLOW_NONE
Edge flow specifier that defines that there is no main flow direction. 
static byte 
FLOW_RIGHT
Edge flow specifier which defines that the flow direction of most edges is right. 
static byte 
FLOW_UP
Edge flow specifier which defines that the flow direction of most edges is up. 
static int 
JUSTIFIED
Row alignment specifier which defines that each row will be aligned with its left border and its right border. 
static int 
LEADING
Row alignment specifier which defines that each row will be aligned with its left border. 
static byte 
MULTI_ROW_HEIGHT_CONSTRAINT
Constraint specifier for a multirow rectangle arrangement that constrains the height of the layout. 
static byte 
MULTI_ROW_NO_CONSTRAINT
Constraint specifier for a multirow rectangle arrangement that is unconstrained. 
static byte 
MULTI_ROW_WIDTH_CONSTRAINT
Constraint specifier for a multirow rectangle arrangement that constrains the width of the layout. 
static int 
TRAILING
Row alignment specifier which defines that each row will be aligned with its right border. 
Method Summary  

static void 
alignNodeLayouts(LayoutGraph graph,
NodeList nodes,
Node referenceNode,
boolean vertical,
byte mode)
Aligns the specified nodes either vertically or horizontally according to the specified node alignment mode. 
static void 
applyGraphLayout(LayoutGraph graph,
GraphLayout layout)
Applies the layout information in the given GraphLayout to the LayoutGraph . 
static java.awt.Dimension 
arrangeRectangleGrid(java.awt.geom.Rectangle2D[] rectangles,
java.awt.geom.Rectangle2D finalRect,
double aspectRatio)
Reassigns the bounds of the rectangles in a grid to fit in a large rectangle with an aspect ratio close to the specified aspect ratio. 
static int 
arrangeRectangleMultiRows(java.awt.geom.Rectangle2D[] rectangles,
java.awt.geom.Rectangle2D finalRect,
double preferredWidth,
double preferredHeight,
boolean compaction,
byte constraintMode)
Reassigns the bounds of the rectangles in multiple rows to fit the preferred width and height. 
static int 
arrangeRectangleMultiRows(java.awt.geom.Rectangle2D[] rectangles,
java.awt.geom.Rectangle2D finalRect,
double preferredWidth,
double preferredHeight,
boolean compaction,
byte constraintMode,
int alignment)
Reassigns the bounds of the rectangles in multiple rows to fit the preferred width and height. 
static int 
arrangeRectangleRows(java.awt.geom.Rectangle2D[] rectangles,
java.awt.geom.Rectangle2D finalRect,
double aspectRatio)
Reassigns the bounds of the rectangles to fit in a large rectangle with an aspect ratio close to the specified aspect ratio. 
static int 
arrangeRectangleRows(java.awt.geom.Rectangle2D[] rectangles,
java.awt.geom.Rectangle2D finalRect,
double aspectRatio,
int alignment)
Reassigns the bounds of the rectangles to fit in a large rectangle with an aspect ratio close to the specified aspect ratio. 
static void 
assignReverseLayout(LayoutGraph graph,
Edge edge1,
Edge edge2)
Applies the reversed layout of the first edge to the second edge. 
static boolean 
autoFlipBox(OrientedRectangle rect)
Flips the orientation of a given rectangle, if its up vector points downward ( . 
static void 
clipEdgeOnBB(LayoutGraph graph,
Edge edge)
Clips the path of the given edge on the bounding box of the source and target points. 
static void 
clipEdgesOnBB(LayoutGraph graph)
Clips the path of all edges in the graph on the bounding box of their source and target points. 
static byte 
determineEdgeFlowDirection(LayoutGraph graph,
DataProvider considerEdges)
Determines the main direction of the edge flow by analyzing the current layout of the graph. 
static java.lang.String 
edgeLayoutString(LayoutGraph graph,
Edge edge)
Returns a String representation of the path of the given edge. 
static java.awt.geom.Rectangle2D 
getBoundingBox(LayoutGraph graph,
Edge edge)
Returns the bounding box of the given edge. 
static java.awt.geom.Rectangle2D 
getBoundingBox(LayoutGraph graph,
EdgeCursor edges)
Returns the bounding box of the edges accessible through the given cursor. 
static java.awt.geom.Rectangle2D 
getBoundingBox(LayoutGraph graph,
Node node)
Returns the bounding box of the given node. 
static java.awt.geom.Rectangle2D 
getBoundingBox(LayoutGraph graph,
NodeCursor nodes)
Returns the bounding box of the nodes accessible through the given cursor. 
static java.awt.geom.Rectangle2D 
getBoundingBox(LayoutGraph graph,
NodeCursor nodes,
EdgeCursor edges)
Returns the bounding box of the nodes and edges accessible through the given cursors. 
static java.awt.geom.Rectangle2D 
getBoundingBox(LayoutGraph graph,
NodeCursor nodes,
EdgeCursor edges,
boolean includeLabels)
Returns the bounding box of the nodes and edges accessible through the given cursors, optionally including node labels and edge labels. 
static java.awt.geom.Rectangle2D 
getBoundingBox(LayoutGraph graph,
NodeCursor nodes,
EdgeCursor edges,
boolean includeNodeLabels,
boolean includeEdgeLabels)
Returns the bounding box of the nodes and edges accessible through the given cursors, optionally including node labels or edge labels. 
static java.awt.geom.Rectangle2D 
getBoundingBox(LayoutGraph graph,
NodeCursor nodes,
EdgeCursor edges,
boolean includeNodeLabels,
boolean includeEdgeLabels,
boolean includeHalos)
Returns the bounding box of the nodes and edges accessible through the given cursors, optionally including node labels, edge labels or NodeHalo s. 
static YPointPath 
getEdgeClippedOnBB(EdgeLayout edge,
NodeLayout source,
NodeLayout target)
Returns the path of an edge clipped on the bounding box of the source and target node. 
static YPointPath 
getEdgeClippedOnBB(EdgeLayout edge,
NodeLayout source,
NodeLayout target,
double inset)
Returns the path of an edge clipped on insets of the bounding box of the source and target node. 
static YPointPath 
getEdgeClippedOnBB(LayoutGraph graph,
Edge edge)
Returns the path of an edge clipped on the bounding box of the source and target node. 
static LabelLayoutFactory 
getLabelFactory(LayoutGraph graph)
Returns the LabelLayoutFactory for the given graph. 
static YPoint 
getLabelPlacement(EdgeLabelModel model,
YDimension labelSize,
EdgeLayout edgeLayout,
NodeLayout sourceLayout,
NodeLayout targetLayout,
java.lang.Object param)
Returns the upperleft corner of the paraxial bounding box of the given edge label as encoded by the specified model parameter. 
static YPoint 
getLabelPlacement(NodeLabelModel model,
YDimension labelSize,
NodeLayout nodeLayout,
java.lang.Object param)
Returns the upperleft corner of the paraxial bounding box of the given node label as encoded by the specified model parameter. 
static double 
getNodeDistance(LayoutGraph graph,
Node node1,
Node node2)
Returns the distance between the centers of the two given nodes. 
static java.lang.String 
getNodePositions(LayoutGraph graph)
Returns a String representation of all node positions in the graph. 
static YPointPath 
getPathClippedOnBB(YPointPath path,
YRectangle sourceBox,
YRectangle targetBox)
Returns the path of a given edge path clipped on the given bounding boxes of the source and target node. 
static double 
getPathLength(LayoutGraph graph,
Edge edge)
Returns the length of the path of the given edge. 
static void 
initDiagram(LayoutGraph graph)
Initializes the given graph. 
static boolean 
isEdgeOutsideNodes(EdgeLayout edge,
NodeLayout source,
NodeLayout target,
double halo)
Checks whether or not the path of an edge is outside the bounding box of the source and target node, considering the given halo. 
static boolean 
isEdgeOutsideNodes(LayoutGraph graph,
Edge edge)
Checks whether or not the path of an edge is outside the bounding box of the source and target node. 
static boolean 
isUsingOctilinearEdgeRoutes(LayoutGraph graph,
DataProvider considerEdges)
Determines whether or not most of the edges of the graph are routed octilinear. 
static boolean 
isUsingOrthogonalEdgeRoutes(LayoutGraph graph,
DataProvider considerEdges)
Determines whether or not most of the edges of the graph are routed orthogonally. 
static void 
moveEdge(LayoutGraph graph,
Edge edge,
double dx,
double dy)
Moves all control points of the given edge by the vector (dx,dy) . 
static void 
moveEdges(LayoutGraph graph,
EdgeCursor edges,
double dx,
double dy)
Moves the control points of all edges accessible through the given EdgeCursor by the vector
(dx,dy) . 
static void 
moveNode(LayoutGraph graph,
Node node,
double dx,
double dy)
Moves the given node by the vector (dx,dy) . 
static void 
moveNodes(LayoutGraph graph,
NodeCursor nodes,
double dx,
double dy)
Moves all nodes accessible through the given NodeCursor by the vector (dx,dy) . 
static void 
moveSubgraph(LayoutGraph graph,
EdgeCursor edges,
double dx,
double dy)
Moves the subgraph induced by the edges accessible through the given EdgeCursor by the vector
(dx,dy) . 
static void 
moveSubgraph(LayoutGraph graph,
NodeCursor nodes,
double dx,
double dy)
Moves the subgraph induced by the nodes accessible through the given NodeCursor by the vector
(dx,dy) . 
static boolean 
pathIntersectsRect(LayoutGraph graph,
Edge edge,
java.awt.geom.Rectangle2D rect)
Checks whether or not the path of the given edge intersects the interior of a given rectangular area. 
static void 
removeDuplicateBends(LayoutGraph graph)
Removes successive bends that have the same coordinates from all edges in the graph. 
static void 
removeDuplicateBends(LayoutGraph graph,
Edge edge)
Removes successive bends that have the same coordinates from the given edge. 
static void 
resetPath(LayoutGraph graph,
Edge edge)
Assigns a trivial path which has no control points to the specified edge and sets the edge's ports to the center of the corresponding nodes. 
static void 
resetPath(LayoutGraph graph,
Edge edge,
boolean resetPorts)
Assigns a trivial path which has no control points to the specified edge. 
static void 
resetPaths(LayoutGraph graph)
Assigns a trivial path which has no control points to all edges in the specified graph and sets the edges' ports to the center of the corresponding nodes. 
static void 
resetPaths(LayoutGraph graph,
boolean resetPorts)
Assigns a trivial path which has no control points to all edges in the specified graph. 
static void 
resetPorts(LayoutGraph graph)
Sets the ports of all edges in the graph to the center of the nodes. 
static void 
reverseEdgeLayout(EdgeLayout el)
Reverses the layout of an edge. 
static void 
roundEdgeLayout(LayoutGraph graph,
Edge edge)
Rounds the locations of the control points and ports of the given edge to integer values. 
static void 
roundLayout(LayoutGraph graph)
Rounds coordinates and sizes in the layout of an entire graph to integer values. 
static void 
roundNodeLayout(LayoutGraph graph,
Node node)
Rounds the location and size of the given node to integer values. 
static void 
routeEdgesParallel(LayoutGraph graph,
Edge edge1,
Edge edge2,
double lineDistance)
Routes two edges which are incident to the same nodes in parallel. 
static void 
routeEdgesParallel(LayoutGraph graph,
Edge edge1,
Edge edge2,
double lineDistance,
boolean joinEnds,
double absJoinDist,
double relJoinDist)
Routes two edges which are incident to the same nodes in parallel, optionally joining the end points. 
static void 
routeEdgesParallel(LayoutGraph graph,
Edge edge,
EdgeList edges,
double lineDistance)
Routes a list of edges which are incident to the same nodes in parallel. 
static void 
routeEdgesParallel(LayoutGraph graph,
Edge edge,
EdgeList edges,
double lineDistance,
boolean adjustE1,
boolean joinEnds,
double absJoinDist,
double relJoinDist)
Routes a list of edges which are incident to the same nodes in parallel, optionally joining the end points. 
static void 
routeSelfLoop(LayoutGraph graph,
Edge edge)
Routes a selfloop. 
Methods inherited from class java.lang.Object 

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
Field Detail 

public static final int LEADING
public static final int TRAILING
public static final int JUSTIFIED
Rectangles in smaller rows will be distributed over the row, so that the row aligns with both sides.
public static final int CENTER
public static final byte MULTI_ROW_NO_CONSTRAINT
arrangeRectangleMultiRows(Rectangle2D[], Rectangle2D, double, double, boolean, byte, int)
,
Constant Field Valuespublic static final byte MULTI_ROW_HEIGHT_CONSTRAINT
arrangeRectangleMultiRows(Rectangle2D[], Rectangle2D, double, double, boolean, byte, int)
,
Constant Field Valuespublic static final byte MULTI_ROW_WIDTH_CONSTRAINT
arrangeRectangleMultiRows(Rectangle2D[], Rectangle2D, double, double, boolean, byte, int)
,
Constant Field Valuespublic static final byte FLOW_UP
determineEdgeFlowDirection(LayoutGraph, DataProvider)
,
Constant Field Valuespublic static final byte FLOW_DOWN
determineEdgeFlowDirection(LayoutGraph, DataProvider)
,
Constant Field Valuespublic static final byte FLOW_LEFT
determineEdgeFlowDirection(LayoutGraph, DataProvider)
,
Constant Field Valuespublic static final byte FLOW_RIGHT
determineEdgeFlowDirection(LayoutGraph, DataProvider)
,
Constant Field Valuespublic static final byte FLOW_NONE
determineEdgeFlowDirection(LayoutGraph, DataProvider)
,
Constant Field Valuespublic static final byte ALIGN_NODES_LEADING
public static final byte ALIGN_NODES_CENTERED
public static final byte ALIGN_NODES_TRAILING
public static final byte ALIGN_NODES_DISTRIBUTED
Method Detail 

public static LabelLayoutFactory getLabelFactory(LayoutGraph graph)
LabelLayoutFactory
for the given graph.
graph
 the graph
public static byte determineEdgeFlowDirection(LayoutGraph graph, DataProvider considerEdges)
The method only considers edges that are marked in the given DataProvider
. If the provider
is null
, all edges are considered.
graph
 the underlying graphconsiderEdges
 the edges to consider
public static boolean isUsingOrthogonalEdgeRoutes(LayoutGraph graph, DataProvider considerEdges)
The method only considers edges that are marked in the given DataProvider
. If the provider
is null
, all edges are considered.
graph
 the underlying graphconsiderEdges
 the edges to consider
true
if most of the edges in the graph are routed orthogonally,
false
otherwisepublic static boolean isUsingOctilinearEdgeRoutes(LayoutGraph graph, DataProvider considerEdges)
The method only considers edges that are marked in the given DataProvider
. If the provider
is null
, all edges are considered.
true
for orthogonal layouts.graph
 the underlying graphconsiderEdges
 the edges to consider
true
if most of the edges in the graph are routed octilinear,
false
otherwisepublic static double getNodeDistance(LayoutGraph graph, Node node1, Node node2)
graph
 the graph to which the nodes belongnode1
 the first nodenode2
 the second node
public static double getPathLength(LayoutGraph graph, Edge edge)
graph
 the graph to which the edge belongsedge
 the edge
public static void reverseEdgeLayout(EdgeLayout el)
el
 the layout information of an edgepublic static void resetPaths(LayoutGraph graph)
resetPaths(LayoutGraph, boolean)
resetting the ports.graph
 the graphresetPaths(LayoutGraph, boolean)
public static void resetPaths(LayoutGraph graph, boolean resetPorts)
graph
 the graphresetPorts
 true
if the ports of the edges should be set to the center of the corresponding nodes,
false
otherwisepublic static void resetPath(LayoutGraph graph, Edge edge)
resetPath(LayoutGraph, Edge, boolean)
resetting the ports.graph
 the graphedge
 the edgeresetPath(LayoutGraph, Edge, boolean)
public static void resetPath(LayoutGraph graph, Edge edge, boolean resetPorts)
graph
 the graphedge
 the edgeresetPorts
 true
if the ports of the edge should be set to the center of the corresponding nodes,
false
otherwisepublic static void removeDuplicateBends(LayoutGraph graph)
graph
 the graphpublic static void removeDuplicateBends(LayoutGraph graph, Edge edge)
graph
 the graphedge
 the edgepublic static void moveEdge(LayoutGraph graph, Edge edge, double dx, double dy)
(dx,dy)
.
graph
 the graphedge
 the edgedx
 the horizontal distance to movedy
 the vertical distance to movepublic static void moveEdges(LayoutGraph graph, EdgeCursor edges, double dx, double dy)
EdgeCursor
by the vector
(dx,dy)
.
graph
 the graphedges
 the edges to be moveddx
 the horizontal distance to movedy
 the vertical distance to movepublic static void moveNode(LayoutGraph graph, Node node, double dx, double dy)
(dx,dy)
.
graph
 the graphnode
 the nodedx
 the horizontal distance to movedy
 the vertical distance to movepublic static void moveNodes(LayoutGraph graph, NodeCursor nodes, double dx, double dy)
NodeCursor
by the vector (dx,dy)
.
graph
 the graphnodes
 the nodes to be moveddx
 the horizontal distance to movedy
 the vertical distance to movepublic static void moveSubgraph(LayoutGraph graph, EdgeCursor edges, double dx, double dy)
EdgeCursor
by the vector
(dx,dy)
.
graph
 the graph that contains the subgraphedges
 the edges that induce the subgraphdx
 the horizontal distance to movedy
 the vertical distance to movepublic static void moveSubgraph(LayoutGraph graph, NodeCursor nodes, double dx, double dy)
NodeCursor
by the vector
(dx,dy)
.
graph
 the graph that contains the subgraphnodes
 the nodes that induce the subgraphdx
 the horizontal distance to movedy
 the vertical distance to movepublic static java.awt.geom.Rectangle2D getBoundingBox(LayoutGraph graph, NodeCursor nodes, EdgeCursor edges)
In this case, the bounding box is the smallest paraxial rectangle which contains the given nodes and the control points as well as the source and target points of all edges.
graph
 the graph that contains the nodes and edgesnodes
 the nodes to include in the bounding boxedges
 the edges to include in the bounding box
getBoundingBox(LayoutGraph, EdgeCursor)
,
getBoundingBox(LayoutGraph, NodeCursor)
public static java.awt.geom.Rectangle2D getBoundingBox(LayoutGraph graph, Node node)
In this case, the bounding box is the smallest paraxial rectangle which contains the given node. It is identical to the node's bounds.
graph
 the graph that contains the nodenode
 the node
LayoutGraph.getNodeLayout(Object)
public static java.awt.geom.Rectangle2D getBoundingBox(LayoutGraph graph, NodeCursor nodes)
In this case, the bounding box is the smallest paraxial rectangle which contains the given nodes.
graph
 the graph that contains the nodesnodes
 the nodes to include in the bounding box
LayoutGraph.getNodeLayout(Object)
public static java.awt.geom.Rectangle2D getBoundingBox(LayoutGraph graph, Edge edge)
In this case, the bounding box is the smallest paraxial rectangle which contains the control points as well as the absolute coordinates of the source and target point of the edge.
graph
 the graph that contains the edgeedge
 the edge
LayoutGraph.getSourcePointAbs(Edge)
,
LayoutGraph.getTargetPointAbs(Edge)
,
LayoutGraph.getLayout(Edge)
public static java.awt.geom.Rectangle2D getBoundingBox(LayoutGraph graph, EdgeCursor edges)
In this case, the bounding box is the smallest paraxial rectangle which contains the control points as well as the absolute coordinates of the source and target points of all given edges.
graph
 the graph that contains the edgesedges
 the edges to include in the bounding box
LayoutGraph.getSourcePointAbs(Edge)
,
LayoutGraph.getTargetPointAbs(Edge)
,
LayoutGraph.getLayout(Edge)
public static java.awt.geom.Rectangle2D getBoundingBox(LayoutGraph graph, NodeCursor nodes, EdgeCursor edges, boolean includeLabels)
In this case, the bounding box is the smallest paraxial rectangle which contains the given nodes and the control points as well as the source and target points of all edges. If labels should be included, it also contains their boxes.
graph
 the graph that contains the given nodes and edgesnodes
 the nodes to include in the bounding boxedges
 the edges to include in the bounding boxincludeLabels
 true
if labels of nodes and edges should be included, false
otherwise
getBoundingBox(LayoutGraph, NodeCursor, EdgeCursor, boolean, boolean)
public static java.awt.geom.Rectangle2D getBoundingBox(LayoutGraph graph, NodeCursor nodes, EdgeCursor edges, boolean includeNodeLabels, boolean includeEdgeLabels)
In this case, the bounding box is the smallest paraxial rectangle which contains the given nodes and the control points as well as the source and target points of all edges. If node or edge labels should be included, it also contains their boxes.
graph
 the graph that contains the given nodes and edgesnodes
 the nodes to include in the bounding boxedges
 the edges to include in the bounding boxincludeNodeLabels
 true
if labels of nodes should be included, false
otherwiseincludeEdgeLabels
 true
if labels of edges should be included, false
otherwise
public static java.awt.geom.Rectangle2D getBoundingBox(LayoutGraph graph, NodeCursor nodes, EdgeCursor edges, boolean includeNodeLabels, boolean includeEdgeLabels, boolean includeHalos)
NodeHalo
s.
In this case, the bounding box is the smallest paraxial rectangle which contains the given nodes and the control points
as well as the source and target points of all edges. If node or edge labels should be included, it also contains
their boxes. NodeHalo
s can also extend the bounding box if desired.
graph
 the graph that contains the given nodes and edgesnodes
 the nodes to include in the bounding boxedges
 the edges to include in the bounding boxincludeNodeLabels
 true
if labels of nodes should be included, false
otherwiseincludeEdgeLabels
 true
if labels of edges should be included, false
otherwiseincludeHalos
 true
if NodeHalo
s should be included, false
otherwise
public static YPoint getLabelPlacement(NodeLabelModel model, YDimension labelSize, NodeLayout nodeLayout, java.lang.Object param)
The parameter describes the abstract position of the label within the specified model. The parameter must have been generated by that model.
model
 the NodeLabelModel
used for placing the labellabelSize
 the size of the labelnodeLayout
 the layout of the node to which the label belongsparam
 the model parameter
NodeLabelModel.getLabelPlacement(YDimension, NodeLayout, Object)
,
OrientedRectangle.getBoundingBox()
public static YPoint getLabelPlacement(EdgeLabelModel model, YDimension labelSize, EdgeLayout edgeLayout, NodeLayout sourceLayout, NodeLayout targetLayout, java.lang.Object param)
The parameter describes the abstract position of the label within the specified model. The parameter must have been generated by that model.
model
 the EdgeLabelModel
used for placing the labellabelSize
 the size of the label that should be placededgeLayout
 the layout of the edge to which the label belongssourceLayout
 the layout of the edge's source nodetargetLayout
 the layout of the edge's target nodeparam
 the model parameter
EdgeLabelModel.getLabelPlacement(YDimension, EdgeLayout, NodeLayout, NodeLayout, Object)
,
OrientedRectangle.getBoundingBox()
public static void resetPorts(LayoutGraph graph)
graph
 the graphLayoutGraph.setSourcePointRel(Edge, YPoint)
,
LayoutGraph.setTargetPointRel(Edge, YPoint)
public static YPointPath getEdgeClippedOnBB(EdgeLayout edge, NodeLayout source, NodeLayout target)
On the clipped edge, the source and target port will be located at the border of the corresponding node.
edge
 the clipped edgesource
 the source of the edgetarget
 the target of the edge
public static YPointPath getEdgeClippedOnBB(LayoutGraph graph, Edge edge)
On the clipped edge, the source and target port will be located at the border of the corresponding node.
graph
 the graph to which the edge belongsedge
 the clipped edge
public static YPointPath getEdgeClippedOnBB(EdgeLayout edge, NodeLayout source, NodeLayout target, double inset)
On the clipped edge, the source and target port will be located inside the node with an inset to the border of the corresponding node.
edge
 the clipped edgesource
 the source of the edgetarget
 the target of the edgeinset
 the inset of the node
public static YPointPath getPathClippedOnBB(YPointPath path, YRectangle sourceBox, YRectangle targetBox)
getEdgeClippedOnBB(EdgeLayout, NodeLayout, NodeLayout, double)
,
getEdgeClippedOnBB(LayoutGraph, Edge)
and getEdgeClippedOnBB(EdgeLayout, NodeLayout, NodeLayout)
,
the path can explicitly be specified and is not queried from a given graph and edge. Furthermore, this method does
not consider any insets on the given boxespath
 the path that will be clippedsourceBox
 the box of the source node that the given path should be clipped attargetBox
 the box of the target node that the given path should be clipped at
public static boolean isEdgeOutsideNodes(LayoutGraph graph, Edge edge)
The edge is outside the nodes if its control points as well as the source and target point are not inside the nodes' bounding boxes.
graph
 the graph to which the edge belongsedge
 the edge
true
if the edge is outside the nodes, false
otherwisepublic static boolean isEdgeOutsideNodes(EdgeLayout edge, NodeLayout source, NodeLayout target, double halo)
The edge is outside the nodes if its control points as well as the source and target point are not inside the nodes' bounding boxes.
The nodes can be enlarged by a halo to check if the edge keeps some distance to the nodes.
edge
 the edgesource
 the source of the edgetarget
 the target of the edgehalo
 the halo for the nodes
true
if the edge is outside the nodes, false
otherwisepublic static void clipEdgesOnBB(LayoutGraph graph)
On a clipped edge, the source and target port will be located at the border of the corresponding node.
graph
 the graphclipEdgeOnBB(LayoutGraph, Edge)
public static void clipEdgeOnBB(LayoutGraph graph, Edge edge)
On a clipped edge, the source and target port will be located at the border of the corresponding node.
graph
 the graph to which the edge belongsedge
 the edge to clippublic static java.lang.String edgeLayoutString(LayoutGraph graph, Edge edge)
String
representation of the path of the given edge.
graph
 the graph to which the edge belongsedge
 the edge
String
that contains all control points of the edgepublic static void roundNodeLayout(LayoutGraph graph, Node node)
graph
 the graph to which the node belongsnode
 the node whose values are roundedpublic static void roundEdgeLayout(LayoutGraph graph, Edge edge)
graph
 the graph to which the edge belongsedge
 the edge whose values are roundedpublic static void roundLayout(LayoutGraph graph)
graph
 the graphroundNodeLayout(LayoutGraph, Node)
,
roundEdgeLayout(LayoutGraph, Edge)
public static void routeEdgesParallel(LayoutGraph graph, Edge edge1, Edge edge2, double lineDistance)
The second edge gets a path that is parallel to the path of the first (leading) edge.
graph
 the graphedge1
 the leading edgeedge2
 the edge to be adjustedlineDistance
 the distance between the two edgesrouteEdgesParallel(LayoutGraph, Edge, Edge, double, boolean, double, double)
public static void routeEdgesParallel(LayoutGraph graph, Edge edge1, Edge edge2, double lineDistance, boolean joinEnds, double absJoinDist, double relJoinDist)
The second edge gets a path that is parallel to the path of the first (leading) edge.
graph
 the graphedge1
 the leading edgeedge2
 the edge to be adjustedlineDistance
 the distance between the two edgesjoinEnds
 true
if the edges should share their end points (the ones of the leading
edge), false
otherwiseabsJoinDist
 the absolute distance between the end points and the beginning of the parallel segment routing
if the ends are joinedrelJoinDist
 the relative distance, measured relative to the length of the first/last segments if the
ends are joinedrouteEdgesParallel(LayoutGraph, Edge, EdgeList, double, boolean, boolean, double, double)
public static void routeEdgesParallel(LayoutGraph graph, Edge edge, EdgeList edges, double lineDistance)
All edges get a path that is parallel to the path of the first (leading) edge.
graph
 the graphedge
 the leading edgeedges
 the edges to be adjustedlineDistance
 the distance between two edgesrouteEdgesParallel(LayoutGraph, Edge, EdgeList, double, boolean, boolean, double, double)
public static void routeEdgesParallel(LayoutGraph graph, Edge edge, EdgeList edges, double lineDistance, boolean adjustE1, boolean joinEnds, double absJoinDist, double relJoinDist)
All edges get a path that is parallel to the path of the first (leading) edge.
The position of the leading edge may be adjusted if there is an odd number of parallel edges. It will be moved from the center to achieve a more symmetric port assignment.
graph
 the graphedge
 the leading edgeedges
 the list of edges that will be aligned with the leading edgelineDistance
 the distance between two edgesadjustE1
 true
if the leading edge should be adjusted if the size of list is odd,
false
otherwisejoinEnds
 true
if the edges should share their end points (the ones of the leading
edge), false
otherwiseabsJoinDist
 the absolute distance between the end points and the beginning of the parallel segment routing
if the ends are joinedrelJoinDist
 the relative distance, measured relative to the length of the first/last segments if the
ends are joinedpublic static void routeSelfLoop(LayoutGraph graph, Edge edge)
For a selfloop edge, source and target are identical. The path of the selfloop will start at the top of the node, go around the upperleft corner and end at the left side of the node.
graph
 the graph to which the edge belongsedge
 the selflooppublic static void assignReverseLayout(LayoutGraph graph, Edge edge1, Edge edge2)
graph
 the graph to which both edges belongedge1
 the edge which adopts the pointsedge2
 the templatepublic static java.lang.String getNodePositions(LayoutGraph graph)
String
representation of all node positions in the graph.
graph
 the graph
String
containing all node locationsLayoutGraph.getLocation(Node)
public static void initDiagram(LayoutGraph graph)
All nodes are placed at (0,0)
. The edges get connected to the center of their sources and targets,
while all their control points are removed.
graph
 the graphLayoutGraph.setLocation(Node, double, double)
,
resetPaths(LayoutGraph)
public static int arrangeRectangleRows(java.awt.geom.Rectangle2D[] rectangles, java.awt.geom.Rectangle2D finalRect, double aspectRatio)
This method invokes arrangeRectangleRows
with LEADING
as the last argument.
The aspect ratio must be greater than 0
.
rectangles
 the rectangles whose coordinates will be modifiedfinalRect
 the exact dimension of the resulting rectangleaspectRatio
 the preferred aspect ratio of the resulting rectangle
java.lang.IllegalArgumentException
 if the aspect ratio is 0
or lesspublic static java.awt.Dimension arrangeRectangleGrid(java.awt.geom.Rectangle2D[] rectangles, java.awt.geom.Rectangle2D finalRect, double aspectRatio)
The aspect ratio must be greater than 0
.
rectangles
 the rectangles whose coordinates will be modifiedfinalRect
 the exact dimension will be placed in this rectangleaspectRatio
 the preferred aspect ratio of the grid
java.lang.IllegalArgumentException
 if the given aspect ratio is less than or equal to zeropublic static int arrangeRectangleMultiRows(java.awt.geom.Rectangle2D[] rectangles, java.awt.geom.Rectangle2D finalRect, double preferredWidth, double preferredHeight, boolean compaction, byte constraintMode)
arrangeRectangleRows(Rectangle2D[], Rectangle2D, double, int)
.
A row will be subdivided into more rows, if two successive rectangles to be placed in the row could be placed
stacked within this row without making the row larger in height.
The preferred width and height should be greater than 0
, otherwise the nodes are not
arranged.
rectangles
 the rectangles to arrange (coordinates will be assigned)finalRect
 the exact resulting dimension will be stored in this rectanglepreferredWidth
 the preferred width of the result rectanglepreferredHeight
 the preferred height of the result rectanglecompaction
 true
if the algorithm tries to always minimize the resulting dimension, whilst
respecting the given constraints, false
otherwiseconstraintMode
 the width or height constraints to consider
arrangeRectangleMultiRows(Rectangle2D[], Rectangle2D, double, double, boolean, byte, int)
public static int arrangeRectangleMultiRows(java.awt.geom.Rectangle2D[] rectangles, java.awt.geom.Rectangle2D finalRect, double preferredWidth, double preferredHeight, boolean compaction, byte constraintMode, int alignment)
arrangeRectangleRows(Rectangle2D[], Rectangle2D, double, int)
.
A row will be subdivided into more rows, if two successive rectangles to be placed in the row could be placed
stacked within this row without making the row larger in height.
The preferred width and height should be greater than 0
, otherwise the nodes are not
arranged.
rectangles
 the rectangles to arrange (coordinates will be assigned)finalRect
 the exact resulting dimension will be stored in this rectanglepreferredWidth
 the preferred width of the result rectanglepreferredHeight
 the preferred height of the result rectanglecompaction
 true
if the algorithm tries to always minimize the resulting dimension, whilst
respecting the given constraints, false
otherwiseconstraintMode
 the width or height constraints to consideralignment
 the alignment inside a row
arrangeRectangleMultiRows(Rectangle2D[], Rectangle2D, double, double, boolean, byte, int)
public static int arrangeRectangleRows(java.awt.geom.Rectangle2D[] rectangles, java.awt.geom.Rectangle2D finalRect, double aspectRatio, int alignment)
The aspect ratio must be greater than 0
.
rectangles
 the rectangles whose coordinates will be modifiedfinalRect
 the exact dimension of the resulting rectangleaspectRatio
 the preferred aspect ratio of the resulting rectanglealignment
 one of the valid row alignments
java.lang.IllegalArgumentException
 if the aspect ratio is 0
or lesspublic static boolean pathIntersectsRect(LayoutGraph graph, Edge edge, java.awt.geom.Rectangle2D rect)
graph
 the graph to which the edge belongsedge
 the edgerect
 the rectangular area to check for intersection
true
if the edge path intersects with the given rectangle,
false
otherwisepublic static void applyGraphLayout(LayoutGraph graph, GraphLayout layout)
GraphLayout
to the LayoutGraph
.
All nodes get coordinates and sizes. The edges get coordinates for the control points. For both nodes and edges the labels are placed.
GraphLayout
data must be defined for elements in the given LayoutGraph
.graph
 the graphlayout
 the layout information for the graphpublic static void alignNodeLayouts(LayoutGraph graph, NodeList nodes, Node referenceNode, boolean vertical, byte mode)
For vertical arrangements, nodes are either
topaligned
,
centeraligned
,
bottomaligned
, or
vertically distributed
.
For horizontal arrangements, nodes are either
leftaligned
,
centeraligned
,
rightaligned
, or
horizontally distributed
.
In this context, distributed means that the specified nodes are
placed in such a way that the projections of their bounds onto the
vertical or horizontal coordinate axis do not overlap. For example, after
vertically distributing nodes, (n1.y + n1.height) <= n2.y
for two consecutively placed nodes n1
and n2
.
graph
 the graph that contains the specified nodesnodes
 the subset of the specified graph's nodes that is arrangedreferenceNode
 if null
, the common coordinate for
aligning the specified nodes is calculated as the
the vertical minimum (topaligned),
the vertical center,
the vertical maximum (bottomaligned),
the horizontal minimum (leftaligned),
the horizontal center, or
the horizontal maximum (rightaligned)
of the bounds of the specified nodes; otherwise the appropriate coordinate
of the given reference node's bounds is used as common coordinate for
aligning the specified nodes.
The reference node is ignored when
distributing
nodes.vertical
 true
if nodes should be aligned (or distributed) according to their ycoordinates;
otherwise nodes are aligned (or distributed) according to their xcoordinates.mode
 one of the valid alignment modespublic static boolean autoFlipBox(OrientedRectangle rect)
(upY
> 0)
.
That means, it rotates the rectangle by 180
degrees without changing the rectangle's center.
rect
 the given rectangle
true
if the given rectangle was flipped, false
otherwise

© Copyright 20002022, yWorks GmbH. All rights reserved. 

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 