|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.layout.AbstractLayoutStage y.layout.PartitionLayouter y.layout.orthogonal.CompactOrthogonalLayouter
public class CompactOrthogonalLayouter
This layout algorithm arranges a graph in a compact, orthogonal fashion.
This layout algorithm is a variant of OrthogonalLayouter
that tries to arrange nodes in a more
compact way. It allows to specify a desired aspect ratio for the bounds of the calculated layout. Nodes of a given
graph are arranged such that each edge is drawn as an alternating sequence of horizontal and vertical segments.
CompactOrthogonalLayouter
is well suited for small and medium-sized sparse graphs and produces compact
drawings with no overlapping nodes, few crossings and few bends.
It is also especially suitable for printing the diagram on a paper of predefined size. As a disadvantage,
this algorithm will usually produce less elegant edge routes than the ones of OrthogonalLayouter
.
Application domains of orthogonal drawings are software engineering, project management, function call graphs and object-oriented class diagrams.
Sample output of the layout algorithm with aspect ratio 1.0
This algorithm is implemented as a PartitionLayouter
and applies the following steps:
PartitionLayouter.EdgeBetweennessPartitionFinder
.OrthogonalLayouter
.PartitionLayouter.ComponentPartitionPlacer
.PartitionLayouter.ChannelInterEdgeRouter
.
Each of these steps can be individually configured and/or replaced. To do so, use methods
PartitionLayouter.setPartitionFinder(PartitionFinder)
, AbstractLayoutStage.setCoreLayouter(y.layout.Layouter)
,
PartitionLayouter.setPartitionPlacer(PartitionPlacer)
and PartitionLayouter.setInterEdgeRouter(InterEdgeRouter)
, respectively.
The aspect ratio of the resulting layout bounds, i.e., the ratio of width/height of the layout, can be configured using
setAspectRatio(double)
. CompactOrthogonalLayouter
tries to reach this preferred value.
However, depending on the actual graph structure, this may not always be possible.
Octilinear routing of edges can be supported by appending PolylineLayoutStage
.
Nested Class Summary |
---|
Field Summary |
---|
Fields inherited from interface y.layout.Layouter |
---|
EDGE_ID_DPKEY, NODE_ID_DPKEY, NODE_TYPE_DPKEY, SELECTED_EDGES, SELECTED_NODES |
Constructor Summary | |
---|---|
CompactOrthogonalLayouter()
Creates a new CompactOrthogonalLayouter instance with default settings. |
Method Summary | |
---|---|
double |
getAspectRatio()
Returns the desired aspect ratio (that is the quotient width/height) of the resulting layout bounds. |
int |
getGridSpacing()
Returns the equidistant spacing between the horizontal and vertical grid lines. |
void |
setAspectRatio(double aspectRatio)
Specifies the desired aspect ratio (that is the quotient width/height) of the resulting layout bounds. |
void |
setGridSpacing(int gridSpacing)
Specifies the equidistant spacing between the horizontal and vertical grid lines. |
Methods inherited from class y.layout.PartitionLayouter |
---|
canLayout, doLayout, getInterEdgeRouter, getPartitionFinder, getPartitionPlacer, setInterEdgeRouter, setPartitionFinder, setPartitionPlacer |
Methods inherited from class y.layout.AbstractLayoutStage |
---|
canLayoutCore, doLayoutCore, getCoreLayouter, setCoreLayouter |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CompactOrthogonalLayouter()
CompactOrthogonalLayouter
instance with default settings.
Method Detail |
---|
public int getGridSpacing()
Each node will be placed on a grid point. Edges will be routed such that their segments lie on grid lines, if the endpoints of the edges allow to place the ports accordingly.
The grid spacing has to be greater than 0
.
setGridSpacing(int)
public void setGridSpacing(int gridSpacing)
Each node will be placed on a grid point. Edges will be routed such that their segments lie on grid lines, if the endpoints of the edges allow to place the ports accordingly.
The grid spacing has to be greater than 0
.
gridSpacing
- the grid spacing
java.lang.IllegalArgumentException
- if the grid spacing is negative or zeroGrid spacing 20 . | Grid spacing 40 . |
public double getAspectRatio()
The aspect ratio needs to be greater than 0
.
partition placer
is of type
PartitionLayouter.ComponentPartitionPlacer
.setAspectRatio(double)
,
PartitionLayouter.setPartitionPlacer(PartitionPlacer)
,
PartitionLayouter.ComponentPartitionPlacer
public void setAspectRatio(double aspectRatio)
The aspect ratio needs to be greater than 0
.
partition placer
is of type
PartitionLayouter.ComponentPartitionPlacer
.aspectRatio
- the desired aspect ratio
java.lang.IllegalArgumentException
- if the given aspect ratio is less than or equal to zeroPartitionLayouter.setPartitionPlacer(PartitionPlacer)
,
PartitionLayouter.ComponentPartitionPlacer
Aspect ratio 1.0 . | Aspect ratio 0.5 . |
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |