CChartPointsArray< T > Class Template Reference

Manages an array of points which supports fast resizing. More...

#include <ChartPointsArray.h>

List of all members.

Public Member Functions

 CChartPointsArray (unsigned iResize=1000)
 Constructor.
 ~CChartPointsArray ()
 Destructor.
unsigned GetPointsCount () const
 Returns the number of points currently stored.
void SetResize (int iResize)
 Sets the size by which the internal buffer is increased when reallocation occurs.
void AddPoint (const T &newPoint)
 Adds a new point in the array.
void AddPoints (T *pPoints, unsigned uCount)
 Adds multiple points in the array.
void SetPoints (T *pPoints, unsigned uCount)
 Sets multiple points in the array.
void Clear ()
 Removes all the points from the array.
void RemovePointsFromBegin (unsigned Count)
 Removes a certain amount of points from the begining of the series.
void RemovePointsFromEnd (unsigned Count)
 Removes a certain amount of points from the end of the series.
T & operator[] (unsigned Index)
 Retrieves the points at the specified index.
const T & operator[] (unsigned Index) const
 Retrieves the points at the specified index.
bool GetSerieXMinMax (double &Min, double &Max) const
 Retrieves the minimum and maximum X values of the points stored in the array.
bool GetSerieYMinMax (double &Min, double &Max) const
 Retrieves the minimum and maximum Y values of the points stored in the array.
void SetOrdering (PointsOrdering newOrdering)
 Specifies how the points should be ordered in the array.
PointsOrdering GetOrdering () const
 Retrieves the ordering of the points in the array.
void ReorderPoints ()
 Refreshes the point ordering.
bool GetVisiblePoints (double dAxisMin, double dAxisMax, unsigned &uFirstPt, unsigned &uLastPt) const
 Retrieves the index of the points which are between two given values.
T * GetInternalBuffer () const
 Returns the internal buffer of the array.


Detailed Description

template<class T>
class CChartPointsArray< T >

Manages an array of points which supports fast resizing.

This class is used internally to store the data for all the points. The data is stored in a C-style array. The internal buffer can grow dynamically depending on the needs.

The class is a template class with the template parameter being the type of the points to be stored. The points have to provide the following methods:


Constructor & Destructor Documentation

template<class T >
CChartPointsArray< T >::CChartPointsArray ( unsigned  iResize = 1000  )  [inline]

Constructor.

Parameters:
iResize The size by which the internal buffer is increased when reallocation occurs


Member Function Documentation

template<class T>
void CChartPointsArray< T >::AddPoint ( const T &  newPoint  )  [inline]

Adds a new point in the array.

Parameters:
newPoint The new point to add

template<class T>
void CChartPointsArray< T >::AddPoints ( T *  pPoints,
unsigned  uCount 
) [inline]

Adds multiple points in the array.

The points are added to the ones currently stored in the array.

Parameters:
pPoints Array containing the points
uCount The number of points to add

template<class T >
bool CChartPointsArray< T >::GetVisiblePoints ( double  dAxisMin,
double  dAxisMax,
unsigned &  uFirstPt,
unsigned &  uLastPt 
) const [inline]

Retrieves the index of the points which are between two given values.

If the points are not ordered, uFirstPt will contain 0 and uLastPt will contain the index of the last point in the array.

Parameters:
dAxisMin The minimum value to retrieve the first visible point
dAxisMax The maximum value to retrieve the last visible point
uFirstPt This parameter will store the index of the first visible point
uLastPt This parameter will store the index of the last visible point
Returns:
false if no points are in the array.

template<class T >
void CChartPointsArray< T >::SetOrdering ( PointsOrdering  newOrdering  )  [inline]

Specifies how the points should be ordered in the array.

This specifies if the points should be ordered on their X values, on their Y values or not ordered (kept in order they are added to the control). Ordering can improve performances a lot but makes it impossible to draw some specific curves (for instance, drawing an ellipse is only possible if no ordering is set).

template<class T>
void CChartPointsArray< T >::SetPoints ( T *  pPoints,
unsigned  uCount 
) [inline]

Sets multiple points in the array.

The points currently stored in the array are first removed before adding the new points.

Parameters:
pPoints Array containing the new points
uCount The number of points to add


The documentation for this class was generated from the following files:

Generated on Sun Jan 17 13:33:11 2010 for ChartDemo by  doxygen 1.5.8