public class GivenLayersLayerer extends Object implements ILayerer
The layer IDs are given by a IDataProvider that returns the integer layer ID of each node of the graph. Nodes
with the same ID are in the same layer while the layers are sorted according to their IDs such that the smallest ID
represents the top layer.
| Modifier and Type | Field and Description |
|---|---|
static NodeDpKey<Integer> |
LAYER_ID_DPKEY
A
DataProvider key for storing the layer IDs.
|
| Constructor and Description |
|---|
GivenLayersLayerer()
Creates an instance of
GivenLayersLayerer. |
| Modifier and Type | Method and Description |
|---|---|
void |
assignLayers(LayoutGraph graph,
ILayers layers,
ILayoutDataProvider ldp)
Assigns all nodes of the graph to layers and adds them to the
ILayers instance. |
int |
assignNodeLayer(LayoutGraph graph,
INodeMap layerID,
EdgeList reversedEdges)
Assigns the nodes of the graph to layers given by the
IDataProvider registered with the graph using key
LAYER_ID_DPKEY. |
int |
normalize(Graph graph,
IDataProvider layerId,
IDataAcceptor normalizedLayerId)
Convenience method that removes empty layers and ensures that the smallest layer has value
0. |
public static final NodeDpKey<Integer> LAYER_ID_DPKEY
DataProvider key for storing the layer IDs.
This IDataProvider stores for each node the layer ID to which it belongs. Nodes with the same ID are in the same
layer while the layers are sorted according to their IDs such that the smallest ID represents the top layer.
public GivenLayersLayerer()
GivenLayersLayerer.public void assignLayers(LayoutGraph graph, ILayers layers, ILayoutDataProvider ldp)
ILayers instance.assignLayers in interface ILayerergraph - 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)
IDataProvider registered with the graph using key
LAYER_ID_DPKEY.IllegalArgumentException - if no IDataProvider with key LAYER_ID_DPKEY is registered with the given graphgraph - the graphlayerID - the INodeMap that will be filled during the execution and holds the zero-based index of the layer to which each
node belongs; this INodeMap is a normalized variant of the given IDataProvider registered with the graph
using key LAYER_ID_DPKEY and the first layer has the number 0reversedEdges - the EdgeList containing the edges that have been reversedpublic int normalize(Graph graph, IDataProvider layerId, IDataAcceptor normalizedLayerId)
0.graph - the graphlayerId - the IDataProvider that returns an integer value (layer) for each node; the first layer has the number 0normalizedLayerId - the IDataAcceptor that will be filled by the layout algorithm and holds an integer value (layer ID after
normalization) for each node