Class AlgorithmHelper
java.lang.Object
org.eclipse.zest.layouts.algorithms.AlgorithmHelper
- Since:
- 2.0
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic voidfitWithinBounds(EntityLayout[] entities, DisplayIndependentRectangle destinationBounds, boolean resize) Fits given entities within given bounds, preserving their relative locations.static DisplayIndependentRectanglegetLayoutBounds(EntityLayout[] entities, boolean includeNodeSize) Find the bounds in which the nodes are located.static DisplayIndependentDimensiongetMinimumDistance(EntityLayout[] entities) minDistance is the closest that any two points are together.static voidmaximizeSizes(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_SIZEpublic static int MIN_NODE_SIZE
- 
PADDING_PERCENTpublic static double PADDING_PERCENT
 
- 
- 
Constructor Details- 
AlgorithmHelperpublic AlgorithmHelper()
 
- 
- 
Method Details- 
fitWithinBoundspublic static void fitWithinBounds(EntityLayout[] entities, DisplayIndependentRectangle destinationBounds, boolean resize) Fits given entities within given bounds, preserving their relative locations.- Parameters:
- entities-
- destinationBounds-
- resize-
 
- 
maximizeSizesResizes 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-
 
- 
getLayoutBoundspublic 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.
- 
getMinimumDistanceminDistance 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._______ | | | | | + | | |\ | |___|_\_|_____ | | \ | | | \ | +-|---+ | | | |_______|
 
-