* Child classes should set flag reresizeEntitiesAfterLayout to false if they
* want to preserve node sizes.
*/
protected void defaultFitWithinBounds(InternalNode[] entitiesToLayout, InternalRelationship[] relationships, DisplayIndependentRectangle realBounds) {
DisplayIndependentRectangle layoutBounds;
if (resizeEntitiesAfterLayout) {
layoutBounds = getLayoutBounds(entitiesToLayout, false);
// Convert node x,y to be in percent rather than absolute coords
convertPositionsToPercentage(entitiesToLayout, relationships, layoutBounds, false /*do not update size*/);
// Resize and shift nodes
resizeAndShiftNodes(entitiesToLayout);
}
// Recalculate layout, allowing for the node width, which we now know
layoutBounds = getLayoutBounds(entitiesToLayout, true);
// adjust node positions again, to the new coordinate system (still as a percentage)
convertPositionsToPercentage(entitiesToLayout, relationships, layoutBounds, true /*update node size*/);
DisplayIndependentRectangle screenBounds = calcScreenBounds(realBounds, layoutBounds);
// Now convert to real screen coordinates
convertPositionsToCoords(entitiesToLayout, relationships, screenBounds);
}