Main MRPT website > C++ reference
MRPT logo
Public Member Functions | Protected Member Functions | Protected Attributes

mpFXYVector Class Reference


Detailed Description

A class providing graphs functionality for a 2D plot (either continuous or a set of points), from vectors of data.

This class can be used directly, the user does not need to derive any new class. Simply pass the data as two vectors with the same length containing the X and Y coordinates to the method SetData.

To generate a graph with a set of points, call

     layerVar->SetContinuity(false)

or

     layerVar->SetContinuity(true)

to render the sequence of coordinates as a continuous line.

(Added: Jose Luis Blanco, AGO-2007)

Definition at line 1281 of file mathplot.h.

#include <mrpt/otherlibs/mathplot/mathplot.h>

Inheritance diagram for mpFXYVector:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 mpFXYVector (wxString name=wxEmptyString, int flags=mpALIGN_NE)
void SetData (const std::vector< double > &xs, const std::vector< double > &ys)
 Changes the internal data: the set of points to draw.
void SetData (const std::vector< float > &xs, const std::vector< float > &ys)
 Changes the internal data: the set of points to draw.
void Clear ()
 Clears all the data, leaving the layer empty.
size_t GetDataLength () const
 Returns the number of data points currently hold in X & Y.
void AppendDataPoint (float x, float y)
 Append a new data point (x,y).
double GetMinX ()
 Returns the actual minimum X data (loaded in SetData).
double GetMinY ()
 Returns the actual minimum Y data (loaded in SetData).
double GetMaxX ()
 Returns the actual maximum X data (loaded in SetData).
double GetMaxY ()
 Returns the actual maximum Y data (loaded in SetData).

Protected Member Functions

void Rewind ()
 Rewind value enumeration with mpFXY::GetNextXY.
bool GetNextXY (double &x, double &y)
 Get locus value for next N.

Protected Attributes

std::vector< double > m_xs
 The internal copy of the set of data to draw.
std::vector< double > m_ys
size_t m_index
 The internal counter for the "GetNextXY" interface.
double m_minX
 Loaded at SetData.
double m_maxX
double m_minY
double m_maxY
int m_flags
 Holds label alignment.

Constructor & Destructor Documentation

mpFXYVector::mpFXYVector ( wxString  name = wxEmptyString,
int  flags = mpALIGN_NE 
)
Parameters:
name Label
flags Label alignment, pass one of mpALIGN_NE, mpALIGN_NW, mpALIGN_SW, mpALIGN_SE.

Member Function Documentation

void mpFXYVector::AppendDataPoint ( float  x,
float  y 
)

Append a new data point (x,y).

See also:
SetData
void mpFXYVector::Clear (  ) 

Clears all the data, leaving the layer empty.

See also:
SetData
size_t mpFXYVector::GetDataLength (  )  const [inline]

Returns the number of data points currently hold in X & Y.

See also:
SetData

Definition at line 1309 of file mathplot.h.

double mpFXYVector::GetMaxX (  )  [inline, virtual]

Returns the actual maximum X data (loaded in SetData).

Reimplemented from mpLayer.

Definition at line 1355 of file mathplot.h.

double mpFXYVector::GetMaxY (  )  [inline, virtual]

Returns the actual maximum Y data (loaded in SetData).

Reimplemented from mpLayer.

Definition at line 1359 of file mathplot.h.

double mpFXYVector::GetMinX (  )  [inline, virtual]

Returns the actual minimum X data (loaded in SetData).

Reimplemented from mpLayer.

Definition at line 1347 of file mathplot.h.

double mpFXYVector::GetMinY (  )  [inline, virtual]

Returns the actual minimum Y data (loaded in SetData).

Reimplemented from mpLayer.

Definition at line 1351 of file mathplot.h.

bool mpFXYVector::GetNextXY ( double &  x,
double &  y 
) [protected, virtual]

Get locus value for next N.

Overridden in this implementation.

Parameters:
x Returns X value
y Returns Y value

Implements mpFXY.

void mpFXYVector::Rewind (  )  [protected, virtual]

Rewind value enumeration with mpFXY::GetNextXY.

Overridden in this implementation.

Implements mpFXY.

void mpFXYVector::SetData ( const std::vector< double > &  xs,
const std::vector< double > &  ys 
)

Changes the internal data: the set of points to draw.

Both vectors MUST be of the same length. This method DOES NOT refresh the mpWindow; do it manually.

See also:
Clear
void mpFXYVector::SetData ( const std::vector< float > &  xs,
const std::vector< float > &  ys 
)

Changes the internal data: the set of points to draw.

Both vectors MUST be of the same length. This method DOES NOT refresh the mpWindow; do it manually.

See also:
Clear

Member Data Documentation

int mpFXYVector::m_flags [protected]

Holds label alignment.

Reimplemented from mpFXY.

Definition at line 1362 of file mathplot.h.

size_t mpFXYVector::m_index [protected]

The internal counter for the "GetNextXY" interface.

Definition at line 1326 of file mathplot.h.

double mpFXYVector::m_maxX [protected]

Definition at line 1330 of file mathplot.h.

double mpFXYVector::m_maxY [protected]

Definition at line 1330 of file mathplot.h.

double mpFXYVector::m_minX [protected]

Loaded at SetData.

Definition at line 1330 of file mathplot.h.

double mpFXYVector::m_minY [protected]

Definition at line 1330 of file mathplot.h.

std::vector<double> mpFXYVector::m_xs [protected]

The internal copy of the set of data to draw.

Definition at line 1322 of file mathplot.h.

std::vector<double> mpFXYVector::m_ys [protected]

Definition at line 1322 of file mathplot.h.




Page generated by Doxygen 1.7.1 for MRPT 0.9.4 SVN: at Mon Jan 10 23:33:19 UTC 2011