### Implementing IGraphicGroup

IGraphicGroup is implemented as a simple sequence list of graphic objects. It offers functions for inserting and removing items from the list, much like the functionality of the underlying collection classes. The more complex methods use the IGraphicIterator facility:

These methods include:

> void adoptFirst (IMGraphic *)
> void adoptLast (IMGraphic *);

> virtual void orphan (const IMGraphic *);
> IMGraphic* orphanFirst();
> IMGraphic* orphanLast();

IGraphicGroup has adopt and orphan semantics clearly sending the message that an IGraphicGroup owns all its children and the caller should not hold on to pointers outside this class. Member function adoptLast adopts the IMGraphic and puts it at the end of the collection while adoptFirst puts it in the beginning of the collection.

An instance of IGraphicGroupIterator is created by calling member function createIterator on an IMGraphic.

### Finding the Bounds of an IGraphicGroup

IGraphicGroup inherits the looseFitBounds and geometricBounds functions from IMGraphic described in "2D Graphics Framework." When you call one of these functions on a group, the appropriate bounds are returned for the entire group.

If you want to find the bounds on a nested group or graphic within the group, you have to use an iterator to locate the graphic or nested group that has been selected. To do this, call the IGraphicGroup::createIterator function that returns a IGraphicIterator instance. IGraphicIterator is an abstract base class, and by default createIterator creates a shallow iterator that iterates one level of the group.

Computing Bounds