public class AsIsLayerer extends Object implements ILayerer
AsIsLayerer
assigns nodes to layers by analyzing already existing node coordinates.
Nodes whose bounding boxes overlap in the main layout direction are assigned to the same layer. To influence to which
amount the boxes need to overlap, the nodes can temporarily be
scaled
. Alternatively, a minimum and maximum size or a halo can be specified
for the nodes.
Initial graph
Hierarchic layout when the initial drawing is used as sketch
Hierarchic layout when the initial drawing is not used as sketch
Constructor and Description |
---|
AsIsLayerer()
Creates an instance of
AsIsLayerer with default settings. |
Modifier and Type | Method and Description |
---|---|
void |
assignLayers(LayoutGraph graph,
ILayers layers,
ILayoutDataProvider ldp)
Assigns all nodes of the graph to layers by analyzing already existing node coordinates and adds them to the
ILayers
instance. |
int |
assignNodeLayer(LayoutGraph graph,
INodeMap layerID,
EdgeList reversedEdges)
Assigns all nodes of the graph to layers.
|
protected double |
getMax(LayoutGraph graph,
Node node)
Callback used for calculating the lower (max) value of a given node.
|
double |
getMaximumNodeSize()
Gets the maximum size of a node used for calculating layer overlaps.
|
protected double |
getMin(LayoutGraph graph,
Node node)
Callback used for calculating the upper (min) value of a given node.
|
double |
getMinimumNodeSize()
Gets the minimum size of a node used for calculating layer overlaps.
|
double |
getNodeHalo()
Gets the size of the halo around a node, that means the insets that are used for calculating layer overlaps.
|
double |
getNodeScalingFactor()
Gets the scaling factor used for scaling the size of the nodes.
|
void |
setMaximumNodeSize(double value)
Sets the maximum size of a node used for calculating layer overlaps.
|
void |
setMinimumNodeSize(double value)
Sets the minimum size of a node used for calculating layer overlaps.
|
void |
setNodeHalo(double value)
Sets the size of the halo around a node, that means the insets that are used for calculating layer overlaps.
|
void |
setNodeScalingFactor(double value)
Sets the scaling factor used for scaling the size of the nodes.
|
public AsIsLayerer()
AsIsLayerer
with default settings.public void assignLayers(LayoutGraph graph, ILayers layers, ILayoutDataProvider ldp)
ILayers
instance.
Nodes whose bounding boxes overlap in the main layout direction are assigned to the same layer. To influence to which
amount the boxes need to overlap, the nodes can temporarily be scaled
.
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 querying information about the nodes and edgesILayers.insert(com.yworks.yfiles.layout.hierarchic.LayerType, int)
,
ILayer.add(com.yworks.yfiles.algorithms.Node)
public int assignNodeLayer(LayoutGraph graph, INodeMap layerID, EdgeList reversedEdges)
protected double getMax(LayoutGraph graph, Node node)
It is called by method assignNodeLayer(LayoutGraph, INodeMap, EdgeList)
.
graph
- the graphnode
- the nodepublic double getMaximumNodeSize()
This can be used for more fuzzy layering.
The maximum size can take positive values.
IllegalArgumentException
- if the specified value is less than 0
Double.MAX_VALUE
setNodeScalingFactor(double)
,
setNodeHalo(double)
,
setMaximumNodeSize(double)
protected double getMin(LayoutGraph graph, Node node)
It is called by method assignNodeLayer(LayoutGraph, INodeMap, EdgeList)
.
graph
- the graphnode
- the nodepublic double getMinimumNodeSize()
This can be used for more fuzzy layering.
The minimum size can take positive values.
IllegalArgumentException
- if the specified value is less than 0
setNodeScalingFactor(double)
,
setNodeHalo(double)
,
setMinimumNodeSize(double)
public double getNodeHalo()
If the value of the halo is positive, it specifies a border around a node. In case it is negative, it is considered as an inset that defines a smaller area inside the node.
This can be used for more fuzzy layering.
setNodeScalingFactor(double)
,
setMinimumNodeSize(double)
,
setMaximumNodeSize(double)
,
setNodeHalo(double)
public double getNodeScalingFactor()
Nodes are being scaled from their center. This can be used for more fuzzy layering.
The scaling factor can take positive values. Factors smaller than 1
only consider large overlaps of the nodes'
bounding boxes in the main layout direction. Factors larger than 1
also combine nodes with some distance between
them.
IllegalArgumentException
- if the specified value is less than 0
getMinimumNodeSize()
,
getMaximumNodeSize()
,
getNodeHalo()
,
setNodeScalingFactor(double)
public void setMaximumNodeSize(double value)
This can be used for more fuzzy layering.
The maximum size can take positive values.
IllegalArgumentException
- if the specified value is less than 0
Double.MAX_VALUE
value
- a positive double valuesetNodeScalingFactor(double)
,
setNodeHalo(double)
,
getMaximumNodeSize()
public void setMinimumNodeSize(double value)
This can be used for more fuzzy layering.
The minimum size can take positive values.
IllegalArgumentException
- if the specified value is less than 0
value
- a positive double valuesetNodeScalingFactor(double)
,
setNodeHalo(double)
,
getMinimumNodeSize()
public void setNodeHalo(double value)
If the value of the halo is positive, it specifies a border around a node. In case it is negative, it is considered as an inset that defines a smaller area inside the node.
This can be used for more fuzzy layering.
value
- the size of a node's halosetNodeScalingFactor(double)
,
setMinimumNodeSize(double)
,
setMaximumNodeSize(double)
,
getNodeHalo()
public void setNodeScalingFactor(double value)
Nodes are being scaled from their center. This can be used for more fuzzy layering.
The scaling factor can take positive values. Factors smaller than 1
only consider large overlaps of the nodes'
bounding boxes in the main layout direction. Factors larger than 1
also combine nodes with some distance between
them.
IllegalArgumentException
- if the specified value is less than 0
value
- a positive double valuegetMinimumNodeSize()
,
getMaximumNodeSize()
,
getNodeHalo()
,
getNodeScalingFactor()