Class AlgorithmHelper
java.lang.Object
org.eclipse.zest.layouts.algorithms.AlgorithmHelper
- Since:
- 2.0
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
fitWithinBounds
(EntityLayout[] entities, DisplayIndependentRectangle destinationBounds, boolean resize) Fits given entities within given bounds, preserving their relative locations.static DisplayIndependentRectangle
getLayoutBounds
(EntityLayout[] entities, boolean includeNodeSize) Find the bounds in which the nodes are located.static DisplayIndependentDimension
getMinimumDistance
(EntityLayout[] entities) minDistance is the closest that any two points are together.static void
maximizeSizes
(EntityLayout[] entities) Resizes the nodes so that they have a maximal area without overlapping each other, with additional empty space of 20% of node's width (or height, if bigger).
-
Field Details
-
MIN_NODE_SIZE
public static int MIN_NODE_SIZE -
PADDING_PERCENT
public static double PADDING_PERCENT
-
-
Constructor Details
-
AlgorithmHelper
public AlgorithmHelper()
-
-
Method Details
-
fitWithinBounds
public static void fitWithinBounds(EntityLayout[] entities, DisplayIndependentRectangle destinationBounds, boolean resize) Fits given entities within given bounds, preserving their relative locations.- Parameters:
entities
-destinationBounds
-resize
-
-
maximizeSizes
Resizes the nodes so that they have a maximal area without overlapping each other, with additional empty space of 20% of node's width (or height, if bigger). It does nothing if there's less than two nodes.- Parameters:
entities
-
-
getLayoutBounds
public static DisplayIndependentRectangle getLayoutBounds(EntityLayout[] entities, boolean includeNodeSize) Find the bounds in which the nodes are located. Using the bounds against the real bounds of the screen, the nodes can proportionally be placed within the real bounds. The bounds can be determined either including the size of the nodes or not. If the size is not included, the bounds will only be guaranteed to include the center of each node. -
getMinimumDistance
minDistance is the closest that any two points are together. These two points become the center points for the two closest nodes, which we wish to make them as big as possible without overlapping. This will be the maximum of minDistanceX and minDistanceY minus a bit, lets say 20% We make the recommended node size a square for convenience._______ | | | | | + | | |\ | |___|_\_|_____ | | \ | | | \ | +-|---+ | | | |_______|
-