Foundation > Containers > Displaying Containers
 
Displaying Containers
The member functions for displaying containers are described in:
*Drawing Member Functions
*Geometric Transformations
*Managing Double Buffering
*Reading Objects from Disk
Drawing Member Functions
Although the member functions draw and reDraw are inherited from the parent IlvDrawingView class, they interact in a specific way with containers. Following is a list of these specific member functions:
*draw  is used to draw all IlvGraphic objects stored in the IlvContainer object. When you add an object to a container, calling this method is sufficient. Two virtual member functions allow the user to draw at any destination port with any transformer, and with a clipping region specified.
*reDraw  If you need to refresh your working area (for example, when an object is translated), use this method, which erases the specified clipping region before calling the draw method.
*reDrawObj  When applied to a graphic object, redraws the object’s bounding box.
*bufferedDraw  Performs a temporary drawing in a hidden pixmap, then displays the pixmap on the screen at once. It is different from double buffering in that the operation is localized to a rectangle, a region, or an object, and lasts only as long as the drawing operation.
One function draws the area included in the specified IlvRect object and another draws the area included in the specified IlvRegion object. Both of them draw in the coordinate system of the container. The third form draws the specified IlvGraphic object in the coordinate system of the object.
Geometric Transformations
Several member functions deal with geometric transformations applied to the container view, that is, they handle the IlvTransformer object associated with the view.
*getTransformer  Returns the transformer associated with the container view. If 0 is returned, this container has no transformer, that is, there is identity between the object and its display.
*setTransformer  Sets the specified transformer parameter.
*addTransformer  Sets up the current transformer with the one given as a parameter, and sets the resulting transformer as the new current one.
*translateView and zoomView  Sets up the current transformer with, respectively, a translation transformer and a zooming transformer.
*fitToContents  Resizes the container view so that its bounding box exactly fits around all the objects that have the visibility attribute set to IlTrue. The top-left coordinates of the view remain at the same location. This method is typically used when the container reads a set of IlvGraphic objects from a file, without knowing their positions beforehand:
IlvRect size(0, 0, 300, 300);
IlvContainer* cont = new IlvContainer(display, "Cont", "My Window",
size, IlTrue, IlFalse);
cont->readFile("myfile.ilv");
cont->fitToContents();
*fitTransformerToContents  Computes a new transformer so that all objects that have the visibility attribute set to IlTrue can be seen in the view. The container view size does not change. A call to IlvDrawingView::reDraw is issued if the IlBoolean argument is set to IlTrue. This method is typically used when the user wants to have a global look at a map after zooming it several times:
static void
ShowAllMap(IlvContainer* container)
{
container->fitTransformerToContents(IlTrue);
}
Managing Double Buffering
The double buffering mode enables animated displays or displays with numerous objects to appear without flickering. This mode is handled by the following member functions:
*setDoubleBuffering  Indicates whether or not the container should use double buffering.
*isDoubleBuffering  Informs as to whether double buffering is or is not in use.
Reading Objects from Disk
Two member functions exist for reading objects from disk:
*readFile  Reads from a file whose name is specified as a parameter.
*read  Reads from the input stream specified as a parameter.
Both these member functions return the result of their reading: IlTrue if successful, IlFalse if an error occurred.
Note: Containers do not have any write member functions to save their contents as do managers. For details on managers, see the Managers documentation.

Version 6.1
Copyright © 2016, Rogue Wave Software, Inc. All Rights Reserved.