MityDSP Documentation Index

MityDSP::tcGuiGenericGraph Class Reference

#include <ggui/gui_generic_graph.h>

Inheritance diagram for MityDSP::tcGuiGenericGraph:
MityDSP::tcGuiGraph MityDSP::tcGuiObject

List of all members.

Public Member Functions

 tcGuiGenericGraph (const char *name, tcBench *bench, int idd)
 ~tcGuiGenericGraph ()
virtual bool ParseXML (TiXmlElement *ahDom)
void create ()
int SetSeriesData (int SeriesNum, float *apX, float *apY, int Len)
int SetXAxis (float Min, float Max, int NumMajor, int NumMinor)
int SetYAxis (float Min, float Max, int NumMajor, int NumMinor)
int SetLineWidth (int SeriesNum, float width)
int SetLineAA (int SeriesNum, bool abAA)
int SetLineColor (int SeriesNum, tsRgb Color)
void SetTitle (const char *apTitle)
void SetXLabel (const char *apLabel)
void SetYLabel (const char *apLabel)

Static Public Attributes

static const int gnMaxNumSeries = 4
 maximum number of series per graph

Protected Member Functions

tsGraphAxisCfgBuildLinAxis (float Min, float Max, int NumMajor, int NumMinor, int &size, const char *apFormat)
virtual void post_axis_draw (tcGuiDspDisplay &pd)
void BuildFormat (float &arMin, float &arMax, int MaxDigits, char *Format, int FormatLen)

Protected Attributes

float * maX [gnMaxNumSeries]
 most recent X axis data
float * maY [gnMaxNumSeries]
 most recent Y axis data
int maLen [gnMaxNumSeries]
 length of each series
float maWidth [gnMaxNumSeries]
 width of lines
bool maAA [gnMaxNumSeries]
 true if lines should be anti-aliased
tsRgb maColor [gnMaxNumSeries]
 color to use for each line

Detailed Description

The tcGuiGenericGraph class allows the user to draw a generic 2 dimensional graph under the ggui library framework.

See also:
tcGuiGenericGraph Page

Constructor & Destructor Documentation

tcGuiGenericGraph::tcGuiGenericGraph ( const char *  name,
tcBench bench,
int  idd 
)

Constructor

/param[in] name name of graph object /param[in] bench pointer to ggui bench object manager to handle windowing events /param[in] idd unique id number for the object

< color to use for each line

tcGuiGenericGraph::~tcGuiGenericGraph (  ) 

Destructor. Typically not reached. Will delete any graph data stored locally.


Member Function Documentation

bool tcGuiGenericGraph::ParseXML ( TiXmlElement *  apElement  )  [virtual]

Parse common XML elements from the DOM.

Reimplemented from MityDSP::tcGuiGraph.

void tcGuiGenericGraph::create (  )  [virtual]

The create method is common across all tcGuiObject classes. This method initializes member data based on finalized XML input data from initial tcBench loading and creation.

sa tcGuiObject::create()

Reimplemented from MityDSP::tcGuiGraph.

int tcGuiGenericGraph::SetSeriesData ( int  SeriesNum,
float *  apX,
float *  apY,
int  Len 
)

Set the data values to be plotted for a given series number. This performs a data copy. Internal data vectors are (re)allocated to hold a copy of the data if the Len is larger than the current buffer sizes.

Parameters:
SeriesNum Line number to replace (up to tcGuiGenericGraph::gnMaxNumSeries-1)
apX pointer to X values for plot
apY pointer to Y values for plot
Len number of X/Y values in provided data vectors.
Returns:
0 on success, non-zero on error.
Note:
this routine will cause an invalidation event to be triggered
int tcGuiGenericGraph::SetXAxis ( float  Min,
float  Max,
int  NumMajor,
int  NumMinor 
)

Set the X Axis specifications for a linear grid.

Parameters:
Min minimum X axis value
Max maximum X axis value
NumMajor number of NumMajor number of major axis lines (should be >= 2)
NumMinor number of minor lines between each pair of majors (should be >= 0)
Returns:
zero on success
Note:
this routine will cause an invalidation event.
int tcGuiGenericGraph::SetYAxis ( float  Min,
float  Max,
int  NumMajor,
int  NumMinor 
)

Set the Y Axis specifications for a linear grid.

Parameters:
Min minimum Y axis value
Max maximum Y axis value
NumMajor number of NumMajor number of major axis lines (should be >= 2)
NumMinor number of minor lines between each pair of majors (should be >= 0)
Returns:
zero on success
Note:
this routine will cause an invalidation event.
int tcGuiGenericGraph::SetLineWidth ( int  SeriesNum,
float  width 
)

Set the effective line width of a given series.

Parameters:
SeriesNum Line number to size (up to tcGuiGenericGraph::gnMaxNumSeries-1)
width effective pixel width (1.0 is the default, must be >= 1.0)
Returns:
non-zero on error.
int tcGuiGenericGraph::SetLineAA ( int  SeriesNum,
bool  abAA 
)

Enable line anti-aliasing for drawing a given series.

Parameters:
SeriesNum Line number to size (up to tcGuiGenericGraph::gnMaxNumSeries-1)
abAA when true enable anti-aliased drawing of line
Returns:
non-zero on error.
int tcGuiGenericGraph::SetLineColor ( int  SeriesNum,
tsRgb  Color 
)

Set the color of a line with a given series number.

Parameters:
SeriesNum Line number to size (up to tcGuiGenericGraph::gnMaxNumSeries-1)
Color 32 bit color specification of desired line color.
Returns:
non-zero on error.
void tcGuiGenericGraph::SetTitle ( const char *  apTitle  ) 

Set the title of a tcGuiGenericGraph Object.

Parameters:
apTitle title of the graph.
void tcGuiGenericGraph::SetXLabel ( const char *  apLabel  ) 

Set the X Label of the graph.

Parameters:
apLabel X Label of the graph.
void tcGuiGenericGraph::SetYLabel ( const char *  apLabel  ) 

Set the Y Label of the graph.

Parameters:
apLabel Y Label of the graph.
tsGraphAxisCfg * tcGuiGenericGraph::BuildLinAxis ( float  Min,
float  Max,
int  NumMajor,
int  NumMinor,
int &  size,
const char *  apFormat 
) [protected]

Internal method used to build a linear axis object used for plotting gridlines and converting graph coordinates (floating point) to screen coordinates.

Parameters:
Min minimum axis value
Max maximum axis value
NumMajor number of major axis values (should be >= 2)
NumMinor number of minor axis values between majors (should be >= 0)
size returned value of number of entries in graph axis object array
apFormat desired floating point sprintf format for label generation (e.g., "%.1f")
Returns:
valid graph axis configuration object
void tcGuiGenericGraph::post_axis_draw ( tcGuiDspDisplay pd  )  [protected, virtual]

This routine is responsible to drawing actual 2D graph data (i.e., the "line" representing the data sequence) once the graph axis primitives have been drawn on the screen.

Parameters:
pd reference to working tcGuiDspDisplay object

Reimplemented from MityDSP::tcGuiGraph.

void tcGuiGenericGraph::BuildFormat ( float &  arMin,
float &  arMax,
int  MaxDigits,
char *  Format,
int  FormatLen 
) [protected]

Member Data Documentation

maximum number of series per graph

most recent X axis data

most recent Y axis data

length of each series

width of lines

true if lines should be anti-aliased

color to use for each line


  
Generated on Wed Mar 17 18:24:43 2010 for MityDSP Skinnable Graphics User Interface (GGUI) by  Doxygen Version 1.6.1
Copyright © 2009, Critical Link LLC, All rights reserved.