Main Page | Class Hierarchy | Class List | Directories | File List | Class Members

FXPlot2D Class Reference

Class for visualizing FXCurve's in a 2D plot. More...

#include <FXPlot2D.h>

Inheritance diagram for FXPlot2D:

FXPlotBase FXSPC List of all members.

Public Types

enum  Commands {
  ID_FIRST = FXPlotBase::ID_LAST,
  ID_ZOOM_OUT,
  ID_SHOW_ALL,
  ID_GRID,
  ID_LEGEND,
  ID_SAVE,
  ID_PROPERTIES,
  ID_LAST
}

Public Member Functions

 FXPlot2D (FXComposite *parent, FXString name)
 Constructs an empty FXPlot2D widget.
 ~FXPlot2D ()
 Destructor, releases the owned FXCurve's.
void setRangesShowAll (void)
 Set the ranges of the plot to show all the data of all curves.
FXCurveaddCurve (const FXString &label, FXCurveData *x, FXCurveData *y, FXCurve::CurveStyle style=FXCurve::Lines)
 Create a new FXCurve.
void addCurve (FXCurve *FXCurve)
 Add a new FXCurve to the plot.
void removeCurve (FXCurve *FXCurve, FXbool del=TRUE)
 Remove the FXCurve FXCurve.
void removeAllCurves ()
 Remove all curves deleting them.
void setRanges (double xmin, double xmax, double ymin, double ymax)
 Set the visible ranges of the first FXAxis set.
void setLegend (FXbool on=TRUE)
 Set the legend visible.
void setGrid (FXbool on=TRUE)
 Set the grid visible.
void drawSelf (FXDC *dc, FXint rootx, FXint rooty)
 Draw this plot in the device context dc.
void create (void)
void layout (void)
void recalc (void)
long onZoomOut (FXObject *obj, FXSelector sel, void *ptr)
long onShowAll (FXObject *, FXSelector, void *ptr)
long onProperties (FXObject *obj, FXSelector sel, void *ptr)
long onCmdToogleGrid (FXObject *obj, FXSelector sel, void *ptr)
long onCmdToogleLegend (FXObject *obj, FXSelector sel, void *ptr)
long onLeftBtnPress (FXObject *, FXSelector, void *ptr)
long onLeftBtnRelease (FXObject *, FXSelector, void *ptr)
long onMotion (FXObject *, FXSelector, void *ptr)
long onRightBtnPress (FXObject *, FXSelector, void *ptr)
long onKeyPress (FXObject *, FXSelector, void *ptr)
long onKeyRelease (FXObject *, FXSelector, void *ptr)
long onFocusOut (FXObject *, FXSelector, void *ptr)
std::vector< FXCurve
* >::iterator 
curveBegin (void)
 First curve iterator.
std::vector< FXCurve
* >::iterator 
curveEnd (void)
 Past end curve iterator.
FXAxisgetBottomAxis ()
 Return a pointer to the bottom FXAxis.
FXAxisgetTopAxis ()
 Return a pointer to the top FXAxis.
FXAxisgetLeftAxis ()
 Return a pointer to the left FXAxis.
FXAxisgetRightAxis ()
 Return a pointer to the right FXAxis.

Public Attributes

FXRectangle plotRect
 Rectangle for the curves (the remaining area of the zoom).

Protected Types

enum  Modes {
  ZoomInMode = 0x0001,
  ZoomOutMode = 0x0002,
  ZoomMask = 0x000f,
  LegendShown = 0x0010,
  LegendMoving = 0x0020,
  LegendMask = 0x00f0,
  GridShown = 0x0100
}
 Flags for zooming or legend moving.

Protected Member Functions

 FXPlot2D ()
void updateCurves (void)
 Mark all the FXCurve's of this plot as not calculated.
void drawPlot (FXDC *dc, FXint rootx, FXint rooty)
 Draw the curves in the device context dc.
void drawLegend (FXDC *dc, FXint rootx, FXint rooty)
 Draw the legend in the device context dc.
void drawGrid (FXDC *dc, FXint rootx, FXint rooty)
 Draw the grid in the device context dc.
void drawAuxWindows (FXDC *dc, FXint rootx, FXint rooty)
 Draw the auxiliary windows in the device context dc (zoom window and legend moving).
void updateCursor (FXEvent *event)
 Update the cursor (zoom in, out, etc).
void setRanges (const FXDoubleRect &rect)
 Set the visible ranges of the plot to rect.
void newFactor ()
 Recalculate the conversion factor.

Static Protected Member Functions

static void putRectangleInside (FXRectangle &outer, FXRectangle &r)
 Function used to guarantee that r is inside of outer.

Protected Attributes

std::vector< FXCurve * > curves
 The curves on this plot.
FXCurveselCurve
 Current selectec FXCurve.
FXPlotPen auxW
 Pen for the auxiliary windows (zoom rectangle).
bool _bgRepaint
FXRectangle legendRect
FXRectangle legendRect2
FXFont * legendFont
 Font for the legend.
FXint flags
 Flags (zomming, legend moving...).
FXPoint zoominit
 Inital point of zoom.
FXPoint zoomfinal
 Final (current) point of zoom.
FXMenuPane * mainmenu
FXMenuPane * curvesmenu
FXCursor * zoomin
 Zoom in cursor.
FXCursor * zoomout
 Zoom out cursor.
FXAxisaxisx [2]
 X FXAxis.
FXAxisaxisy [2]
 Y FXAxis.

Detailed Description

Class for visualizing FXCurve's in a 2D plot.

The FXPlot2D class can be used to show FXCurve's in a 2D way. Are provided methods for zooming.

The plot has four FXAxis, each one represented by the class FXAxis. Each FXCurve is related to two different FXAxis.

New curves can be added to the plot by the addCurve() methods and can be removed with removeCurve().

See also:
FXAxis and FXCurve.

Definition at line 68 of file FXPlot2D.h.


Member Function Documentation

void FXPlot2D::addCurve FXCurve FXCurve  ) 
 

Add a new FXCurve to the plot.

This function adds FXCurve to the plot and set the FXAxis of this FXCurve to Bottom and Right.

See also:
FXCurve and FXAxis.

FXCurve* FXPlot2D::addCurve const FXString &  label,
FXCurveData x,
FXCurveData y,
FXCurve::CurveStyle  style = FXCurve::Lines
 

Create a new FXCurve.

This function new FXCurve named name, given the vectors x and and add it to the Plot2D with the function addCurve(FXCurve *FXCurve);

void FXPlot2D::removeAllCurves  ) 
 

Remove all curves deleting them.

This function is equivalent to call removeCurve() for all curves.

void FXPlot2D::removeCurve FXCurve FXCurve,
FXbool  del = TRUE
 

Remove the FXCurve FXCurve.

If del is TRUE the curve is deleted.

void FXPlot2D::updateCurves void   )  [protected]
 

Mark all the FXCurve's of this plot as not calculated.

When redimensioning or zooming the plot the curves became invalid, so this function is called.


Member Data Documentation

FXRectangle FXPlot2D::plotRect
 

Rectangle for the curves (the remaining area of the zoom).

FIXME: update the layout mechanism of FXAxis and make it protected.

Definition at line 154 of file FXPlot2D.h.


The documentation for this class was generated from the following file:
Generated on Tue Jan 31 10:55:30 2006 for FXPlot by  doxygen 1.4.4