Class Squarify<T>

java.lang.Object
software.coley.treemap.squaring.Squarify<T>
Type Parameters:
T - Content type associated with inputs.

public class Squarify<T> extends Object
A class to generate a squarified treemap layout from a set of values.
Author:
agatheblues - Reference implementation of squarify algorithm, Matt Coley - Generic support, modernizations and UI integrations
  • Constructor Details

    • Squarify

      public Squarify(@Nonnull List<T> values, @Nonnull ToDoubleFunction<T> sizeFunction, double x, double y, double width, double height)
      Parameters:
      values - Values to represent in a squarified treemap.
      sizeFunction - Function to convert T values to sizes.
      x - Start X offset into canvas to begin filling into.
      y - Start Y offset into canvas to begin filling into.
      width - Width of the space in the canvas to fill.
      height - Height of the space in the canvas to fill.
  • Method Details

    • getRectangles

      @Nonnull public List<Rectangle<T>> getRectangles()
      Returns:
      Result of squarification operation.
    • makeRect

      @Nonnull protected Rectangle<T> makeRect(@Nullable T value, double x, double y, double width, double height)
      Parameters:
      value - Value to wrap.
      x - Rect x coordinate.
      y - Rect y coordinate.
      width - Rect width.
      height - Rect height.
      Returns:
      New rect with the provided dimensions.