Objective Chart : PART I User’s Guide : Chapter 3 Design Overview of Objective Chart : Utility Classes
Utility Classes
Objective Chart uses a variety of MFC extension classes for internal purposes. These classes may be helpful in other parts of your applications.
SRGCompiledPolygon
SRGRect
SRGraphException
CObStack
SRGCompiledPolygon
Many of the objects drawn in Objective Chart are constructed from polygonal forms. These forms are specified using simply formatted text, so they can be easily constructed, either by hand or by software. Forms can be stored in disk files or in the application resources. To load these polygons, interpret them, and discard them after use is inefficient, particularly if there are many polygons on a chart. Therefore, once loaded, the polygons are stored in a compiled form using floating point coordinates for efficient access.
Whenever a polygonal shape is requested, the component attempts to find the shape in its own list of compiled polygons. If it exists, the compiled shape is used. If it does not exist, then the shape is loaded and compiled. The compiled polygon is passed back to the component for current use and stored for later reuse.
SRGCompiledPolygon allows a single polygonal shape to be stretched or scaled many times without degradation due to math errors. This class is also responsible for sizing the polygons used to draw pictographs. A pictograph is a small bitmap image that can be used to fill bars or wigets in a chart. The Gingerbread Man bitmap (gbm.bmp) with its polygonal outline (gbm.ply) is an example of a pictograph that is included in the Objective Chart resources (extra.rc).
You will probably never need to directly access SRGCompiledPolygon’s functions or extend its capabilities. However, you should be aware of its role in displaying objects that you create.
SRGRect
SRGRect is a rectangle class with floating point coordinates. It uses double precision values to define the top, left, right, and bottom edges of a rectangle similar to the parameters of a CRect object. SRGraphRect may be used in multiple modes to implement a device-independent measurement system.
In its most basic mode, SRGraphRect stores data as direct pixel information, like CRect. However, the same class can store data in inches, millimeters, or percentages of client area.
SRGraphException
An exception class is provided for Objective Chart. You may use this class to trap and modify exceptions in the normal way. A comprehensive exception message system is provided in the class. String tables and texts clarifying the exception types are available in SRGres.rc.
CObStack
This simple derivation of the CObList class has push and pop functions that allow it to be used as a First In-Last Out stack.
Objective Chart uses this class to store and recover multiple graphic clipping regions. Also, the SRGraphView class maintains a zoom stack using this object. These features allow multiple data zoom operations to be layered.