CGM Class Reference

Computer Graphics Metafile reader. More...

#include <mi32/cgm.h>

List of all members.

Classes

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

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 ()
virtual ~CGM ()
void GetExtents (DRECT2D &rect) const
int ReadFile (const FILEPATH &fname)
int Render ()
void SetTransAffine (const TRANS2D_AFFINE &trans)
void SetTransAffine (const MAT3X3 forward, const MAT3X3 inverse)

Protected Member Functions

const PRIMITIVECONTEXTGetPC ()
virtual int v_RenderBezier (int NumPts, DPOINT2D *cpoints, bool bContinuous)
virtual int v_RenderBSpline (int order, int NumPts, const DPOINT2D *cpoints, const double *knots, const double *weights, double Start, double End)
virtual int v_RenderCircle (const DPOINT2D &center, double radius)
virtual int v_RenderConic (const PLANECONIC &conic)
virtual int v_RenderEllipse (const DPOINT2D &center, const DPOINT2D &EndPoint1, const DPOINT2D &EndPoint2)
virtual int v_RenderEllipse (const DPOINT2D &center, double xradius, double yradius, double RotAngle)
virtual int v_RenderLine (const DPOINT2D &start, const DPOINT2D &end)
virtual int v_RenderMarker (const DPOINT2D &point)
virtual int v_RenderPolygon (const POLYLINE &polygon)
virtual int v_RenderPolygons (const POLYLINELIST &polygons)
virtual int v_RenderPolyline (const POLYLINE &line)
virtual int v_RenderRectangle (const DRECT2D &rect)
virtual int v_RenderRectangle (const DPOINT2D *points)
virtual int v_RenderText (const DPOINT2D &basept, const TEXTSTYLE &style, const STYLEEXTRA &extra, const MIUNICODE *str)
virtual int v_SetLineStyle (const LINESTYLE &style, const STYLEEXTRA &extra)
virtual int v_SetPointStyle (const POINTSTYLE &style, const STYLEEXTRA &extra)
virtual int v_SetPolyStyle (const POLYSTYLE &style, const STYLEEXTRA &extra)
virtual int v_SetTextStyle (const TEXTSTYLE &style, const STYLEEXTRA &extra)

Detailed Description

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.


Member Enumeration Documentation

enum CGM::ASF
Enumerator:
ASF_INDIVIDUAL 

Aspect Source Flags.

ASF_BUNDLED 
Enumerator:
CLIPMODE_NONE 
CLIPMODE_LOCUS 

Hide whole element if centroid outside clip region.

CLIPMODE_SHAPE 

Clip element to clip region.

CLIPMODE_LOCUSTHENSHAPE 
Enumerator:
COLORMODE_INDEXED 
COLORMODE_DIRECT 
Enumerator:
COLORMODEL_RGB 

XXX Need real values.

COLORMODEL_CMYK 
Enumerator:
INTERIORSTYLE_HOLLOW 
INTERIORSTYLE_SOLID 
INTERIORSTYLE_PATTERN 
INTERIORSTYLE_HATCH 
INTERIORSTYLE_EMPTY 
INTERIORSTYLE_GEOMETRIC 
INTERIORSTYLE_INTERPOLATED 
Enumerator:
LINECAP_UNSPECIFIED 

XXX Need real values.

LINECAP_BUTT 
LINECAP_ROUND 
LINECAP_PROJECTING 
LINECAP_TRIANGLE 
Enumerator:
LINECONT_UNSPECIFIED 
LINECONT_CONTINUE 
LINECONT_RESTART 
LINECONT_ADAPTIVE 
Enumerator:
LINEJOIN_UNSPECIFIED 

XXX Need real values.

LINEJOIN_MITRE 
LINEJOIN_ROUND 
LINEJOIN_BEVEL 
Enumerator:
LINETYPE_SOLID 
LINETYPE_DASH 
LINETYPE_DOT 
LINETYPE_DASH_DOT 
LINETYPE_DASH_DOT_DOT 
Enumerator:
MARKERTYPE_DOT 
MARKERTYPE_PLUS 
MARKERTYPE_ASTERISK 
MARKERTYPE_CIRCLE 
MARKERTYPE_EX 

Values above 5 are reserved for registration and future standardization.

Enumerator:
REALMODE_FIXED 
REALMODE_FP 
Enumerator:
SCALEMODE_ABSTRACT 
SCALEMODE_METRIC 
Enumerator:
SIZEMODE_ABSOLUTE 
SIZEMODE_SCALED 
SIZEMODE_FRACTIONAL 
SIZEMODE_MM 
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.

Enumerator:
TEXTPATH_LEFT 
TEXTPATH_RIGHT 
TEXTPATH_UP 
TEXTPATH_DOWN 

Indicates how text is clipped and how accurate placement is.

Enumerator:
TEXTPRECISION_STRING 

Ignores intracharacter spacing.

TEXTPRECISION_CHARACTER 
STROKE 
Enumerator:
VDCTYPE_INTEGER 
VDCTYPE_REAL 
Enumerator:
VIEWPORTSPECMODE_FractionOfDrawingSurface 
VIEWPORTSPECMODE_MMWithScaleFactor 
VIEWPORTSPECMODE_DeviceCoordinates 

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.

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.

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

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()

Parameters:
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

virtual int CGM::v_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::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.


The documentation for this class was generated from the following file:

Generated on Sun Oct 7 21:33:15 2012 for TNTsdk 2012 by  doxygen 1.6.1