SRGraph Class

class SRGraph: public CObject

The graph data parent object -- the main placeholder for all Objective Chart functionality

Defined in: SRGraph.h

public:

Contains an empty string

Class Members

Public data members

virtual BOOL  GetFeedbackLogging()

Returns the m_bFeedbackLogging flag

BOOL  m_bSignificantChange

Set TRUE to inform the whole graph of a change in the data or component structures

int  m_nCountryCode

Dialing code of the country for which this graph should be adjusted

CObject *  m_pHint

Pointer to a hint object (not currently used)

LPARAM  m_lHint

Most recent hint code

BOOL  m_bHintPending

Semaphore signifying that a hint operation is outstanding

BOOL  m_bBackgroundDraw

Semaphore enabling or disabling the use of a back buffer in draw operations

SRGraphStyle  m_Style

Style data for axes and graph types

CObList  m_ComponentList

List of components which make up the graphical display elements for this graph

SRGDataManager*  m_pDataMgr

Data manager

BOOL  m_bAutoDelete

Indicating if the graph manage the memory of data manager of not

BOOL  m_bFeedbackLogging

Semaphore to enable or disable feedback logging

CObList  m_FeedbackList

Linked list of SRGraphFeedback objects

Private member functions

int  SubString(LPCTSTR text,CString &ampsection,DWORD *index,double *number)

Parses a substring from the text buffer

public:

Reports syntax errors in graph template text

Public member functions

inline void  SetAutoDeleteDataManager(BOOL bAutoDelete)

Sets the AutoDelete flag on the data manager

inline BOOL  GetAutoDeleteDataManager()

Returns the AutoDelete flag on the data manager

inline void  SetpDC(CDC* pDC)

Sets the pointer to a drawing device context -- not used

inline CDC*  GetpDC()

Return a pointer to the current device context

virtual void  DrawingUsing(CDC *pDC,CWnd *pCWnd)

Prepares for the use of component drawing or sizing functions outside the normal drawing process

virtual void  NotDrawing()

Resets the drawing parameters set by DrawingUsing()

SRGraphComponent *  GetCurrentComponent()

Returns a pointer to the component in the main component list that is currently being drawn

virtual SRGraphComponent*  AddComponent(UINT nType, int nMeasure = CX_PERCENT, const CRect& rect = CRect(-1, -1, -1, -1), DWORD nBorder = CX_NO_BORDER, DWORD nShadow = CX_NO_SHADOW, DWORD nFillStyle = CX_SOLID_FILL, DWORD nGraphStyle = CX_GRAPH_VBAR, DWORD nAxisStyle = CX_AXIS_AUTOMATIC)

A one step version of add component to graph

virtual CPen *  GetPen(int nPenStyle, int nPenWidth, COLORREF PenColor)

Returns a new pen or one stored in the cache

virtual SRGCompiledPolygon *  LoadPolygon(LPCTSTR strPolygonName, LPCTSTR strSectionName)

Loads a named polygon

virtual void  SetDefaultDataStyle(SRGraphStyle v)

Initialises the default data style

virtual SRGraphStyle *  GetDefaultDataStyle()

Retrieves the default data style

virtual void  SetAutoColorRange(int v)

Sets the range of colors used by auto pen and auto brush

virtual int  GetAutoColorRange()

Sets the range of colors used by auto pen and auto brush

virtual void  DeleteTemporaryComponents(LPCTSTR strName)

Deletes components designated as "temporary" from the component list.

virtual SRGraphComponent *  FindComponentByName(LPCTSTR strName)

Finds a component on the component list

virtual BOOL  GetCompiledPolygon(LPCTSTR strPolygonName, LPCTSTR strSectionName, SRGCompiledPolygon * * pPoly,double dAngle=0)

Finds or tries to create a compiled polygon by accessing the polgon cache

virtual void  Create332Palette(CPalette *pPal)

Creates a half tone palette

virtual void  SerializeComponentList(CArchive &ampar)

Saves or loads the component list via serialization

virtual void  LogPoint(CPoint point,int group,int index,int nRadius)

Adds a point to the feedback logging system

virtual void  KillData()

Removes all data from the graph object while leaving the component list intact

virtual void  InvalidateGroupPosition()

Marks the position of the last group accessed as invalid

virtual void  ClipPoly(CPoint *pPoint,int nPointCount,int nMode=RGN_COPY)

Sets the clipping region to a particular polygon

virtual void  ClipRect(CRect r,int nMode=RGN_COPY)

Sets the clipping region to a particular rectangle

virtual void  PopClip()

"Pops" a stored clipping region and restores it

virtual void  PushClip()

"Pushes" the current clipping region on to a stack

virtual void  PrintComponentList(CDC *pCD, CWnd *pCWnd)

Uses a print banding system to output the component list to the printer

virtual POSITION  GetCurrentComponentPos()

Returns the POSITION of the component currently being drawn

virtual SRGraphDataList *  NewGroup()

Creates a new SRGraphDataList-based object -- overridable to

virtual SRGraphData *  GetSafeData(int index,int group)

Returns the 'safe' data item -- does not grow the list, does not assert

virtual SRGraphData *  GetData(int index,int group)

Returns the 'unsafe' data item -- can grow the list

virtual CSize  GetDisplaySize()

Returns the size of the display area

 SRGraph()

Default contructor

 SRGraph(SRGDataManager* pDataMgr, BOOL bAutoDelete)

Constructor

virtual void  SetDataManager(SRGDataManager* pNewDataManager, BOOL bAutoDelete)

Install a data manager

inline SRGDataManager*  GetDataManager()

Return the existing data manager

CRect  m_DisplayRect

Current display rectangle -- not saved at serialization

virtual  ~SRGraph()

Destructor

virtual void  RollGroup(int nGroup, double dValue=0.0, BOOL bDirection=FALSE)

Rolls a group in the specified direction

virtual void  LogRectangle(CRect r,int group, int index)

Places a feedbck rectangle on the feedback list

inline void  SetMaxArea(CRect r,BOOL bUseArea=TRUE)

Sets the maximum area which a graph may use

inline CRect  GetMaxArea()

Returns the rectangle defined as the maximum usable area

inline BOOL  GetUseMaxArea()

Returns TRUE if the sizes of the final display are to be controlled by the m_MaxArea rectangle

inline void  SetUseMaxArea(BOOL b)

Enables or disables the use of the maximum size rectangle

inline void  SetAlignment(DWORD dwAlign)

Sets the alignment style for this graph

inline DWORD  GetAlignment()

Gets the alignment style for this graph

virtual void  SetSignificantChanges()

Signals to all components on the main list that an important change has taken place

virtual void  SetGlobalStyle(int nStartGroup,int nEndGroup,int nStartIndex,int nEndIndex,SRGraphStyle *ptrStyle,BOOL bSetHeaders=TRUE)

Sets the style of all data items in a range to a reference style

virtual void  SetComponentMinIndex(int nComponent,int index,UINT Type=-1)

Sets the minimum index for a given display on the component list

virtual void  SetComponentMaxIndex(int nComponent,int index,UINT Type=-1)

Sets the maximum index for a given display on the component list

virtual void  SetComponentMinGroup(int nComponent,int group,UINT Type=-1)

Sets the minimum group for a given display on the component list

virtual void  SetComponentMaxGroup(int nComponent,int group,UINT Type=-1)

Sets the maximum group for a given display on the component list

virtual double  GetGroupAverage(int group)

Returns the average of all data items in this group

virtual double  GetIndexTotal(int index,int nMinGroup=0,int nMaxGroup=0)

Returns the total for a given index across all groups

virtual BOOL  IsDynamic()

Returns FALSE -- this object is not a dynamic graph

virtual void  KillComponentList()

Wipes the component list without destroying the graph data

virtual void  SetGraphTitle(LPCTSTR title,int code=1)

Changes title text in the m_strTitle annotation list

virtual void  SetComponentHint(CWnd * pCWnd,LPARAM lHint,CObject * pHint)

Updates hint information for the component drawing routines

virtual void  ParseText(LPCTSTR text)

Interprets tab delimited text data into graph information

virtual void  KillGraph(void)

Empties a graph of data

virtual double  GetDataTotal(int mingroup, int minindex, int maxgroup, int maxindex)

Calculates the total of all data values in a given range of groups and indices -- used to calculate percentages

virtual double  GetDataTotal(int group=-1)

Calculates the total of all data storage values in this graph -- used to calculate percentages

virtual int  GetDataCount(int nGroup, BOOL GrowList = TRUE)

Get the number of data item in the given group

virtual void  ReadTemplate(LPCTSTR TemplateName)

Parses a graph template either from a resource or filename

virtual BOOL  UserParser(LPCTSTR line)

Override this function to interpret your own custom template commands

virtual CString  GetHeader(int group=0,int code=1)

Returns the header from the  SRGraphDataList list indexed by group

virtual CString  GetText(int group,int index,int code=1)

Returns text held in the  SRGraphData object within group and referenced by index

virtual CString  GetGraphTitle(int code=1)

Returns the title of the graph

virtual int  GetGroupCount()

Returns the total number of data sets (groups) in the graph

virtual int  GetMaxXDivisions()

Returns the count of the longest group

virtual CScale  GetAutoScaleRange(BOOL HiLo=FALSE)

Scans the graph data and returns the maximum and minimum value used in this graph

virtual SRGraphDataList*  GetGroup(int group,BOOL GrowList=TRUE)

References the correct  SRGraphDataList in the array

virtual POSITION  AddComponent(SRGraphComponent *gc)

Adds a  SRGraphComponent or derived object to the list of graphic objects

virtual void  DrawComponentList(CDC *pDC,CWnd *pCWnd)

Scans the component list, drawing as it goes (order in the list is reverse Z order on screen)

virtual void  Serialize(CArchive &ampar)

Handles storage and retrieval of data

void  SetHeader(int group,LPCTSTR text,int nCode=1)

Sets a header for a group of data by annotating the  SRGraphDataList for that group

void  SetValue(int index,int group,double number,BOOL bUseDefaultStyle=FALSE)

Sets a numeric value in the data array

void  SetText(int index,int group,LPCTSTR text)

Sets text in the data array

void  Dump(CDumpContext &ampdc) const

Dump diagnostics -- debug only

virtual SRGraphFeedback*  GetFeedback(int x,int y)

Searches for a feedback point

virtual void  LogPoly(LPPOINT points,int PointCount,int group,int index)

Adds a polygon to the feedback list

virtual void  LogPoint(CPoint point,int group,int index)

Adds a point to the feedback list

virtual double  GetGroupAverage(int MinIndex,int MaxIndex,int Group)

Retrieves an average value for a specific index across a range of groups

virtual double  GetGraphTotal()

Calculates the total of all graph values

virtual BOOL  IsBackgroundDraw()

Retrieves the m_bBackgroundDraw member

virtual BOOL  IsFeedbackLogging()

Retrieves the m_bFeedbackLogging member

virtual void  SetFeedbackLogging(BOOL bLogging=TRUE)

Initializes the m_bFeedbackLogging member

virtual void  SetBackgroundDraw(BOOL bBDraw=TRUE)

Initializes the m_bBackgroundDraw member

virtual SRGraphAnnotationList *  GetTitle()

Returns a pointer to the m_strTitle member

virtual CObList *  GetFeedbackList()

Returns a pointer to the m_FeedbackList member

virtual CObList *  GetComponentList()

Returns a pointer to the m_ComponentList member

virtual SRGraphStyle *  GetStyle()

Returns a pointer to the m_ComponentList member

virtual double  GetValue(int index,int group)

Gets a numeric value from the data array

virtual SRGraphComponent *  GetComponent(int nComponent,UINT Type)

Returns a pointer to a specific component in the component list

virtual SRGraphComponent *  GetNextComponent(POSITION& rPos,UINT Type=-1)

Searches the m_ComponentList for the next item after the supplied POSITION

virtual POSITION  GetFirstComponentPosition(UINT Type=-1)

Gets the first POSITION in the component list

virtual CPtrList*  GetDataList()

Returns a pointer to the m_data member

virtual POSITION  GetFirstDataPosition()

Finds the first POSITION of the first item on the m_data list

virtual void*  GetNextData(POSITION& p)

Gets the next item fron the m_data list

virtual void  SetCountryCode(int n)

Sets the dialing code for the annotations in this graph

virtual int  GetCountryCode()

Interrogates the dialing code for the annotations in this graph.

virtual void  SetBanding(BOOL v)

Sets the banding variable -- call SetBanding before a print or preview to use the banding system

virtual BOOL  GetBanding()

Returns the banding flag

virtual void  SetPaletteSupported(BOOL v)

Initializes the palette support flag.

virtual BOOL  GetPaletteSupported()

Returns the palette support flag.

virtual void  SetQuickBlit(BOOL v)

Sets the quickblit flag

virtual BOOL  GetQuickBlit()

Gets the quickblit flag

inline virtual CPalette*  GetPalette()

Returns the stored palette

BOOL  m_bIsEmpty

Flag signifying a clean graph if TRUE

BOOL  m_bQuickBlit

6.11 and CE Quick blitting flag

CMapStringToPtr  m_PenMap

This map collection stores pens which have been created by the chart

CMap&ltCString , LPCTSTR ,HFONT,HFONT &>  m_FontMap

This map collection stores fonts which have been created by the chart

CObList  m_PolygonList

The polygon cache

int  m_nAutoColorRange

The color range used for choosing auto brushes.

BOOL  m_bPaletteSupported

TRUE if a palette is used on this chart

CPalette  m_Palette

Stored palette (set to a 332 palette)

CObStack  m_ClipStack

Stack for storing clipping regions

CRect  m_PageRect

Drawing rectangle used in printing

BOOL  m_bBanding

Banding flag to enable use of banding system during printing

virtual void  AlignRect(CRect * r, CRect DCRect)

Aligns a display area rectangle within a given window or page

POSITION  m_CurrentComponentPos

POSITION in the list of the component currently being drawn

BOOL  m_bDrawing

Flag set when the chart is being drawn and the DC should be valid

CWnd *  m_pCWnd

Pointer to the CWnd being drawn into -- not valid unless m_bDrawing is true

CDC *  m_pDC

Pointer to the CDC being drawn into -- not valid unless m_bDrawing is true

CRect  m_OldRect

Rectangle used to retain the old display rectangle

CRect  m_BGRect

Background rectangle

CBitmap  m_Shadow

Bitmap used as a back-buffer in flicker free drawing.

CRect  m_MaxArea

Maximum area which a chart may occupy

DWORD  m_dwAlignInDC

Binary semaphores for centering behaviour

BOOL  m_bUseMaxArea

Semaphore set when maximum area is used to define the image size