CGM Class Reference

CGM -- Computer Graphics Metafile reader. More...

#include <mi32/cgm.h>

List of all members.

Public Types

enum  ASF { ASF_INDIVIDUAL = 0, ASF_BUNDLED }
enum  CLIPMODE { CLIPMODE_NONE, CLIPMODE_LOCUS, CLIPMODE_SHAPE, CLIPMODE_LOCUSTHENSHAPE }
enum  COLORMODE { COLORMODE_INDEXED, COLORMODE_DIRECT }
enum  COLORMODEL { COLORMODEL_RGB, COLORMODEL_CMYK }
enum  INTERIORSTYLE {
  INTERIORSTYLE_HOLLOW, INTERIORSTYLE_SOLID, INTERIORSTYLE_PATTERN, INTERIORSTYLE_HATCH,
  INTERIORSTYLE_EMPTY, INTERIORSTYLE_GEOMETRIC, INTERIORSTYLE_INTERPOLATED
}
enum  LINECAP {
  LINECAP_UNSPECIFIED = 1, LINECAP_BUTT, LINECAP_ROUND, LINECAP_PROJECTING,
  LINECAP_TRIANGLE
}
enum  LINECONT { LINECONT_UNSPECIFIED = 1, LINECONT_CONTINUE, LINECONT_RESTART, LINECONT_ADAPTIVE }
enum  LINEJOIN { LINEJOIN_UNSPECIFIED = 1, LINEJOIN_MITRE, LINEJOIN_ROUND, LINEJOIN_BEVEL }
enum  LINETYPE {
  LINETYPE_SOLID = 1, LINETYPE_DASH, LINETYPE_DOT, LINETYPE_DASH_DOT,
  LINETYPE_DASH_DOT_DOT
}
enum  MARKERTYPE {
  MARKERTYPE_DOT = 1, MARKERTYPE_PLUS, MARKERTYPE_ASTERISK, MARKERTYPE_CIRCLE,
  MARKERTYPE_EX
}
enum  REALMODE { REALMODE_FIXED = 0, REALMODE_FP }
enum  SCALEMODE { SCALEMODE_ABSTRACT = 0, SCALEMODE_METRIC }
enum  SIZEMODE { SIZEMODE_ABSOLUTE = 0, SIZEMODE_SCALED, SIZEMODE_FRACTIONAL, SIZEMODE_MM }
enum  TEXTALIGNMENT {
  TEXTALIGNMENT_NORMAL, TEXTALIGNMENT_LEFT, TEXTALIGNMENT_CENTER, TEXTALIGNMENT_RIGHT,
  TEXTALIGNMENT_CONTINUOUS, TEXTALIGNMENT_TOP, TEXTALIGNMENT_CAP, TEXTALIGNMENT_HALF,
  TEXTALIGNMENT_BASE, TEXTALIGNMENT_BOTTOM
}
enum  TEXTPATH { TEXTPATH_LEFT, TEXTPATH_RIGHT, TEXTPATH_UP, TEXTPATH_DOWN }
enum  TEXTPRECISION { TEXTPRECISION_STRING, TEXTPRECISION_CHARACTER, STROKE }
enum  VDCTYPE { VDCTYPE_INTEGER, VDCTYPE_REAL }
enum  VIEWPORTSPECMODE { VIEWPORTSPECMODE_FractionOfDrawingSurface, VIEWPORTSPECMODE_MMWithScaleFactor, VIEWPORTSPECMODE_DeviceCoordinates }

Public Member Functions

 CGM ()
void GetExtents (DRECT2D &rect) const
int ReadFile (const MIUNICODE *fname)
int Render ()
void SetTransAffine (const TRANS2D_AFFINE &trans)
void SetTransAffine (const Mat3x3 forward, const Mat3x3 inverse)
virtual ~CGM ()

Protected Member Functions

const PRIMITIVECONTEXTGetPC ()
virtual int RenderArc (const DPOINT2D &center, double StartAngle, double EndAngle, double radius, int CloseMethod)
virtual int RenderBezier (int NumPts, DPOINT2D *cpoints, bool bContinuous)
virtual int RenderBSpline (int order, int NumPts, const DPOINT2D *cpoints, const double *knots, const double *weights, double Start, double End)
virtual int RenderCircle (const DPOINT2D &center, double radius)
virtual int RenderEArc (const DPOINT2D &center, const DPOINT2D &EndPoint1, const DPOINT2D &EndPoint2, double StartAngle, double EndAngle, int CloseMethod)
virtual int RenderEArc (const DPOINT2D &center, double StartAngle, double EndAngle, double xradius, double yradius, double RotAngle, int CloseMethod)
virtual int RenderEllipse (const DPOINT2D &center, const DPOINT2D &EndPoint1, const DPOINT2D &EndPoint2)
virtual int RenderEllipse (const DPOINT2D &center, double xradius, double yradius, double RotAngle)
virtual int RenderLine (const DPOINT2D &start, const DPOINT2D &end)
virtual int RenderMarker (const DPOINT2D &point)
virtual int RenderPolygon (const DPOINT2D *points, int NumPoints)
virtual int RenderPolygons (const DPOLYGON *polys, int NumPolys)
virtual int RenderPolyline (const DPOINT2D *points, int NumPoints)
virtual int RenderRectangle (const DRECT2D &rect)
virtual int RenderRectangle (const DPOINT2D *points)
virtual int RenderText (const DPOINT2D &basept, const TEXTSTYLE &style, const STYLEEXTRA &extra, const MIUNICODE *str)
virtual int SetLineStyle (const LINESTYLE &style, const STYLEEXTRA &extra)
virtual int SetPointStyle (const POINTSTYLE &style, const STYLEEXTRA &extra)
virtual int SetPolyStyle (const POLYSTYLE &style, const STYLEEXTRA &extra)
virtual int SetTextStyle (const TEXTSTYLE &style, const STYLEEXTRA &extra)

Classes

struct  PRIMITIVECONTEXT
struct  STYLEEXTRA
 The style information that doesn't eaisly fit into POINTSTYLE, etc. More...


Detailed Description

CGM -- 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.

Definition at line 201 of file cgm.h.


Member Enumeration Documentation

enum CGM::ASF

Enumerator:
ASF_INDIVIDUAL  Aspect Source Flags.
ASF_BUNDLED 

Definition at line 205 of file cgm.h.

enum CGM::CLIPMODE

Enumerator:
CLIPMODE_NONE 
CLIPMODE_LOCUS  Hide whole element if centroid outside clip region.
CLIPMODE_SHAPE  Clip element to clip region.
CLIPMODE_LOCUSTHENSHAPE 

Definition at line 220 of file cgm.h.

enum CGM::COLORMODE

Enumerator:
COLORMODE_INDEXED 
COLORMODE_DIRECT 

Definition at line 232 of file cgm.h.

enum CGM::COLORMODEL

Enumerator:
COLORMODEL_RGB  XXX Need real values.
COLORMODEL_CMYK 

Definition at line 227 of file cgm.h.

enum CGM::INTERIORSTYLE

Enumerator:
INTERIORSTYLE_HOLLOW 
INTERIORSTYLE_SOLID 
INTERIORSTYLE_PATTERN 
INTERIORSTYLE_HATCH 
INTERIORSTYLE_EMPTY 
INTERIORSTYLE_GEOMETRIC 
INTERIORSTYLE_INTERPOLATED 

Definition at line 237 of file cgm.h.

enum CGM::LINECAP

Enumerator:
LINECAP_UNSPECIFIED  XXX Need real values.
LINECAP_BUTT 
LINECAP_ROUND 
LINECAP_PROJECTING 
LINECAP_TRIANGLE 

Definition at line 255 of file cgm.h.

enum CGM::LINECONT

Enumerator:
LINECONT_UNSPECIFIED 
LINECONT_CONTINUE 
LINECONT_RESTART 
LINECONT_ADAPTIVE 

Definition at line 270 of file cgm.h.

enum CGM::LINEJOIN

Enumerator:
LINEJOIN_UNSPECIFIED  XXX Need real values.
LINEJOIN_MITRE 
LINEJOIN_ROUND 
LINEJOIN_BEVEL 

Definition at line 263 of file cgm.h.

enum CGM::LINETYPE

Enumerator:
LINETYPE_SOLID 
LINETYPE_DASH 
LINETYPE_DOT 
LINETYPE_DASH_DOT 
LINETYPE_DASH_DOT_DOT 

Definition at line 247 of file cgm.h.

enum CGM::MARKERTYPE

Enumerator:
MARKERTYPE_DOT 
MARKERTYPE_PLUS 
MARKERTYPE_ASTERISK 
MARKERTYPE_CIRCLE 
MARKERTYPE_EX  Values above 5 are reserved for registration and future standardization.

Definition at line 277 of file cgm.h.

enum CGM::REALMODE

Enumerator:
REALMODE_FIXED 
REALMODE_FP 

Definition at line 215 of file cgm.h.

enum CGM::SCALEMODE

Enumerator:
SCALEMODE_ABSTRACT 
SCALEMODE_METRIC 

Definition at line 314 of file cgm.h.

enum CGM::SIZEMODE

Enumerator:
SIZEMODE_ABSOLUTE 
SIZEMODE_SCALED 
SIZEMODE_FRACTIONAL 
SIZEMODE_MM 

Definition at line 319 of file cgm.h.

enum CGM::TEXTALIGNMENT

Enumerator:
TEXTALIGNMENT_NORMAL 
TEXTALIGNMENT_LEFT  For Horizontal alignment only.
TEXTALIGNMENT_CENTER  For Horizontal alignment only.
TEXTALIGNMENT_RIGHT  For Horizontal alignment only.
TEXTALIGNMENT_CONTINUOUS 
TEXTALIGNMENT_TOP  For Vertical alignment only.
TEXTALIGNMENT_CAP  For vertical alignment only.
TEXTALIGNMENT_HALF  For vertical alignment only.
TEXTALIGNMENT_BASE  For vertical alignment only.
TEXTALIGNMENT_BOTTOM  For vertical alignment only.

Definition at line 287 of file cgm.h.

enum CGM::TEXTPATH

Enumerator:
TEXTPATH_LEFT 
TEXTPATH_RIGHT 
TEXTPATH_UP 
TEXTPATH_DOWN 

Definition at line 300 of file cgm.h.

enum CGM::TEXTPRECISION

Indicates how text is clipped and how accurate placement is.

Enumerator:
TEXTPRECISION_STRING  Ignores intracharacter spacing.
TEXTPRECISION_CHARACTER 
STROKE 

Definition at line 308 of file cgm.h.

enum CGM::VDCTYPE

Enumerator:
VDCTYPE_INTEGER 
VDCTYPE_REAL 

Definition at line 210 of file cgm.h.

enum CGM::VIEWPORTSPECMODE

Enumerator:
VIEWPORTSPECMODE_FractionOfDrawingSurface 
VIEWPORTSPECMODE_MMWithScaleFactor 
VIEWPORTSPECMODE_DeviceCoordinates 

Definition at line 326 of file cgm.h.


Constructor & Destructor Documentation

CGM::CGM (  ) 

Constructor.

The constructor only clears the structure.

virtual CGM::~CGM (  )  [virtual]


Member Function Documentation

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.

Definition at line 351 of file cgm.h.

const PRIMITIVECONTEXT& CGM::GetPC (  )  [inline, protected]

Return the current Primitive Context.

Definition at line 514 of file cgm.h.

int CGM::ReadFile ( const MIUNICODE 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.

virtual int CGM::RenderArc ( const DPOINT2D center,
double  StartAngle,
double  EndAngle,
double  radius,
int  CloseMethod 
) [protected, virtual]

Draw a circular arc.

If not implemented by the derived class, the default is to convert the arc to a bunch of points and call RenderPolyline() or RenderPolygon (depending on CloseMethod)

Parameters:
CloseMethod  0 = none, 1 = pie, 2 = chord

virtual int CGM::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::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()

Parameters:
cpoints  Control points (NumPts of them)
knots  Array of (NumPts + order) knots
weights  Array of (NumPts weights) (may be NULL)

virtual int CGM::RenderCircle ( const DPOINT2D center,
double  radius 
) [protected, virtual]

Draw a circle.

If not implemented by the derived class, the default is to convert the circle to a bunch of points and call RenderPolygon()

virtual int CGM::RenderEArc ( const DPOINT2D center,
const DPOINT2D EndPoint1,
const DPOINT2D EndPoint2,
double  StartAngle,
double  EndAngle,
int  CloseMethod 
) [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 RenderEArc (for the non-shear case or will convert the arc to a polyline and call RenderPolyline or RenderPolygon (to if closed)

Parameters:
CloseMethod  0 = none, 1 = pie, 2 = chord

virtual int CGM::RenderEArc ( const DPOINT2D center,
double  StartAngle,
double  EndAngle,
double  xradius,
double  yradius,
double  RotAngle,
int  CloseMethod 
) [protected, virtual]

Render an Elliptical Arc (Simple Case).

If not implemented by the derived class, the default is to convert the arc to a bunch of points and call RenderPolyline() or RenderPolygon (depending on CloseMethod)

Parameters:
CloseMethod  0 = none, 1 = pie, 2 = chord

virtual int CGM::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::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 convert the ellipse to a bunch of points and call RenderPolygon()

virtual int CGM::RenderLine ( const DPOINT2D start,
const DPOINT2D end 
) [protected, virtual]

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::RenderMarker ( const DPOINT2D point  )  [protected, virtual]

Draw a marker (point).

virtual int CGM::RenderPolygon ( const DPOINT2D points,
int  NumPoints 
) [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::RenderPolygons ( const DPOLYGON polys,
int  NumPolys 
) [protected, virtual]

Render multiple polygons (with islands).

virtual int CGM::RenderPolyline ( const DPOINT2D points,
int  NumPoints 
) [protected, virtual]

Draw a multi-point line.

virtual int CGM::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::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::RenderText ( const DPOINT2D basept,
const TEXTSTYLE style,
const STYLEEXTRA extra,
const MIUNICODE str 
) [protected, virtual]

Render text.

virtual int CGM::SetLineStyle ( const LINESTYLE style,
const STYLEEXTRA extra 
) [inline, protected, virtual]

Set line style.

Called whenever something about the current line style changes.

Definition at line 711 of file cgm.h.

virtual int CGM::SetPointStyle ( const POINTSTYLE style,
const STYLEEXTRA extra 
) [inline, protected, virtual]

Set point style.

Called whenever something about the current point style changes.

Definition at line 701 of file cgm.h.

virtual int CGM::SetPolyStyle ( const POLYSTYLE style,
const STYLEEXTRA extra 
) [inline, protected, virtual]

Set polygon style.

Called whenever something about the current polygon style changes.

Definition at line 721 of file cgm.h.

virtual int CGM::SetTextStyle ( const TEXTSTYLE style,
const STYLEEXTRA extra 
) [inline, protected, virtual]

Set text style.

Called whenever something about the current text style changes.

Definition at line 731 of file cgm.h.

void CGM::SetTransAffine ( const TRANS2D_AFFINE trans  ) 

Set the affine transformation.

void CGM::SetTransAffine ( const Mat3x3  forward,
const Mat3x3  inverse 
)

Set the affine transformation.


The documentation for this class was generated from the following file:
Generated on Thu Apr 26 04:47:00 2007 for TNTsdk by  doxygen 1.5.2