SRGCompiledPolygon Class

class SRGCompiledPolygon

Manages a single scaleable polygon object

Defined in: SRGCPly.h

Developer Notes

When repeated movement, scaling, or other operations are carried out on polygons, the coordinates may become degraded through small computational inaccuraccies and the polygon may become malformed. By keeping a pristine floating point "master list" of points and generating a compiled CPoint-list polygon from the master every time an operation takes place, the polygon will always be an accurate representation of the original.

Class Members

protected data members

double  m_dScaleY

The Y scaling factor

double  m_dScaleX

The X scaling factor

BOOL  m_bRotated

The rotation semaphore

double  m_dRotation

The angle of rotation.

virtual void  AssignPointBlock()

Assigns or reassigns required memory

CString  m_strName

Name of the polygon or wiget

LPPOINT  m_pPoints

List of CPoint points

int  m_nCount

Number of points in the integer polygon

CPtrList  m_Coords

List of the floating point coordinates

BOOL  m_bDirty

Semaphore indicating that the polygon should be recompiled

public member functions

virtual void  SetScaleY(double v)

Initialises the Y scaling factor

virtual double  GetScaleY()

Gets the Y scaling factor

virtual void  SetScaleX(double v)

Initialises the X scaling factor

virtual double  GetScaleX()

Gets the X scaling factor

virtual void  SetRotated(BOOL v)

Sets the rotation semaphore

virtual BOOL  GetRotated()

Gets the rotation semaphore

virtual void  SetRotation(double v)

Sets the rotation angle

virtual double  GetRotation()

Gets the rotation angle

int  GetIntegerPointCount()

Gets the&#09number of CPoints in the list.

virtual void  AddCirclePoints(int nPoints)

Adds points to create a circle with (nPoints) nodes.

 SRGCompiledPolygon(int nPrimitive)

Constructs a polygon with a stock shape.

virtual void  RotatePoints(double dDegrees,LPRECT pRect=NULL)

Sets the rotation to the specified angle.

virtual LPPOINT  GetFittedPoints(CRect &ampr)

Converts the floating point list into a CPoint list which is scaled to fit neatly into the desired rectangle

virtual void  OffsetPolygon(float xo,float yo)

Generates a CPoint list to be an integer representation of the floating point list with X and Y offsets added

virtual CString &  GetName()

Returns the name of this polygon

virtual void  SetName(LPCTSTR name)

Initializes the name of this polygon

 SRGCompiledPolygon()

Constructor

virtual  ~SRGCompiledPolygon()

Virtual Destructor

virtual LPPOINT  GetPoints()

Returns a pointer to the integer (compiled) point block

virtual void  AddCoord(SRGCoordinate *c)

Adds a floating point coordinate pair to the list

virtual void  AddCoord(float xc,float yc)

Adds a coordinate pair using floats

virtual void  AddCoord(int nx,int ny)

Adds a coordinate pair using integers

virtual int  GetCount()

Returns the number of points in the floating point list