Smart organic layout is an improved variant of class
OrganicLayouter
.
It combines and configures different techniques and layout algorithms depending
on the user's demands.
Its strength is its ability to control the ratio of quality versus running
time, as well as its ability to produce organic layouts while guaranteeing the
absence of node overlaps.
Class SmartOrganicLayouter knows a number of data provider keys which are used to retrieve supplemental layout data for a graph's elements. The data is bound to the graph by means of a data provider, which is registered using a given look-up key. Table 5.20, “Data provider look-up keys” lists all look-up keys for SmartOrganicLayouter.
Binding supplemental layout data to a graph is described in the section called “Providing Supplemental Layout Data”.
Table 5.21. Data provider look-up keys
| Key | Element Type | Value Type | Description |
|---|---|---|---|
| NODE_SUBSET_DATA |
Node | boolean | For each node a boolean value indicating whether it should be treated as selected or not. |
| PREFERRED_EDGE_LENGTH_DATA |
Edge | int | For each edge an integral value that indicates its preferred length. |
Class SmartOrganicLayouter
provides a set of options that influence the layout behavior.
Some of these options are very closely related to those from class
OrganicLayouter
, so the
documentation of organic algorithm may
be useful, too.
Determines the set of nodes from the graph that should be processed.
When only a subset should be rearranged, a data provider holding the selection
state for each node is looked up.
The data provider is expected to be registered with the graph using key
NODE_SUBSET_DATA
.
When enabled, the ComponentLayouter that is used with this CanonicMultiStageLayouter is configured in such a way that separate components containing nodes which should not be moved will not be rearranged.
Allows to specify the general preferred length of all edges. The layouter tries to arrange the nodes in such a way that the edges have the desired edge length. If "Node Size Aware" is checked, then the edge length is measured from node border to node border. Otherwise, the edge length is measured from node center to node center.
To specify the preferred edge length for each edge individually, a data
provider holding such supplemental layout data can be bound to the graph.
The data provider is expected to be registered with the graph using key
PREFERRED_EDGE_LENGTH_DATA
.
Note that in the absence of an individual preferred edge length the general
preferred edge length will be used.
Whether or not to obey the size of the nodes when calculating the layout. The distance between two nodes is calculated with respect to the node sizes, i.e., for equal preferred edge lengths, activating this feature will lead to bigger layouts.
Whether or not nodes are allowed to overlap. If this feature is disabled, the "Minimal Node Distance" will be used to arrange the nodes in such a way that the given distance will be obeyed.
The minimal node distance which will be used if "Node Overlaps Allowed" is disabled.
Adjusting this value can lead to a variety of differing layouts. For small values, the resulting layout will use a lot of space and nodes tend to be far away from each other. Values around 0.5 lead to evenly distributed nodes, whereas values near 1.0 produce highly compact layouts.
This setting can be used to adjust the quality versus the running time of the layout algorithm. Small values lead to short running times, while greater values result in better quality. For large graph structures (hundreds and thousands of nodes) it is advisable to begin with smaller values and to gradually increase them.
Sets the maximal duration of the layout process in milliseconds. If this upper bound is hit during the layout process, the quality of the layout may not be optimal. Increasing this values increases the likeliness of an optimal layout.
Whether or not the layout process should be deterministic. In deterministic mode the layouter produces identical results for identical input graphs and identical settings.
Class SmartOrganicLayouter allows to impose so-called "output restrictions" on the result of the layout calculcation. More precisely, the layout result can be determined to fit into a specified region, e.g., a rectangle or a circle. Also, the layout result can be restricted to a specified aspect ratio, too.
Class OutputRestriction
serves
as a factory to create predefined output restrictions that can be used in
conjunction with setter method
setOutputRestriction
.
SmartOrganicLayouter supports incremental layout through the "Scope" feature. See the above description.
Smart organic layout can choose between different strategies, combinations and configurations of a couple of related algorithms to control the running time versus the quality of the layout.
Using small values for property "Quality/Time Ratio," it is possible to produce acceptable layouts for huge graphs (thousands of nodes within seconds), whereas setting this value to greater values leads to high-quality layouts, which may take longer (up to a few minutes for hundreds of nodes).
This algorithm can be configured to produce significantly more or less compact layouts.
Small values for property "Compactness" lead to large area drawings with a relatively sparse node distribution. Values greater than 0.5 lead to artificially compacted layouts, and values next to 1.0 will produce layouts with near to minimal space allocations. Note that "Compactness" will be obeyed only for medium or high quality settings.
Using property "Node Overlaps Allowed," smart organic layout can be configured to guarantee the absence of node overlaps even for very dense graphs.
Additionally, using property "Minimal Node Distance," it is possible to specify a minimal node distance, i.e., it can be guaranteed that there will be a certain amount of space around each node, which is not occupied by other nodes.
|
Copyright ©2004-2008, yWorks GmbH. All rights reserved. |