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.

CHART_API 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

CHART_API virtual void SetScaleY(double v)

Initialises the Y scaling factor

CHART_API virtual double GetScaleY()

Gets the Y scaling factor

CHART_API virtual void SetScaleX(double v)

Initialises the X scaling factor

CHART_API virtual double GetScaleX()

Gets the X scaling factor

CHART_API virtual void SetRotated(BOOL v)

Sets the rotation semaphore

CHART_API virtual BOOL GetRotated()

Gets the rotation semaphore

CHART_API virtual void SetRotation(double v)

Sets the rotation angle

CHART_API virtual double GetRotation()

Gets the rotation angle

CHART_API int GetIntegerPointCount()

Gets the number of CPoints in the list.

CHART_API virtual void AddCirclePoints(int nPoints)

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

CHART_API SRGCompiledPolygon(int nPrimitive)

Constructs a polygon with a stock shape.

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

Sets the rotation to the specified angle.

CHART_API virtual LPPOINT GetFittedPoints(CRect &r)

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

CHART_API 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

CHART_API virtual CString & GetName()

Returns the name of this polygon

CHART_API virtual void SetName(LPCTSTR name)

Initializes the name of this polygon

CHART_API SRGCompiledPolygon()

Constructor

CHART_API virtual ~SRGCompiledPolygon()

Virtual Destructor

CHART_API virtual LPPOINT GetPoints()

Returns a pointer to the integer (compiled) point block

CHART_API virtual void AddCoord(SRGCoordinate *c)

Adds a floating point coordinate pair to the list

CHART_API virtual void AddCoord(float xc,float yc)

Adds a coordinate pair using floats

CHART_API virtual void AddCoord(int nx,int ny)

Adds a coordinate pair using integers

CHART_API virtual int GetCount()

Returns the number of points in the floating point list