| The Essential JViews Framework > Graphic Objects > Geometric Properties > The boundingBox Method |
The boundingBox Method |
INDEX
PREVIOUS
NEXT
|
The bounding box defines the smallest rectangle encompassing the graphic object. It is returned by the following method:
public IlvRect boundingBox(IlvTransformer t)
The IlvTransformer parameter is the 2D transformation matrix used to draw the object in a particular drawing port (see transformer). This transformation may correspond to a zoom, a rotation, or a translation of the graphic object in the destination drawing port. The method must then return the rectangle that contains the graphic object when it is drawn using the specified transformation.
The following example defines the shape of a graphic object with the drawrect field. In order to return the bounding box of the object, the boundingBox method simply applies the transformer to the rectangle:
The method boundingBox is a very important method. Since it is called very frequently, it must be written in a highly optimized way.
| Note |
For the MyRectangle class to compile correctly you need to overload the draw, copy and applyTransform methods. For an example of how this is done, see Creating a New Graphic Object Class.
|
| Copyright © 1987-2007 ILOG S.A. All rights reserved. Documentation homepage. Legal terms. | PREVIOUS NEXT |