SRGraphPosition Class

class SRGraphPosition: public CObject

SRGraphPosition manages the passing of position information from the graph to the user. It is used primarily in data dragging to define which data item in the graph data structure is associated with the positon of the mouse pointer.

Defined in: SRGPosn.h

Remarks

To use graph positions, you simply call the constructor with a pointer to the graph being interrogated and a mouse pointer position. The SRGraphPosition system then scans the graph structures taking into account the type of graph display and fills its member variables with pertinent information. The calling function or class then interrogates the position to find out what type of information is available. For example, calling SRGraphPosition::HasValueX() will return TRUE if the value currently stored in the m_dValueX data member was obtained on the last scan. If this routine returns FALSE, the data in that member will be undefined and unreliable.
All data members are protected and should be accessed using the correct methods.

Class Members

Protected data members

int  m_nGroup

Calculated group in which the point was found

int  m_nIndex

Calculated index of the point within its group

double  m_dValueY

The Y value relative to the current graph axis at which the point was placed

double  m_dValueX

The X value relative to the current graph axis at which the point was placed

SRGraph *  m_pParent

Pointer to the graph being interrogated

DWORD  m_dwFlags

Bitwise flags

void *  m_pSubject

Pointer to either the graph component (SRGrapDisplay) or a list of components in which the point was found

POSITION  m_pos

Type of position for selection purposes

CWnd *  m_pCWnd

Pointer to the CWnd being used to draw the graph

CPoint  m_Point

Point at which calculations are to be made

Public member functions

virtual void  SetGraphPosition(CPoint p)

Sets the position for hit testing

virtual BOOL  HasValueY()

Returns TRUE if a Y scale value has been calculated

virtual BOOL  HasValueX()

Returns TRUE if an X scale value has been calculated

virtual BOOL  HasIndex()

Returns TRUE if an index has been calculated

virtual BOOL  HasGroup()

Returns TRUE if an group has been calculated

virtual void  CalcUserDisplayPosition(SRGDisplayBase *pD)

Allows the addition of a user-defined calculation routine for your own graph types

virtual void  CalcDisplayPosition(SRGDisplayBase *pD)

Calculates the data from the given display depending on the graph type

virtual void  CalcPos(int nDisplay=0)

Calculates the positions and values with reference to the indexed display in the list

virtual DWORD  GetPosType()

Returns the position type

virtual DWORD  GetSelectionType()

Returns the type of selection made (ie. horizontal, vertical, etc.)

virtual void  SetPosType(DWORD postype)

Sets the type of position to use as a basis for the calculations

 SRGraphPosition()

Constructor

 SRGraphPosition(SRGraph *pGraph,CPoint point,CWnd *pWnd)

Constructor with parameters

virtual  ~SRGraphPosition()

Destructor

virtual void  SetGroup(int g)

Sets the group

virtual int  GetGroup()

Returns the group -- do not rely on this data unless  HasGroup returns TRUE

virtual void  SetIndex(int i)

Sets the index

virtual int  GetIndex()

Returns the index -- do not rely on this data unless  HasIndex returns TRUE

virtual void  SetValueX(double d)

Sets the X value

virtual void  SetValueY(double d)

Sets the Y value

virtual double  GetValueX()

Retrieves the calculated X value -- do not rely on this data unless  HasValueX returns TRUE

virtual double  GetValueY()

Retrieves the calculated Y value -- do not rely on this data unless  HasValueY returns TRUE

virtual CPtrList *  GetList()

Returns a pointer to the list of items in which the point is found

virtual SRGraphComponent *  GetComponent()

Returns a pointer to the unique display component in which the point has been found