# SliceAndDiceAlgorithm

class SliceAndDiceAlgorithm(orientationStrategy: SliceAndDiceAlgorithm.OrientationStragegy = AlternateOrientationStrategy()) : AbstractAlgorithm

Implementation of the Slice-and-dice algorithm described in the original treemap paper. It is described in:

Ben Shneiderman. Tree Visualization with Tree-Maps: 2-d Space-filling Approach. ACM Transactions on Graphics, 11(1), pp. 92-99, 1992.

It uses parallel lines to divide a rectangle representing an item into smaller rectangles representing its children. At each level of hierarchy the orientation of the lines - vertical or horizontal - is switched (Alternate), computed according to the aspect ratio (Best), or fixed (Vertical, Horizontal).

Complexity: O(n), where n is the number of nodes in the tree.

## Constructors

SliceAndDiceAlgorithm
Link copied to clipboard
constructor(orientationStrategy: SliceAndDiceAlgorithm.OrientationStragegy = AlternateOrientationStrategy())

## Types

AlternateOrientationStrategy
Link copied to clipboard
class AlternateOrientationStrategy : SliceAndDiceAlgorithm.OrientationStragegy

Switched between vertical and horizontal at each hierarchy level

BestOrientationStrategy
Link copied to clipboard
class BestOrientationStrategy : SliceAndDiceAlgorithm.OrientationStragegy

Computed according to the aspect ratio

HoritzonalOrientationStrategy
Link copied to clipboard
class HoritzonalOrientationStrategy : SliceAndDiceAlgorithm.OrientationStragegy

Always horizontal

OrientationStragegy
Link copied to clipboard
interface OrientationStragegy

Types of orientation of the rectangle divisions

VerticalOrientationStrategy
Link copied to clipboard
class VerticalOrientationStrategy : SliceAndDiceAlgorithm.OrientationStragegy

Always vertical

## Properties

isChildContained
Link copied to clipboard
open override val isChildContained: Boolean
isColorParent
Link copied to clipboard
open override val isColorParent: Boolean
isRenderingLeafLabelsSupported
Link copied to clipboard
open override val isRenderingLeafLabelsSupported: Boolean
isRenderingParentLabelSupported
Link copied to clipboard
open override val isRenderingParentLabelSupported: Boolean
isSpaceFilling
Link copied to clipboard
open override val isSpaceFilling: Boolean
properties
Link copied to clipboard
open override val properties: MutableProperties<String?>?

Properties for storing layout algorithm specific options.

## Functions

breadthFirstLayout
Link copied to clipboard
open override fun <N, Row, Column> breadthFirstLayout(shape: Shape, parent: N, children: Array<N>, sumSizes: Double, horizontalVanishingPoint: Int, verticalVanishingPoint: Int, accessor: TreeMapAccessor<N>, worker: TreeMapWorker?): Boolean

{@inheritDoc}

depthFirstLayout
Link copied to clipboard
open override fun <N, Row, Column> depthFirstLayout(shape: Shape?, parent: N, children: Array<N>, sumSizes: Double, horizontalVanishingPoint: Int, verticalVanishingPoint: Int, accessor: TreeMapAccessor<N>, worker: TreeMapWorker?): Boolean

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.

finishLayout
Link copied to clipboard
open override fun <N, Row, Column> finishLayout(bounds: Rectangle2D?, model: TreeMapModel<N, Row, Column>?, root: N)

Do nothing by default.

getName
Link copied to clipboard
fun getName(): String
isCompatible
Link copied to clipboard
open override fun isCompatible(shape: Shape?): Boolean

Indicates whether the layout algorithm can handle the given geometry of its parent

iterator
Link copied to clipboard
open override fun <N, Row, Column> iterator(model: TreeMapModel<N, Row, Column>, root: N): Iterable<N>

Breadth first traversal by default.

startLayout
Link copied to clipboard
open override fun <N, Row, Column> startLayout(bounds: Rectangle2D?, model: TreeMapModel<N, Row, Column>, root: N, worker: TreeMapWorker?)

Do nothing by default.

toString
Link copied to clipboard
open override fun toString(): String