use of org.eclipse.zest.layouts.dataStructures.DisplayIndependentPoint in project archi by archimatetool.
the class RadialLayoutAlgorithm method getLayoutBounds.
/**
* 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.
*/
@Override
protected DisplayIndependentRectangle getLayoutBounds(InternalNode[] entitiesToLayout, boolean includeNodeSize) {
DisplayIndependentRectangle layoutBounds = super.getLayoutBounds(entitiesToLayout, includeNodeSize);
DisplayIndependentPoint centerPoint = (roots != null) ? determineCenterPoint(roots) : new DisplayIndependentPoint(layoutBounds.x + layoutBounds.width / 2, layoutBounds.y + layoutBounds.height / 2);
// The center entity is determined in applyLayout
double maxDistanceX = Math.max(Math.abs(layoutBounds.x + layoutBounds.width - centerPoint.x), Math.abs(centerPoint.x - layoutBounds.x));
double maxDistanceY = Math.max(Math.abs(layoutBounds.y + layoutBounds.height - centerPoint.y), Math.abs(centerPoint.y - layoutBounds.y));
layoutBounds = new DisplayIndependentRectangle(centerPoint.x - maxDistanceX, centerPoint.y - maxDistanceY, maxDistanceX * 2, maxDistanceY * 2);
return layoutBounds;
}
use of org.eclipse.zest.layouts.dataStructures.DisplayIndependentPoint in project archi by archimatetool.
the class DynamicScreen method getVirtualLocation.
public DisplayIndependentPoint getVirtualLocation(DisplayIndependentPoint point) {
DisplayIndependentRectangle layoutBounds = calculateBounds();
double x = (point.x / screenBounds.width) * layoutBounds.width + layoutBounds.x;
double y = (point.y / screenBounds.height) * layoutBounds.height + layoutBounds.y;
return new DisplayIndependentPoint(x, y);
}
Aggregations