SRGDecimalScale Class
class SRGDecimalScale
Derived from SRGraphLabelBlock, this class manages a decimal numeric scale placed between two screen point positions. The scale will automatically calculate the best possible sequence of numbers depending upon the length of the line and the size of the font.This class will, by default, draw all the labels perpendicular to the imaginary line joining the two end points. After the labels are created, they may be manipulated using the standard SRGraphLabelBlock methods.
Defined in: DScale.h
Class Members
Protected data members
virtual CPoint GetRelOffset()
Get the relative offset of the labels from the DC origin
virtual CPoint GetOffset()
Get the offset of the labels from the tick list
BOOL m_bAscending
TRUE when the list of numerals generated is to go from low values toward high values
CPoint m_ptStart
Start position of the line of numerals
CPoint m_ptEnd
End position of the line of numerals
double m_dMinValue
Minimum value in the range of generated numbers
double m_dMaxValue
Maximum value in the range of generated numbers
double m_dResolution
Preferred or initial resolution of steps in the number list
CString m_strFormatString
Format string used to generate the numeral strings (see sprintf)
BOOL m_bLabelSide
Side of the imaginary line between m_ptStart and m_ptEnd on which labels are displayed -- FALSE=left/below, TRUE=right/above
public member functions
virtual void Serialize(CArchive &ar)
Writes or restores the scale to an archive for reuse
Constructor
SRGDecimalScale(CPoint ptStart, CPoint ptEnd, double dMinValue, double dMaxValue, double dResolution,CString & strFormatString)
Constructor with initialization parameters
virtual ~SRGDecimalScale()
Destructor
virtual void SetStartPos(CPoint ptStart)
Specifies the start position of the scale line
virtual void SetEndPos(CPoint ptEnd)
Specifies the end position of the scale line
virtual void SetResolution(double dRes)
Specifies the label step resolution (defaults to 0.1)
virtual void SetMaxValue(double dMaxValue)
Sets the maximum value for this scale
virtual void SetMinValue(double dMinValue)
Sets the minimum value for this scale
virtual void SetFormatString(LPCTSTR strFormatString)
Initializes a printf-style format string for the labels
virtual void SetLabelSide(BOOL bRight)
Sets the m_bLabelSide semaphore
virtual void SetAscending()
Specifies ascending label order
virtual void SetDescending()
Specifies descending label order
virtual CPoint GetStartPos()
Interrogates the m_ptStart member
virtual CPoint GetEndPos()
Interrogates the m_ptEnd member
virtual double GetResolution()
Interrogates the m_dResolution member
virtual double GetMaxValue()
Interrogates the m_dMaxValue member
virtual double GetMinValue()
Interrogates the m_dMinValue member
virtual CString & GetFormatString()
Interrogates the m_strFormatString member
virtual BOOL GetLabelSide()
Interrogates the m_bLabelSide member
virtual void CreateLabels()
Creates the label list from available information
virtual void SetRTAngles()
Sets all labels perpendicular to the line between the start and end points