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

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

virtual void  CleanBoundingPolygon()

Removes all points from the labels bounding polygon

virtual void  ConvertDataStyle(SRGraphStyle *pStyle)

Copies and converts tag styles from label styles where needed

virtual double  GetTickSize()

Returns the size of tick marks

virtual double  GetXMargin()

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

virtual double  GetYMargin()

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

virtual int  GetFontSize()

Returns the text size

virtual void  SetFontSize(double dSize)

Sets the text size for this label

virtual int  CalcFontAutoSize()

Calculates the text size in pixels

virtual CRect  GetLogRect()

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

 SRGraphLabel()

Constructor

virtual  ~SRGraphLabel()

Destructor

virtual void  SetTextPosX(double dPosX)

Sets text X position

virtual void  SetTextPosY(double dPosY)

Sets text Y position

inline double  GetTextPosY()

Returns text Y position

inline double  GetTextPosX()

Returns text Y position

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

void  CalcPos()

Calculates the pixel position from the device independent position

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

virtual SRGraph *  GetParent()

Returns a pointer to the graph that owns this object

virtual CSize  GetLabelSize()

Returns the width and height of the label in pixels

virtual COLORREF  GetTextColor()

Returns the text color

inline BOOL  GetLabelStandard()

Returns the m_bLabelStandard semaphore

virtual void  Serialize(CArchive &ampar)

Saves or restores this object via the archive

inline void  SetLabelBlock(SRGraphLabelBlock *block)

Initializes the pointer to the parent block.

virtual BOOL  IsDrawing()

Returns the m_bDrawing semaphore -- TRUE if drawing is possible

virtual CWnd *  GetpCWnd()

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

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

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

virtual CRgn*  GetBoundingRegion()

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

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

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

virtual CPoint  GetTextOrigin()

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

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

virtual void  SetLabelStandard(int nLabelStandard)

Orients a label according to a standard code

virtual void  SetVector(int nVectorCode)

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

virtual CFont*  GetFont()

Returns the font used to display this label

virtual SRGraphStyle*  GetStyle()

Returns a pointer to the style object

virtual void  SetAnnotation(int code,LPCTSTR strText)

Sets the text of the label

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

virtual void  SetLogFont(LOGFONT * v)

Initializes the font using the supplied LOGFONT structure

virtual BOOL  UpdateFont()

Refreshes font information before drawing

virtual void  GetParentContent()

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

virtual void  DrawCustomLabelFill()

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

virtual void  DrawCustomLabelBorder()

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

virtual void  DrawCustomLabelShadow()

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

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

Main drawing function for this label

virtual int  ReadTemplateLine(LPCTSTR line)

Reads a template line for chart labels

virtual void  WriteSpecificParameters(CStdioFile * file)

Writes label details to the template

virtual void  WriteName(CStdioFile * file)

Writes the object name to the template

virtual void  DrawBorder()

Fills the background of this label

virtual void  DrawBorder()

Draws the border around the label

virtual void  DrawShadow()

Draws the shadow under the label