|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecty.layout.LayoutTool
public class LayoutTool
This class is a container for several helper and utility functions for the LayoutGraph class.
LayoutGraph| Field Summary | |
|---|---|
static int |
CENTER
Constant which can be used for arrangeRectangleRows. |
static int |
JUSTIFIED
Constant which can be used for arrangeRectangleRows. |
static int |
LEADING
Constant which can be used for arrangeRectangleRows. |
static int |
TRAILING
Constant which can be used for arrangeRectangleRows. |
| Constructor Summary | |
|---|---|
LayoutTool()
|
|
| Method Summary | |
|---|---|
static void |
applyGraphLayout(LayoutGraph graph,
GraphLayout gl)
Applies a GraphLayout to a LayoutGraph. |
static Dimension |
arrangeRectangleGrid(Rectangle2D[] rects,
Rectangle2D finalRect,
double viewRatio)
Reassigns the bounds of the rectangles in rects to fit into a
large rectangle, whose bounds will be stored in finalrect. |
static int |
arrangeRectangleRows(Rectangle2D[] rects,
Rectangle2D finalRect,
double viewRatio)
Reassigns the bounds of the rectangles in rects to fit in a large rectangle, whose bounds will be stored in finalrect. |
static int |
arrangeRectangleRows(Rectangle2D[] rects,
Rectangle2D finalRect,
double viewRatio,
int alignment)
Reassigns the bounds of the rectangles in rects to fit into a
large rectangle, whose bounds will be stored in finalrect. |
static void |
assignReverseLayout(LayoutGraph graph,
Edge e1,
Edge e2)
Set the layout of two parallel edges with different direction identical. |
static void |
clipEdgeOnBB(LayoutGraph gd,
Edge e)
This helper method clips the path of the edge on the bounding box of the start and end points. |
static void |
clipEdgesOnBB(LayoutGraph gd)
This helper method clips the path of the edge on the bounding box of the start and end points. |
static String |
edgeLayoutString(LayoutGraph gd,
Edge edge)
Returns the path of the layout of a specific edge as a String. |
static Rectangle2D |
getBoundingBox(LayoutGraph graph,
EdgeCursor ec)
Returns the bounding box of the edges accessible through the given edge cursor. |
static Rectangle2D |
getBoundingBox(LayoutGraph graph,
NodeCursor nc)
Returns the bounding box of the nodes accessible through the given node cursor. |
static Rectangle2D |
getBoundingBox(LayoutGraph graph,
NodeCursor nc,
EdgeCursor ec)
Returns the bounding box of the nodes and edges accessible through the given cursors. |
static Rectangle2D |
getBoundingBox(LayoutGraph graph,
NodeCursor nc,
EdgeCursor ec,
boolean includeLabels)
Returns the bounding box of the nodes and edges accessible through the given cursors. |
static YPointPath |
getEdgeClippedOnBB(EdgeLayout edge,
NodeLayout sourceNode,
NodeLayout targetNode)
This helper method clips the path of an edge on the bounding box of the start and end vertices. |
static YPointPath |
getEdgeClippedOnBB(EdgeLayout edge,
NodeLayout sourceNode,
NodeLayout targetNode,
double inset)
This helper method clips the path of an edge on the bounding box of the start and end vertices. |
static YPointPath |
getEdgeClippedOnBB(LayoutGraph gd,
Edge edge)
This helper method clips the path of an edge on the bounding box of the start and end vertices. |
static double |
getNodeDistance(LayoutGraph graph,
Node s,
Node t)
Returns the distance between the centers of two nodes |
static String |
getNodePositions(LayoutGraph gd)
Returns the positions of the nodes of a graph's diagram. |
static double |
getPathLength(LayoutGraph graph,
Edge e)
Returns the length of path of a given edge. |
static void |
initDiagram(LayoutGraph gd)
This method assigns the position (0,0) to all nodes in the graph, and sets the edges to straight lines with ports in the center of the adjacent node. |
static boolean |
isEdgeOutsideNodes(EdgeLayout edge,
NodeLayout sourceNode,
NodeLayout targetNode,
double inset)
This helper method tests if the path of an edge is outside the bounding box of the start and end vertices. |
static boolean |
isEdgeOutsideNodes(LayoutGraph gd,
Edge edge)
This helper method tests if the path of an edge is outside the bounding box of the start and end vertices. |
static void |
moveEdge(LayoutGraph g,
Edge edge,
double dx,
double dy)
Moves the edge points of the given edge by the vector (dx,dy). |
static void |
moveEdges(LayoutGraph g,
EdgeCursor edges,
double dx,
double dy)
Moves all edges accessible through the given edge cursor by the vector (dx,dy). |
static void |
moveNode(LayoutGraph g,
Node node,
double dx,
double dy)
Moves the given node by the vector (dx,dy). |
static void |
moveNodes(LayoutGraph g,
NodeCursor nodes,
double dx,
double dy)
Moves all nodes accessible through the given node cursor by the vector (dx,dy). |
static void |
moveSubgraph(LayoutGraph g,
EdgeCursor edges,
double dx,
double dy)
Moves the subgraph induced by edges accessible through the given edge cursor by the vector (dx,dy). |
static void |
moveSubgraph(LayoutGraph g,
NodeCursor nodes,
double dx,
double dy)
Moves the subgraph induced by nodes accessible through the given node cursor by the vector (dx,dy). |
static boolean |
pathIntersectsRect(LayoutGraph graph,
Edge e,
Rectangle2D rect)
Checks whether or not the path of an edge intersects the interior of a given rectangular area. |
static void |
removeDuplicateBends(LayoutGraph gd)
This helper method removes duplicate bends from all edges in the graph |
static void |
removeDuplicateBends(LayoutGraph gd,
Edge edge)
This helper method removes duplicate bends from the given edge in the graph |
static void |
resetPath(LayoutGraph gd,
Edge edge)
This helper method assign an trivial path to an edges which has no control points and the ports are in the center of the nodes. |
static void |
resetPaths(LayoutGraph gd)
This helper method assign an trivial path to all edges which has no control points and the ports are in the center of the nodes. |
static void |
resetPaths(LayoutGraph gd,
boolean resetPorts)
This helper method assign an trivial path to all edges which has no control points |
static void |
resetPorts(LayoutGraph gd)
Sets the ports to the center of the nodes. |
static void |
reverseEdgeLayout(EdgeLayout el)
Reverses the layout of an edge. |
static void |
roundEdgeLayout(LayoutGraph gd,
Edge edge)
Round the values of the controllpoints and ports of an edge. |
static void |
roundLayout(LayoutGraph gd)
Round the values of the layout of an entire layout. |
static void |
roundNodeLayout(LayoutGraph gd,
Node node)
Round the values of the layout of a node. |
static void |
routeEdgesParallel(LayoutGraph gd,
Edge e1,
Edge e2,
double lineDistance)
Routes two edges which are incident to the same nodes, in parallel. |
static void |
routeEdgesParallel(LayoutGraph gd,
Edge e1,
Edge e2,
double lineDistance,
boolean joinEnds,
double absJoinDist,
double relJoinDist)
Routes two edges which are incident to the same nodes, in parallel. |
static void |
routeEdgesParallel(LayoutGraph gd,
Edge e1,
EdgeList list,
double lineDistance)
Routes a list of edges with are incident to the same nodes, in parallel. |
static void |
routeEdgesParallel(LayoutGraph gd,
Edge e1,
EdgeList list,
double lineDistance,
boolean adjustE1,
boolean joinEnds,
double absJoinDist,
double relJoinDist)
Routes a list of edges which are incident to the same nodes, in parallel. |
static void |
routeSelfLoop(LayoutGraph gd,
Edge e)
Routes a self-loop. |
| 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
public static final int CENTER
| Constructor Detail |
|---|
public LayoutTool()
| Method Detail |
|---|
public static double getNodeDistance(LayoutGraph graph,
Node s,
Node t)
public static double getPathLength(LayoutGraph graph,
Edge e)
public static void reverseEdgeLayout(EdgeLayout el)
public static void resetPaths(LayoutGraph gd)
gd - a graph diagram.
public static void resetPaths(LayoutGraph gd,
boolean resetPorts)
gd - a graph diagram.resetPorts - whether to reset the ports to the center of the nodes.
public static void resetPath(LayoutGraph gd,
Edge edge)
gd - a graph diagram.edge - an edge in graph.public static void removeDuplicateBends(LayoutGraph gd)
gd - a graph diagram.
public static void removeDuplicateBends(LayoutGraph gd,
Edge edge)
gd - a graph diagram.edge - the edge.
public static void moveEdge(LayoutGraph g,
Edge edge,
double dx,
double dy)
(dx,dy).
public static void moveEdges(LayoutGraph g,
EdgeCursor edges,
double dx,
double dy)
(dx,dy).
public static void moveNode(LayoutGraph g,
Node node,
double dx,
double dy)
(dx,dy).
public static void moveNodes(LayoutGraph g,
NodeCursor nodes,
double dx,
double dy)
(dx,dy).
public static void moveSubgraph(LayoutGraph g,
EdgeCursor edges,
double dx,
double dy)
(dx,dy).
public static void moveSubgraph(LayoutGraph g,
NodeCursor nodes,
double dx,
double dy)
(dx,dy).
public static Rectangle2D getBoundingBox(LayoutGraph graph,
NodeCursor nc,
EdgeCursor ec)
public static Rectangle2D getBoundingBox(LayoutGraph graph,
NodeCursor nc)
public static Rectangle2D getBoundingBox(LayoutGraph graph,
EdgeCursor ec)
public static Rectangle2D getBoundingBox(LayoutGraph graph,
NodeCursor nc,
EdgeCursor ec,
boolean includeLabels)
public static void resetPorts(LayoutGraph gd)
gd - a graph diagram.
public static YPointPath getEdgeClippedOnBB(EdgeLayout edge,
NodeLayout sourceNode,
NodeLayout targetNode)
public static YPointPath getEdgeClippedOnBB(LayoutGraph gd,
Edge edge)
public static YPointPath getEdgeClippedOnBB(EdgeLayout edge,
NodeLayout sourceNode,
NodeLayout targetNode,
double inset)
public static boolean isEdgeOutsideNodes(LayoutGraph gd,
Edge edge)
public static boolean isEdgeOutsideNodes(EdgeLayout edge,
NodeLayout sourceNode,
NodeLayout targetNode,
double inset)
public static void clipEdgesOnBB(LayoutGraph gd)
public static void clipEdgeOnBB(LayoutGraph gd,
Edge e)
public static String edgeLayoutString(LayoutGraph gd,
Edge edge)
public static void roundNodeLayout(LayoutGraph gd,
Node node)
public static void roundEdgeLayout(LayoutGraph gd,
Edge edge)
public static void roundLayout(LayoutGraph gd)
public static void routeEdgesParallel(LayoutGraph gd,
Edge e1,
Edge e2,
double lineDistance)
routeEdgesParallel(LayoutGraph, Edge, Edge, double, boolean, double, double)
public static void routeEdgesParallel(LayoutGraph gd,
Edge e1,
Edge e2,
double lineDistance,
boolean joinEnds,
double absJoinDist,
double relJoinDist)
gd - the graphe1 - the leading edgee2 - the edge to be adjusted (may be e1)lineDistance - the distance between the two edgesjoinEnds - whether the end points should all be set to the end points of e1absJoinDist - the absolute distance between the end points and the beginning to
the parallel segment routingrelJoinDist - the relative distance, measured relative to the length of the
first/last segments
public static void routeEdgesParallel(LayoutGraph gd,
Edge e1,
EdgeList list,
double lineDistance)
routeEdgesParallel(LayoutGraph, Edge, EdgeList, double, boolean, boolean, double, double)
public static void routeEdgesParallel(LayoutGraph gd,
Edge e1,
EdgeList list,
double lineDistance,
boolean adjustE1,
boolean joinEnds,
double absJoinDist,
double relJoinDist)
gd - the graphe1 - the leading edgelist - the list of edges that will be aligned to e1lineDistance - the distance between two edgesadjustE1 - whether e1 should be adjusted if the size of list is oddjoinEnds - whether the end points should all be set to the end points of e1absJoinDist - the absolute distance between the end points and the beginning to
the parallel segment routingrelJoinDist - the relative distance, measured relative to the length of the
first/last segments
public static void routeSelfLoop(LayoutGraph gd,
Edge e)
e - An edge with e.source.equals(e.target).
public static void assignReverseLayout(LayoutGraph graph,
Edge e1,
Edge e2)
e1 - the edge for which the points are set.e2 - the template.public static String getNodePositions(LayoutGraph gd)
public static void initDiagram(LayoutGraph gd)
public static final int arrangeRectangleRows(Rectangle2D[] rects,
Rectangle2D finalRect,
double viewRatio)
rects - the rectangles whose coordinates will be modifiedfinalRect - the exact dimension will be placed in this rectangleviewRatio - the preferred ratio of the resulting bounds
public static final Dimension arrangeRectangleGrid(Rectangle2D[] rects,
Rectangle2D finalRect,
double viewRatio)
rects to fit into a
large rectangle, whose bounds will be stored in finalrect.
This procedure tries to generate a final rectangle, whose aspect ratio is
as close as possible to viewRatio. This is achieved by
arranging the rectangles in a grid-like fashion.
The dimension of this grid is returned.
rects - the rectangles whose, coordinates will be modifiedfinalRect - the exact dimension will be placed in this rectangleviewRatio - the preferred ratio of the grid
public static final int arrangeRectangleRows(Rectangle2D[] rects,
Rectangle2D finalRect,
double viewRatio,
int alignment)
rects to fit into a
large rectangle, whose bounds will be stored in finalrect.
This procedure tries to generate a final rectangle, whose aspect ratio is
as close as possible to viewRatio. This is achieved by
arranging the rectangles in rows. The number of generated rows is
returned.
alignment - determines the alignment policy for rows, that are not
completely filledrects - the rectangles whose coordinates will be modifiedfinalRect - the exact dimension will be placed in this rectangleviewRatio - the preferred ratio of the resulting bounds
public static boolean pathIntersectsRect(LayoutGraph graph,
Edge e,
Rectangle2D rect)
public static void applyGraphLayout(LayoutGraph graph,
GraphLayout gl)
|
© Copyright 2000-2008, yWorks GmbH. All rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||