SRGraphLabel Class

class SRGraphLabel: public SRGraphTitle

Displays labels on graphs and charts in various orientations and without overlapping other labels

Defined in: SRGraphLabel.h

Class Members

protected data members

BOOL m_bPolyValid

TRUE if the polygon describing the outline of the label is valid

CPoint * m_pOutline

The pointer to the list of CPoint objects that describe the outline of the label

int m_nPointCount

The number of points in the polygon that describes the outline of the label

double m_dPosY

Draws the text of the label

double m_dPosY

Device independent Y coordinate

double m_dPosX

Device independent X coordinate

BOOL m_bVectorStandard

Semaphore signifying that the vector is 0, 90, 180 or 270 degrees

BOOL m_bLabelStandard

Semaphore signifying that the label is oriented to 0, 90, 180 or 270 degrees

BOOL m_bMoveable

Determines the motility of this label -- may move when TRUE (unimplemented)

double m_dVectorX

Direction (-1 to 1) in which the X-axis label can move

double m_dVectorY

Direction (-1 to 1) in which the Y-axis label can move

int m_nLocationPoint

Location point code

SRGraphLabelBlock* m_pLabelBlock

Pointer to the parent label block -- only valid if m_bBlockMember is TRUE

BOOL m_bBlockMember

Designates this label as part of a label block when TRUE

BOOL m_bUseLocalFont

Designates use of the font description local to this label when TRUE

CPoint m_TextPosition

Screen coordinate of the location point

SRGraphAnnotationList m_Labels

Annotation list containing the coded labels

public data members

enum LocationPoints

Label location and rotation points (VertHoriz)

enum LabelVectors

Standard vectors by which a label may move

enum LabelStandards

Standard label orientations (measurements in degrees)

Public member functions

CHART_API virtual int GetCustomTagFontSize()

Custom override to determine font size used on tags

inline void SetPointCount(int v)

Sets the number of points used on the label's bounding polygon

inline int GetPointCount()

Returns the number of points used on the label's bounding polygon

inline void SetOutline(CPoint * v)

Initialaizes the list of CPoint objects used to describe the labels bounding polygon

inline CPoint * GetOutline()

Returns the list of CPoint objects used to describe the labels bounding polygon

CHART_API virtual void CleanBoundingPolygon()

Removes all points from the labels bounding polygon

CHART_API virtual void ConvertDataStyle(SRGraphStyle *pStyle)

Copies and converts tag styles from label styles where needed

CHART_API virtual double GetTickSize()

Returns the size of tick marks

CHART_API virtual double GetXMargin()

Returns the size of the X-margin. Used by axis scales for label offset

CHART_API virtual double GetYMargin()

Returns the size of the Y-margin -- not used for labels

CHART_API virtual int GetFontSize()

Returns the text size

CHART_API virtual void SetFontSize(double dSize)

Sets the text size for this label

CHART_API virtual int CalcFontAutoSize()

Calculates the text size in pixels

CHART_API virtual CRect GetLogRect()

Returns the logical (device dependent) rectangle enclosing this label -- CRect(0,0,0,0) if not available

CHART_API SRGraphLabel()

Constructor

CHART_API virtual ~SRGraphLabel()

Destructor

CHART_API virtual void SetTextPosX(double dPosX)

Sets text X position

CHART_API virtual void SetTextPosY(double dPosY)

Sets text Y position

inline double GetTextPosY()

Returns text Y position

inline double GetTextPosX()

Returns text Y position

CHART_API virtual void SetTextPosition(double dXPos,double dYPos)

Sets the device independent position for the text

inline SRGraphAnnotationList* GetAnnotationList()

Retrieves the annotation list for external access

CHART_API void CalcPos()

Calculates the pixel position from the device independent position

CHART_API virtual CString& GetAnnotation(int code=1)

Returns the text associated with this label

inline SRGraphLabelBlock* GetLabelBlock()

Returns a pointer to this object's parent block

CHART_API virtual SRGraph * GetParent()

Returns a pointer to the graph that owns this object

CHART_API virtual CSize GetLabelSize()

Returns the width and height of the label in pixels

CHART_API virtual COLORREF GetTextColor()

Returns the text color

inline BOOL GetLabelStandard()

Returns the m_bLabelStandard semaphore

CHART_API virtual void Serialize(CArchive &ar)

Saves or restores this object via the archive

inline void SetLabelBlock(SRGraphLabelBlock *block)

Initializes the pointer to the parent block.

CHART_API virtual BOOL IsDrawing()

Returns the m_bDrawing semaphore -- TRUE if drawing is possible

CHART_API virtual CWnd * GetpCWnd()

Returns the pointer to the CWnd being used to draw the object

CHART_API void SetVector(double dAngle)

Initializes the vector along which the label will move to avoid other labels

inline void SetVector(double x,double y)

Initializes the vector along which the label will move to avoid other labels

inline double GetVectorX()

Returns the X anti-collision vector

inline double GetVectorY()

Returns the Y anti-collision vector

CHART_API void SetOrientation(double o)

Initializes the angle at which the label is displayed

inline double GetOrientation()

Returns the angle at which the label is displayed

inline void SetLocationPoint(int p)

Initializes the point at which the text is to be anchored

inline int GetLocationPoint()

Returns the point to which the text is to be anchored

CHART_API virtual CRgn* GetBoundingRegion()

Returns a CRgn object which covers the area that the text occupies

CHART_API virtual void GetBoundingPolygon(CPoint *points=NULL,int nPointCount=5)

Returns an array of points describing the area outline that the text occupies

CHART_API virtual CPoint GetTextOrigin()

Determines the point at which text must be output to place it in the desired position

CHART_API virtual CPoint GetTextPosition()

Returns the coordinates of the label's location point

inline void SetTextPosition(CPoint p)

Sets the position of the label's location point

inline void SetTextPosition(int x,int y)

Sets the position of the label's location point

CHART_API virtual void SetLabelStandard(int nLabelStandard)

Orients a label according to a standard code

CHART_API virtual void SetVector(int nVectorCode)

Sets the label vector to a standard direction using a predefined code

CHART_API virtual CFont* GetFont()

Returns the font used to display this label

CHART_API virtual SRGraphStyle* GetStyle()

Returns a pointer to the style object

CHART_API virtual void SetAnnotation(int code,LPCTSTR strText)

Sets the text of the label

CHART_API virtual void SetAnnotation(LPCTSTR strText)

Sets the text of the label

inline void SetBlockMember(BOOL b)

Designates whether this label is a member of a block of labels

inline BOOL GetBlockMember()

Determines if this label is a member of a block of labels

inline void SetUseLocalFont(BOOL b)

Designates whether this label manages its own font

inline BOOL GetUseLocalFont()

Determines if this label manages its own font

CHART_API virtual void SetLogFont(LOGFONT * v)

Initializes the font using the supplied LOGFONT structure

CHART_API virtual BOOL UpdateFont()

Refreshes font information before drawing

CHART_API virtual void GetParentContent()

Overridden to prevent the labels from performing the base class behavior - does nothing

CHART_API virtual void DrawCustomLabelFill()

User extension function to allow you to define your own fill routine for this label

CHART_API virtual void DrawCustomLabelBorder()

User extension function to allow you to define your own border drawing routine for this label

CHART_API virtual void DrawCustomLabelShadow()

User extension function to allow you to define your own shadow drawing routine for this label

CHART_API virtual void Draw(CDC *pDC,CWnd *pWnd)

Main drawing function for this label

CHART_API virtual int ReadTemplateLine(LPCTSTR line)

Reads a template line for chart labels

CHART_API virtual void WriteSpecificParameters(CStdioFile * file)

Writes label details to the template

CHART_API virtual void WriteName(CStdioFile * file)

Writes the object name to the template

CHART_API virtual void DrawBorder()

Fills the background of this label

CHART_API virtual void DrawBorder()

Draws the border around the label

CHART_API virtual void DrawShadow()

Draws the shadow under the label