Graph Layout > Basic Concepts > Layout Parameters in IlvGraphLayout > Layout Region
 
Layout Region
Some layout algorithms can control the size of the graph drawing and can take into account a user-defined layout region. For example, you can specify that the layout should fit a given rectangle within a manager view or that it should fit the entire manager view.
Rogue Wave Views allows you to specify a layout region in three different ways:
*You can indicate that the size of the drawing must fit (exactly or approximately) the size of a given manager view:
void IlvGraphLayout::setLayoutRegion(IlvView* view)
*You can specify a region (the rectangle rect) that the drawing must fit (exactly or approximately) with the dimensions of the rectangle being given in the manager view coordinates:
void IlvGraphLayout::setLayoutRegion(IlvView* view, const IlvRect& rect)
*You can specify a region (the rectangle rect) that the drawing must fit (exactly or approximately) with the dimensions of the rectangle being given in manager (or grapher) coordinates:
void IlvGraphLayout::setLayoutRegion(const IlvRect& rect)
You must use the last method if you want to perform the layout with no manager view attached to the grapher or if you want to define the layout region in manager coordinates.
You can obtain the rectangle that defines the current layout region using the method:
void IlvGraphLayout::getLayoutRegion (IlvRect& rect) const
This method returns a copy of the rectangle that the graph drawing must fit (exactly or approximately). The dimensions of the rectangle are in the manager (grapher) coordinates. Depending on the last method you called, one of the following cases can occur:
*If IlvGraphLayout::setLayoutRegion(const IlvRect&) was the last method called, it returns the rectangle with no transformation.
*If IlvGraphLayout::setLayoutRegion(IlvView*, const IlvRect&) was the last method called, it returns the rectangle transformed to the manager coordinates (using the transformer of the view).
*If IlvGraphLayout::setLayoutRegion(IlvView*) was the last method called, it returns a rectangle with the attributes x=0, y=0. The attributes, width and height, are equal to the current width and height of the view transformed to the manager coordinates (using the transformer of the view).
*None of the methods was called. (This is the default behavior.) If at least one manager view is attached to the grapher, it returns a rectangle with the attributes x=0, y=0. The width and height are equal to the current width and height of the first attached view, transformed to the manager coordinates (using the transformer of the view). If no view is attached, it returns an empty rectangle.
To indicate whether a subclass of IlvGraphLayout supports the layout region mechanism, the following method is provided:
IlBoolean supportsLayoutRegion() const
The default implementation returns IlFalse. A subclass can override this method in order to return IlTrue to indicate that this mechanism is supported.
Note that if you are performing the layout using the default settings, there must be at least one manager view (an instance of IlvView*) attached to the grapher.

Version 6.0
Copyright © 2015, Rogue Wave Software, Inc. All Rights Reserved.