public class AspectRatioComponentLayerer extends Object implements ILayerer
ILayerer
implementation that delegates the actual layering to a delegate ILayerer
object.
If the graph consists of multiple components, they will be identified and each of the components will be layered
separately using the delegate ILayerer
instance. After that they will all be merged such that the desired aspect
ratio is fulfilled best.
Sample output of AspectRatioComponentLayerer
with default settings on a graph with two connected components.
setDesiredAspectRatio(double)
,
MultiComponentLayerer
Constructor and Description |
---|
AspectRatioComponentLayerer(ILayerer singleComponentLayerer)
Creates a new instance of
AspectRatioComponentLayerer using the given delegate ILayerer instance. |
Modifier and Type | Method and Description |
---|---|
void |
assignLayers(LayoutGraph graph,
ILayers layers,
ILayoutDataProvider ldp)
Assigns all nodes of the graph to layers and registers them to the
ILayers instance based on the given aspect
ratio. |
double |
getDesiredAspectRatio()
Gets the desired aspect ratio.
|
ILayerer |
getSingleComponentLayerer()
Gets the delegate
ILayerer instance. |
boolean |
isNodeSizeConsiderationEnabled()
Gets whether or not the size of the nodes should be considered.
|
void |
setDesiredAspectRatio(double value)
Sets the desired aspect ratio.
|
void |
setNodeSizeConsiderationEnabled(boolean value)
Sets whether or not the size of the nodes should be considered.
|
void |
setSingleComponentLayerer(ILayerer value)
Sets the delegate
ILayerer instance. |
public AspectRatioComponentLayerer(ILayerer singleComponentLayerer)
AspectRatioComponentLayerer
using the given delegate ILayerer
instance.IllegalArgumentException
- if the specified ILayerer
is null
public void assignLayers(LayoutGraph graph, ILayers layers, ILayoutDataProvider ldp)
ILayers
instance based on the given aspect
ratio.
If the graph consists of multiple components, they will be identified and each of the components will be layered
separately using the delegate ILayerer
instance. After that, they will all be merged such that the desired
aspect ratio is best fulfilled.
assignLayers
in interface ILayerer
graph
- the input graphlayers
- the ILayers
instance that will be filled with the results of the calculationldp
- the ILayoutDataProvider
used for query information about the nodes and edgesILayers.insert(com.yworks.yfiles.layout.hierarchic.LayerType, int)
,
ILayer.add(com.yworks.yfiles.algorithms.Node)
public double getDesiredAspectRatio()
If the graph consists of multiple components, they will be identified and each of the components will be layered
separately using the delegate ILayerer
instance. After that, they will all be merged such that the desired
aspect ratio is best fulfilled.
The given aspect ratio should be greater or equal to 0
.
IllegalArgumentException
- if the aspect ratio is negativesetDesiredAspectRatio(double)
public ILayerer getSingleComponentLayerer()
ILayerer
instance.IllegalArgumentException
- if the specified ILayerer
is null
ILayerer
instancesetSingleComponentLayerer(ILayerer)
public boolean isNodeSizeConsiderationEnabled()
If this option is disabled, all nodes are considered to be of equal size. Hence, the given aspect ratio specifies the ratio between the number of nodes within a layer and the overall number of layers.
true
. true
if the size of the node is considered, false
otherwisesetNodeSizeConsiderationEnabled(boolean)
public void setDesiredAspectRatio(double value)
If the graph consists of multiple components, they will be identified and each of the components will be layered
separately using the delegate ILayerer
instance. After that, they will all be merged such that the desired
aspect ratio is best fulfilled.
The given aspect ratio should be greater or equal to 0
.
IllegalArgumentException
- if the aspect ratio is negativevalue
- the desired aspect ratiogetDesiredAspectRatio()
public void setNodeSizeConsiderationEnabled(boolean value)
If this option is disabled, all nodes are considered to be of equal size. Hence, the given aspect ratio specifies the ratio between the number of nodes within a layer and the overall number of layers.
true
. value
- true
if the size of the node is considered, false
otherwiseisNodeSizeConsiderationEnabled()
public void setSingleComponentLayerer(ILayerer value)
ILayerer
instance.IllegalArgumentException
- if the specified ILayerer
is null
value
- a ILayerer
instancegetSingleComponentLayerer()