CODRgn Class

class CODRgn

A region object defines a shape or area as a set of polygons. The mesh of polygons maintained by the region is useful for calculating the bounding rectangle of complex objects and also for hit testing. Curves are translated into regions by approximating them as polygons.

Defined in: OdRgn.h

Class Members

 CODRgn()

Constructor.

 CODRgn(const CODRgn& rgn)

Copy constructor.

virtual  ~CODRgn()

Destructor.

void  CreateLineRgn(LPPOINT lpPoints, int nCount)

Create the region from a polyline.

void  CreatePolygonRgn(LPPOINT lpPoints, int nCount)

Create the region from a polygon.

void  CreateCurveRgn(LPPOINT lpPoints, int nCount)

Create the region from a curve.

void  CreateClosedCurveRgn(LPPOINT lpPoints, int nCount)

Create the region from a closed curve.

CRect m_rcBounds

Bounding rectangle defined by the region.

CODPointArray* m_pApprox

Points used to convert a curve to a set of polygons.

CArray&ltCODPolygonRgn, const CODPolygonRgn&> m_arPolygons

Set of polygons that define the region.

CRect  GetBounds() const

Return the bounding rectangle of the region.

int  GetPolygonCount() const

Get the number of polygons used to define the region.

const CODPolygonRgn&  GetPolygon(int nIndex) const

Get a specified polygon of the region.

void  SetPolygon(int nIndex, const CODPolygonRgn& rgn)

Set a specified polygon of the region.

CRect  GetPolygonBounds(int nIndex) const

Return the bounding rectangle of a given polygon.

BOOL  operator==(const CODRgn& rgn) const

Compare two regions for equality.

BOOL  operator!=(const CODRgn& rgn) const

Compare two regions for inequality.

CODRgn&  operator=(const CODRgn& rgn)

Assign one region to another region.

BOOL  PtInRegion(POINT ptLog, int nPadding = 0)

Determines if the specified point is within the region.

int  PtInSubregion(POINT ptLog, int nPadding = 0)

Determines which subregion of the point falls into, if any.

void  CombineRgn(const CODRgn& rgn)

Add a specified region to this region.

void  UpdateBounds()

Recalculate the bounding rectangle of the region.

void  Empty()

Remove all polygons from a region.

CODRgn  Transform(CODTransform* pXform) const

Apply a transformation to the polygons in a region.

CODRgn  InvTransform(CODTransform* pXform) const

Apply the inverse of a transformation to the polygons in a region.

CODPolygonRgn  CalcLineSegmentRgn(CPoint pt0, CPoint pt1)

Calculates the region of a line segment.

void  CurveToPolyline(LPPOINT lpPoints, int nCount)

Calculates a linear approximation from a set of points that define a bezier curve.

void  ApproximateCurve(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3)

Approximates a curve by creating a series of line segments.

BOOL  CanApproximate(float x0, float y0, float x1, float y1, float x2, float y2)

Determines if a curve can be approximated by a line.

void  AddApproximation(float x0, float y0, float x1, float y1)

Adds a line segment to the approximation array.

void  Midpoint(float x0, float y0, float x1, float y1, float& midX, float& midY)

Finds the midpoint of a line.

CPoint  GetBoundaryPoint(LPPOINT ptNear, LPPOINT ptFar, int nSpacing=0) const

Finds the boundary point given points of a line.