Package com.treemap.swing.originalfastvoronoi

# Interface VoronoiTreemapInterface

All Known Implementing Classes:
  `VoronoiTreemap`

public interface VoronoiTreemapInterface
Main interface to use the library. First the hierarchy (tree) with weights and root polygon has to be set. Every functionality should go through this interface.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `clear()`
  Clears the used datastructures.
  `void`
  `compute()`
  After setting at least the rootPolygon and the treeStructure(see `setTreeAndWeights(PolygonSimple, ArrayList, ArrayList, ArrayList)`), the voronoi Treemap can be computed.
  `boolean`
  `getAggressiveMode()`
  true: aggressive weight modification false: normal weight modification
  `double`
  `getCancelErrorThreshold()`
  maximal error threshold to cancel the optimization process.
  `boolean`
  `getCancelOnMaxIteration()`
  `boolean`
  `getCancelOnThreshold()`
  `setCancelOnThreshold(boolean)`
  `boolean`
  `getGuaranteeValidCells()`
  `setGuaranteeValidCells(boolean)`
  `int`
  `getNumberMaxIterations()`
  the maximal number of iterations.
  `double`
  `getPreflowIncrease()`
  `double`
  `getPreflowPercentage()`
  `setPreflowPercentage(double)`
  `long`
  `getRandomSeed()`
  Seed which is used for random initialization of the sites.
  `PolygonSimple`
  `getRootPolygon()`
  Returns the root polygon.
  `boolean`
  `getShowLeafs()`
  `double`
  `getShrinkPercentage()`
  `setShrinkPercentage(double)`
  `StatusObject`
  `getStatusObject()`
  `setStatusObject(StatusObject)`
  `boolean`
  `getUseBorder()`
  `setUseBorder(boolean)`
  `boolean`
  `getUseExtrapolation()`
  `setUseExtrapolation(boolean)`
  `boolean`
  `isUseNegativeWeights()`
  Return whether negative weights for the sites are allowed.
  `void`
  `setAggressiveMode(boolean mode)`
  the aggressive mode modifies the weights of the sites very aggressively and is not 100% stable (some cells can get empty), anyway sometimes it yields better local minima.
  `void`
  `setAreaGoals(ArrayList<Tuple2ID> areaGoals)`
  Sets a weighting for each nodes which influences the final area the node polygon has.
  `void`
  `setCancelOnMaxIteration(boolean cancelOnMaxIterat)`
  true: The optimization process is canceled when the maximal iteration number is reached.
  `void`
  `setCancelOnThreshold(boolean cancelOnThreshold)`
  true: the optimization process is canceled when the area error is below the given threshold.
  `void`
  `setGuaranteeValidCells(boolean guaranteeInvariant)`
  true: guarantees that the weight adaption does not cause empty cells.
  `void`
  `setNumberMaxIterations(int numberMaxIterations)`
  Sets the default maximal number of iterations done in a single level computation.
  `void`
  `setNumberThreads(int numberThreads)`
  If possible the given number of threads will be started to speed up the optimization process.
  `void`
  `setPreflowIncrease(double preflowIncrease)`
  `void`
  `setPreflowPercentage(double preflowPercentage)`
  If the desire of a cell (site) to increase its area is above this percentage, then this cell pushes the other cells away.
  `void`
  `setRandomSeed(long seed)`
  Sets the seed for the random position generator which is used to initialize the sites.
  `void`
  `setReferenceMap(ArrayList<Tuple3ID> relativePositions)`
  ReferenceMap, which consists of a relative x,y position for each node: each coordinate must be in the range between [0...1]
  `void`
  `setRootPolygon(PolygonSimple rootPolygon)`
  Sets the convex root polygon in which the treemap is computed.
  `void`
  `setRootRectangle(double x, double y, double width, double height)`
  Sets the a rectangle (as root polygon) in which the treemap is computed.
  `void`
  `setShrinkPercentage(double shrinkPercentage)`
  Sets the factor which scales every iteration, so 1-shrinkPercentage is equally the border percentage.
  `void`
  `setStatusObject(StatusObject statusObject)`
  This status object is notified when the children of a node are processed and when the whole computation has finished.
  `void`
  `setTree(ArrayList<ArrayList<Integer>> treeStructure)`
  Sets the tree.
  `void`
  `setTreeAndWeights(PolygonSimple rootPolygon, ArrayList<ArrayList<Integer>> treeStructure, ArrayList<Tuple2ID> areaGoals, ArrayList<Tuple3ID> referenceMapPositions)`
  All necessary things are set here such that a Voronoi Treemap can be computed.
  `void`
  `setUseBorder(boolean useBorder)`
  Sets whether there borders are added for every iteration level or not.
  `void`
  `setUseExtrapolation(boolean useExtrapolation)`
  Activates the speed up heuristic which uses some kind of force to make more space for big cells.
  `void`
  `setUseNegativeWeights(boolean use)`
  set usage of negative weights for the sites.

- ## Method Details

  - ### compute

    void compute()
    After setting at least the rootPolygon and the treeStructure(see `setTreeAndWeights(PolygonSimple, ArrayList, ArrayList, ArrayList)`), the voronoi Treemap can be computed. For every computed Node finishedNode(...) will be called in the StatusObject. If the computation is completed finished() will be called in the Statusobject.

  - ### setAggressiveMode

    void setAggressiveMode(boolean mode)
    the aggressive mode modifies the weights of the sites very aggressively and is not 100% stable (some cells can get empty), anyway sometimes it yields better local minima.
    Parameters:
      `mode` -

  - ### getAggressiveMode

    boolean getAggressiveMode()
    true: aggressive weight modification false: normal weight modification
    Returns:

  - ### setRandomSeed

    void setRandomSeed(long seed)
    Sets the seed for the random position generator which is used to initialize the sites.
    Parameters:
      `seed` -

  - ### getRandomSeed

    long getRandomSeed()
    Seed which is used for random initialization of the sites.
    Returns:

  - ### setTreeAndWeights

    void setTreeAndWeights(PolygonSimple rootPolygon, ArrayList<ArrayList<Integer>> treeStructure, ArrayList<Tuple2ID> areaGoals, ArrayList<Tuple3ID> referenceMapPositions)
    All necessary things are set here such that a Voronoi Treemap can be computed. AreaGoals and refereceMapPositions can be null.

  - ### setTree

    void setTree(ArrayList<ArrayList<Integer>> treeStructure)
    Sets the tree.
    Parameters:
      `treeStructure` - defines a tree by an adjacency list, node a has children b,c,d (list(a,b,c,d))

  - ### setAreaGoals

    void setAreaGoals(ArrayList<Tuple2ID> areaGoals)
    Sets a weighting for each nodes which influences the final area the node polygon has. the weightings are normalized so that the sum over the weightings of descendant nodes equals to one. this function must be called after the tree structure is defined (setTree(...)).
    Parameters:
      `areaGoals` - Tupel2ID with (NodeId, weight)

  - ### setReferenceMap

    void setReferenceMap(ArrayList<Tuple3ID> relativePositions)
    ReferenceMap, which consists of a relative x,y position for each node: each coordinate must be in the range between [0...1]
    Parameters:
      `relativePositions` - Tupel3ID with (NodeId, relative x, relative y), x,y in range [0,1]

  - ### getShowLeafs

    boolean getShowLeafs()

  - ### setShrinkPercentage

    void setShrinkPercentage(double shrinkPercentage)
    Sets the factor which scales every iteration, so 1-shrinkPercentage is equally the border percentage.
    Parameters:
      `shrinkPercentage` - preferred between 0 < shrinkPercentage <= 1

  - ### getShrinkPercentage

    double getShrinkPercentage()
    `setShrinkPercentage(double)`
    Returns:

  - ### setUseBorder

    void setUseBorder(boolean useBorder)
    Sets whether there borders are added for every iteration level or not.
    Parameters:
      `useBorder` -

  - ### getUseBorder

    boolean getUseBorder()
    `setUseBorder(boolean)`
    Returns:

  - ### setNumberMaxIterations

    void setNumberMaxIterations(int numberMaxIterations)
    Sets the default maximal number of iterations done in a single level computation.
    Parameters:
      `numberMaxIterations` -

  - ### getNumberMaxIterations

    int getNumberMaxIterations()
    the maximal number of iterations.
    Returns:
      cancelOnMaxIterat

  - ### setPreflowPercentage

    void setPreflowPercentage(double preflowPercentage)
    If the desire of a cell (site) to increase its area is above this percentage, then this cell pushes the other cells away. This option reduces the number of needed iteration if there is high variance in the desired cell sizes.
    Parameters:
      `preflowPercentage` -

  - ### getPreflowPercentage

    double getPreflowPercentage()
    `setPreflowPercentage(double)`
    Returns:

  - ### setPreflowIncrease

    void setPreflowIncrease(double preflowIncrease)
    Parameters:
      `preflowIncrease` - the preflowIncrease to set

  - ### getPreflowIncrease

    double getPreflowIncrease()
    Returns:
      the preflowIncrease

  - ### setUseExtrapolation

    void setUseExtrapolation(boolean useExtrapolation)
    Activates the speed up heuristic which uses some kind of force to make more space for big cells.
    Parameters:
      `useExtrapolation` - the useExtrapolation to set

  - ### getUseExtrapolation

    boolean getUseExtrapolation()
    `setUseExtrapolation(boolean)`
    Returns:
      the useExtrapolation

  - ### setCancelOnThreshold

    void setCancelOnThreshold(boolean cancelOnThreshold)
    true: the optimization process is canceled when the area error is below the given threshold.
    Parameters:
      `cancelOnThreshold` - the cancelOnThreshold to set

  - ### getCancelOnThreshold

    boolean getCancelOnThreshold()
    `setCancelOnThreshold(boolean)`
    Returns:
      the cancelOnThreshold

  - ### getCancelErrorThreshold

    double getCancelErrorThreshold()
    maximal error threshold to cancel the optimization process.
    Returns:

  - ### setCancelOnMaxIteration

    void setCancelOnMaxIteration(boolean cancelOnMaxIterat)
    true: The optimization process is canceled when the maximal iteration number is reached.
    Parameters:
      `cancelOnMaxIterat` - the cancelOnMaxIterat to set

  - ### getCancelOnMaxIteration

    boolean getCancelOnMaxIteration()

  - ### setRootPolygon

    void setRootPolygon(PolygonSimple rootPolygon)
    Sets the convex root polygon in which the treemap is computed. The result will always be included into the root polygon. Currently the root polygon has to be convex, if you have a fast implementation for the intersection of non convex polygons, I could easily extend the library to simple polygons.
    Parameters:
      `rootPolygon` - the root Polygon to be set (must be convex currently)

  - ### setRootRectangle

    void setRootRectangle(double x, double y, double width, double height)
    Sets the a rectangle (as root polygon) in which the treemap is computed.
    Parameters:
      `x` - x-coordinate of the upper left point of the rectangle
      `y` - y-coordinate of the upper left point of the rectangle
      `width` - width of the rectangle
      `height` - height of the rectangle

  - ### getRootPolygon

    PolygonSimple getRootPolygon()
    Returns the root polygon.
    Returns:
      the rootPolygon

  - ### setGuaranteeValidCells

    void setGuaranteeValidCells(boolean guaranteeInvariant)
    true: guarantees that the weight adaption does not cause empty cells. false:computation is approx. 30 % faster, but exception could be thrown in the optimization process
    Parameters:
      `guaranteeInvariant` - guarantee non empty cells

  - ### getGuaranteeValidCells

    boolean getGuaranteeValidCells()
    `setGuaranteeValidCells(boolean)`
    Returns:
      the guaranteeInvariant

  - ### setNumberThreads

    void setNumberThreads(int numberThreads)
    If possible the given number of threads will be started to speed up the optimization process. Usually this is possible after the computation of the first hierarchy level has been finished.
    Parameters:
      `numberThreads` - the numberThreads to set

  - ### setStatusObject

    void setStatusObject(StatusObject statusObject)
    This status object is notified when the children of a node are processed and when the whole computation has finished.
    Parameters:
      `statusObject` - the tellTheEndObject to set

  - ### getStatusObject

    StatusObject getStatusObject()
    `setStatusObject(StatusObject)`
    Returns:

  - ### isUseNegativeWeights

    boolean isUseNegativeWeights()
    Return whether negative weights for the sites are allowed. Negative weights should result in a faster convergence.
    Returns:

  - ### setUseNegativeWeights

    void setUseNegativeWeights(boolean use)
    set usage of negative weights for the sites. Negative weights should result in a faster convergence.
    Parameters:
      `use` -

  - ### clear

    void clear()
    Clears the used datastructures.