Canvas representation

A GrafEdit program has one canvas representation (MCanvasRepresentation) to collect the canvas graphics in the program. MCanvasRepresentation is completely abstract with all pure virtual functions. It provides an interface upon which other GrafEdit classes depend. MCanvasRepresentation owns canvas graphics and has functions for ordering, counting, reading, writing, and iteration. The iterator classes, TCanvasGraphicReadIterator and TCanvasGraphicWriteIterator, are also abstract base classes that must be derived parallel to the MCanvasRepresentation derived classes.

As shown in Figure 30, TStandardCanvasModel derives from MCanvasRepresentation and TModel. Mixing MCanvasRepresentation with TModel allows TStandardCanvasModel to store its data in a Compound Document framework model. Internally, TStandardCanvasModel maintains graphic objects in an ordered list from front to back (TCanvasGraphicDeque). TCanvasGraphicDeque uses a dictionary to quickly cross-reference canvas Graphic IDs to canvas graphic pointers for efficient ID lookup. The purpose and use of canvas graphic IDs are described in the following sections.


NOTE If you do not need a Compound Document framework program, you can use the TCanvasGraphicDeque class directly to store your data. TCanvasGraphicDeque descends from MGraphicRepresentation and stores the data in a list without using a model.


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker