Package com.macrofocus.treemap
Class SquarifiedAlgorithm
- java.lang.Object
-
- com.macrofocus.treemap.AbstractAlgorithm
-
- com.macrofocus.treemap.SquarifiedAlgorithm
-
- All Implemented Interfaces:
Algorithm
public class SquarifiedAlgorithm extends AbstractAlgorithm
Implementation of the Squarified algorithm. It is described in: Bruls, D.M., C. Huizing, J.J. van Wijk. "Squarified Treemaps". In: W. de Leeuw, R. van Liere (eds.), Data Visualization 2000, Proceedings of the joint Eurographics and IEEE TCVG Symposium on Visualization, 2000, pp. 33-42. Sub-divids a parent rectangular area into child rectangles. It implements the squaring treemap algorithm where all child nodes are allocated areas proportional to their values, but the aspect ratio of each rectangle is kept as close as possible to a square. Complexity: O(n), where n is the number of nodes in the tree.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
PROPERTY_DESIREDASPECTRATIO
-
Constructor Summary
Constructors Constructor Description SquarifiedAlgorithm()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
breadthFirstLayout(java.awt.Shape shape, MutableTreeMapNode parent, MutableTreeMapNode[] children, double sumSize, int horizontalVanishingPoint, int verticalVanishingPoint, TreeMapWorker worker)
Arrange the items in the given array to fill the given shape.MutableProperties
getProperties()
Properties for storing layout algorithm specific options.boolean
isCompatible(java.awt.Shape shape)
Indicates whether the layout algorithm can handle the given geometry of its parentjava.lang.String
toString()
-
Methods inherited from class com.macrofocus.treemap.AbstractAlgorithm
depthFirstLayout, finishLayout, isChildContained, isColorParent, isRenderingLeafLabelsSupported, isRenderingParentLabelSupported, isSpaceFilling, iterator, startLayout, sum
-
-
-
-
Field Detail
-
PROPERTY_DESIREDASPECTRATIO
public static final java.lang.String PROPERTY_DESIREDASPECTRATIO
- See Also:
- Constant Field Values
-
-
Method Detail
-
getProperties
public MutableProperties getProperties()
Description copied from interface:Algorithm
Properties for storing layout algorithm specific options.- Specified by:
getProperties
in interfaceAlgorithm
- Overrides:
getProperties
in classAbstractAlgorithm
- Returns:
- the specific properties of this algorithm
-
breadthFirstLayout
public boolean breadthFirstLayout(java.awt.Shape shape, MutableTreeMapNode parent, MutableTreeMapNode[] children, double sumSize, int horizontalVanishingPoint, int verticalVanishingPoint, TreeMapWorker worker)
Arrange the items in the given array to fill the given shape. This is called during the first pass, while traversing the tree top down.- Parameters:
shape
- the current rectangle being divided.parent
- the parent node.children
- the items to map.sumSize
- the size of the parent.worker
- the worker thread- Returns:
- true if the layout has been cancelled, false otherwise
-
isCompatible
public boolean isCompatible(java.awt.Shape shape)
Description copied from interface:Algorithm
Indicates whether the layout algorithm can handle the given geometry of its parent- Parameters:
shape
- the geometry of its parent- Returns:
- true if it can lay out the children using the specified geometrical shape
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-