Package com.macrofocus.treemap
Interface Algorithm<N,Row,Column,Color,Font>
-
- All Known Subinterfaces:
TagCloudAlgorithm<Font>
- All Known Implementing Classes:
AbstractAlgorithm
,AbstractTagCloudAlgorithm
,BarAlgorithm
,FastVoronoiAlgorithm
,IcicleAlgorithm
,LegacySwingTagCloudAlgorithm
,OriginalFastVoronoiAlgorithm
,PieAlgorithm
,PivotByAlgorithm
,SliceAndDiceAlgorithm
,SquarifiedAlgorithm
,SquarifiedPlusAlgorithm
,SunburstAlgorithm
,SwingTagCloudAlgorithm
,VennAlgorithm
,VoronoiAlgorithm
@JsType public interface Algorithm<N,Row,Column,Color,Font>
The interface for all treemap layout algorithms. If you write your own algorithm, it should conform to this interface.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
breadthFirstLayout(java.awt.Shape shape, MutableTreeMapNode parent, MutableTreeMapNode[] children, double sumSizes, int horizontalVanishingPoint, int verticalVanishingPoint, TreeMapWorker worker)
Arrange the items in the given array to fill the given shape.boolean
depthFirstLayout(java.awt.Shape shape, MutableTreeMapNode parent, MutableTreeMapNode[] children, double sumSizes, int horizontalVanishingPoint, int verticalVanishingPoint, TreeMapWorker worker)
Arrange the items in the given array to fill the given shape.void
finishLayout(java.awt.geom.Rectangle2D bounds, TreeMapModel<N,Row,Column,Color,Font> model, N root)
Finish the layout after breadthFirstLayout has completed.MutableProperties
getProperties()
Properties for storing layout algorithm specific options.boolean
isChildContained()
boolean
isColorParent()
boolean
isCompatible(java.awt.Shape shape)
Indicates whether the layout algorithm can handle the given geometry of its parentboolean
isRenderingLeafLabelsSupported()
boolean
isRenderingParentLabelSupported()
boolean
isSpaceFilling()
java.lang.Iterable
iterator(TreeMapModel<N,Row,Column,Color,Font> model, N root)
Controls the order by which the tree should be traversed.void
startLayout(java.awt.geom.Rectangle2D bounds, TreeMapModel<N,Row,Column,Color,Font> model, N root, TreeMapWorker worker)
Start the layout before breadthFirstLayout is initiated.
-
-
-
Method Detail
-
getProperties
MutableProperties getProperties()
Properties for storing layout algorithm specific options.- Returns:
- the specific properties of this algorithm
-
iterator
java.lang.Iterable iterator(TreeMapModel<N,Row,Column,Color,Font> model, N root)
Controls the order by which the tree should be traversed.- Parameters:
model
- the modelroot
- the root node- Returns:
- an iterator to traverse the tree in the specified order
-
startLayout
void startLayout(java.awt.geom.Rectangle2D bounds, TreeMapModel<N,Row,Column,Color,Font> model, N root, TreeMapWorker worker)
Start the layout before breadthFirstLayout is initiated.- Parameters:
bounds
- the bounds of the viewmodel
- the modelroot
- the root nodeworker
-
-
depthFirstLayout
boolean depthFirstLayout(java.awt.Shape shape, MutableTreeMapNode parent, MutableTreeMapNode[] children, double sumSizes, 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 from the bottom up.- Parameters:
shape
- the current rectangle being divided.parent
- the parent node.children
- the items to map.sumSizes
- the size of the parent.horizontalVanishingPoint
-verticalVanishingPoint
-worker
- the worker thread- Returns:
- true if the layout has been cancelled, false otherwise
-
breadthFirstLayout
boolean breadthFirstLayout(java.awt.Shape shape, MutableTreeMapNode parent, MutableTreeMapNode[] children, double sumSizes, 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.sumSizes
- the size of the parent.horizontalVanishingPoint
-verticalVanishingPoint
-worker
- the worker thread- Returns:
- true if the layout has been cancelled, false otherwise
-
finishLayout
void finishLayout(java.awt.geom.Rectangle2D bounds, TreeMapModel<N,Row,Column,Color,Font> model, N root)
Finish the layout after breadthFirstLayout has completed.- Parameters:
bounds
- the bounds of the viewmodel
- the modelroot
- the root node
-
isCompatible
boolean isCompatible(java.awt.Shape shape)
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
-
isRenderingLeafLabelsSupported
boolean isRenderingLeafLabelsSupported()
-
isRenderingParentLabelSupported
boolean isRenderingParentLabelSupported()
-
isColorParent
boolean isColorParent()
-
isChildContained
boolean isChildContained()
-
isSpaceFilling
boolean isSpaceFilling()
-
-