Search this API

y.layout
Class MinNodeSizeStage

java.lang.Object
  extended by y.layout.AbstractLayoutStage
      extended by y.layout.MinNodeSizeStage
All Implemented Interfaces:
Layouter, LayoutStage

public class MinNodeSizeStage
extends AbstractLayoutStage

MinNodeSizeStage enforces a given minimum width/height of the nodes of a graph during the layout process. It temporarily enlarges nodes whose width/height is below the specified minimum values.

This LayoutStage is especially useful to prevent that the core layout algorithm has to handle zero-sized nodes or nodes with negative sizes.

 

Field Summary
 
Fields inherited from interface y.layout.Layouter
EDGE_ID_DPKEY, NODE_ID_DPKEY, SELECTED_EDGES, SELECTED_NODES
 
Constructor Summary
MinNodeSizeStage(Layouter coreLayouter)
          Creates a new MinNodeSizeStage instance using the given core layout algorithm.
MinNodeSizeStage(Layouter coreLayouter, double minWidth, double minHeight)
          Creates a new MinNodeSizeStage instance using the given core layout algorithm along with a specific minimum width and height for the nodes.
 
Method Summary
 boolean canLayout(LayoutGraph graph)
          Accepts all graphs that can be handled by the core layout algorithm.
 void doLayout(LayoutGraph graph)
          Resizes all nodes that are smaller than the specified minimum size to that minimum size, executes the core layout algorithm and restores the original sizes afterwards.
 
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

MinNodeSizeStage

public MinNodeSizeStage(Layouter coreLayouter,
                        double minWidth,
                        double minHeight)
Creates a new MinNodeSizeStage instance using the given core layout algorithm along with a specific minimum width and height for the nodes.

Parameters:
coreLayouter - the core layout routine
minWidth - the minimum width of nodes that should be enforced
minHeight - the minimum height of nodes that should be enforced

MinNodeSizeStage

public MinNodeSizeStage(Layouter coreLayouter)
Creates a new MinNodeSizeStage instance using the given core layout algorithm.

The nodes will be enlarged to be at least 1 wide and 1 high.

Parameters:
coreLayouter - the core routine
Method Detail

canLayout

public boolean canLayout(LayoutGraph graph)
Accepts all graphs that can be handled by the core layout algorithm.

If there is no core layout algorithm, all graphs are accepted.

Parameters:
graph - the input graph
Returns:
true if there is no core layout algorithm or the core layout algorithm accepts the graph, false otherwise
See Also:
Layouter.doLayout(LayoutGraph)

doLayout

public void doLayout(LayoutGraph graph)
Resizes all nodes that are smaller than the specified minimum size to that minimum size, executes the core layout algorithm and restores the original sizes afterwards.

Parameters:
graph - the input graph
See Also:
Layouter.canLayout(LayoutGraph)

© Copyright 2000-2021,
yWorks GmbH.
All rights reserved.