Computer Graphics Metafile reader. More...
#include <mi32/cgm.h>
Computer Graphics Metafile reader.
This is meant to be a base class. There are a number of protected virtual methods for actually "rendering" the CGM object.
This class is NOT for writing CGM files.
| enum CGM::ASF |
| enum CGM::CLIPMODE |
| enum CGM::COLORMODE |
| enum CGM::COLORMODEL |
| enum CGM::INTERIORSTYLE |
| enum CGM::LINECAP |
| enum CGM::LINECONT |
| enum CGM::LINEJOIN |
| enum CGM::LINETYPE |
| enum CGM::MARKERTYPE |
| enum CGM::REALMODE |
| enum CGM::SCALEMODE |
| enum CGM::SIZEMODE |
| enum CGM::TEXTALIGNMENT |
| enum CGM::TEXTPATH |
| enum CGM::TEXTPRECISION |
| enum CGM::VDCTYPE |
| CGM::CGM | ( | ) |
Constructor.
The constructor only clears the structure.
| virtual CGM::~CGM | ( | ) | [virtual] |
| void CGM::GetExtents | ( | DRECT2D & | rect | ) | const [inline] |
Return the VDC (Virtual Device Context?) extents.
It should be noted that CGM files set this themselves. It is not computed based on the elements in the file. If the CGM file fails to set it, the default is 0 to 32767 in both directions. It should also be obvious that the extents are only valid after calling ReadFile(). before that time, this function will return the default extents.
| const PRIMITIVECONTEXT& CGM::GetPC | ( | ) | [inline, protected] |
Return the current Primitive Context.
| int CGM::ReadFile | ( | const FILEPATH & | fname | ) |
Opens a CGM file and reads it into an internal buffer and parses it.
| int CGM::Render | ( | ) |
Render the CGM data.
The actual rendering is done by the protected virutal methods of a derived class.
| void CGM::SetTransAffine | ( | const TRANS2D_AFFINE & | trans | ) |
Set the affine transformation.
Set the affine transformation.
| virtual int CGM::v_RenderBezier | ( | int | NumPts, | |
| DPOINT2D * | cpoints, | |||
| bool | bContinuous | |||
| ) | [protected, virtual] |
Render a Bezier curve.
If not overloaded by the derived class, the default method will convert the curve to points can call RenderPolyline()
| virtual int CGM::v_RenderBSpline | ( | int | order, | |
| int | NumPts, | |||
| const DPOINT2D * | cpoints, | |||
| const double * | knots, | |||
| const double * | weights, | |||
| double | Start, | |||
| double | End | |||
| ) | [protected, virtual] |
Render a B-Spline.
If not overloaded by the derived class, the default method will convert the curve to points can call RenderPolyline()
| cpoints | Control points (NumPts of them) | |
| knots | Array of (NumPts + order) knots | |
| weights | Array of (NumPts weights) (may be NULL) |
| virtual int CGM::v_RenderCircle | ( | const DPOINT2D & | center, | |
| double | radius | |||
| ) | [protected, virtual] |
Draw a circle.
If not implemented by the derived class, the default is to call v_RenderConic
| virtual int CGM::v_RenderConic | ( | const PLANECONIC & | conic | ) | [protected, virtual] |
Draw a circular arc.
If not implemented by the derived class, the default is to convert the conic to a line and call v_RenderPolyline or v_RenderPolygon
| virtual int CGM::v_RenderEllipse | ( | const DPOINT2D & | center, | |
| const DPOINT2D & | EndPoint1, | |||
| const DPOINT2D & | EndPoint2 | |||
| ) | [protected, virtual] |
Render an Elliptical Arc (General Case).
This method takes exactly what CGM gives us. Instead of two radii and a rotation angle, they give the endpoints of where the axes intersect the ellipse. Note This gives the possibility of shear angle too. Ick!
Override this method only if you are writing to a format that wants this weird format. The default method will call either the other RenderEllipse (for the non-shear case or will convert the ellipse to a polygon and call RenderPolygon
| virtual int CGM::v_RenderEllipse | ( | const DPOINT2D & | center, | |
| double | xradius, | |||
| double | yradius, | |||
| double | RotAngle | |||
| ) | [protected, virtual] |
Render an Ellipse (Simple Case).
If not implemented by the derived class, the default is to call v_RenderConic unless there's a lot of shear, in which case it will convert it to polygon and call v_RenderPolygon
Draw a 2-point line.
If not overloaded by the derived class, the default method just calls RenderPolyline with a 2-point line.
| virtual int CGM::v_RenderMarker | ( | const DPOINT2D & | point | ) | [protected, virtual] |
Draw a marker (point).
| virtual int CGM::v_RenderPolygon | ( | const POLYLINE & | polygon | ) | [protected, virtual] |
Draw a closed polygon.
If not overloaded by the derived class, the default method just calls RenderPolygons() with one polygon.
| virtual int CGM::v_RenderPolygons | ( | const POLYLINELIST & | polygons | ) | [protected, virtual] |
Render multiple polygons (with islands).
| virtual int CGM::v_RenderPolyline | ( | const POLYLINE & | line | ) | [protected, virtual] |
Draw a multi-point line.
| virtual int CGM::v_RenderRectangle | ( | const DRECT2D & | rect | ) | [protected, virtual] |
Draw a rectangle (no rotation).
If the current affine transformation has no rotation, this method will be called to render rectangles, since it can be much faster. If not overloaded, the default method will call the other RenderRectangle() method, so implementing this one is optional.
| virtual int CGM::v_RenderRectangle | ( | const DPOINT2D * | points | ) | [protected, virtual] |
Draw a rectangle.
Points will be in the order...
0 1
3 2
For convinence, you will actually be passed 5 points, and points[4] == points[0]. If not overloaded by the derived class, the default method will call RenderPolygon.
| virtual int CGM::v_RenderText | ( | const DPOINT2D & | basept, | |
| const TEXTSTYLE & | style, | |||
| const STYLEEXTRA & | extra, | |||
| const MIUNICODE * | str | |||
| ) | [protected, virtual] |
Render text.
| virtual int CGM::v_SetLineStyle | ( | const LINESTYLE & | style, | |
| const STYLEEXTRA & | extra | |||
| ) | [protected, virtual] |
Set line style.
Called whenever something about the current line style changes.
| virtual int CGM::v_SetPointStyle | ( | const POINTSTYLE & | style, | |
| const STYLEEXTRA & | extra | |||
| ) | [protected, virtual] |
Set point style.
Called whenever something about the current point style changes.
| virtual int CGM::v_SetPolyStyle | ( | const POLYSTYLE & | style, | |
| const STYLEEXTRA & | extra | |||
| ) | [protected, virtual] |
Set polygon style.
Called whenever something about the current polygon style changes.
| virtual int CGM::v_SetTextStyle | ( | const TEXTSTYLE & | style, | |
| const STYLEEXTRA & | extra | |||
| ) | [protected, virtual] |
Set text style.
Called whenever something about the current text style changes.
1.6.1