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

mpWindow Class Reference


Detailed Description

Canvas for plotting mpLayer implementations.

This class defines a zoomable and moveable 2D plot canvas. Any number of mpLayer implementations (scale rulers, function plots, ...) can be attached using mpWindow::AddLayer.

The canvas window provides a context menu with actions for navigating the view. The context menu can be retrieved with mpWindow::GetPopupMenu, e.g. for extending it externally.

Since wxMathPlot version 0.03, the mpWindow incorporates the following features:

The mouse commands can be visualized by the user through the popup menu, and are:

Definition at line 833 of file mathplot.h.

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

List of all members.

Public Member Functions

 mpWindow ()
 mpWindow (wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long flags=0)
 ~mpWindow ()
wxMenu * GetPopupMenu ()
 Get reference to context menu of the plot canvas.
bool AddLayer (mpLayer *layer, bool refreshDisplay=true)
 Add a plot layer to the canvas.
bool DelLayer (mpLayer *layer, bool alsoDeleteObject=false, bool refreshDisplay=true)
 Remove a plot layer from the canvas.
void DelAllLayers (bool alsoDeleteObject, bool refreshDisplay=true)
 Remove all layers from the plot.
mpLayerGetLayer (int position)
mpLayerGetLayerByName (const wxString &name)
double GetXscl ()
 Get current view's X scale.
double GetScaleX (void) const
double GetYscl () const
 Get current view's Y scale.
double GetScaleY (void) const
double GetXpos () const
 Get current view's X position.
double GetPosX (void) const
double GetYpos () const
 Get current view's Y position.
double GetPosY (void) const
int GetScrX (void) const
 Get current view's X dimension in device context units.
int GetXScreen (void) const
int GetScrY (void) const
 Get current view's Y dimension in device context units.
int GetYScreen (void) const
void SetScaleX (double scaleX)
 Set current view's X scale and refresh display.
void SetScaleY (double scaleY)
 Set current view's Y scale and refresh display.
void SetPosX (double posX)
 Set current view's X position and refresh display.
void SetPosY (double posY)
 Set current view's Y position and refresh display.
void SetPos (double posX, double posY)
 Set current view's X and Y position and refresh display.
void SetScr (int scrX, int scrY)
 Set current view's dimensions in device context units.
double p2x (wxCoord pixelCoordX)
 Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates, using current mpWindow position and scale.
double p2y (wxCoord pixelCoordY)
 Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates, using current mpWindow position and scale.
wxCoord x2p (double x)
 Converts graph (floating point) coordinates into mpWindow (screen) pixel coordinates, using current mpWindow position and scale.
wxCoord y2p (double y)
 Converts graph (floating point) coordinates into mpWindow (screen) pixel coordinates, using current mpWindow position and scale.
void EnableDoubleBuffer (bool enabled)
 Enable/disable the double-buffering of the window, eliminating the flicker (default=disabled).
void EnableMousePanZoom (bool enabled)
 Enable/disable the feature of pan/zoom with the mouse (default=enabled)
void LockAspect (bool enable=TRUE)
 Enable or disable X/Y scale aspect locking for the view.
bool IsAspectLocked ()
 Checks whether the X/Y scale aspect is locked.
void Fit ()
 Set view to fit global bounding box of all plot layers and refresh display.
void Fit (double xMin, double xMax, double yMin, double yMax, wxCoord *printSizeX=NULL, wxCoord *printSizeY=NULL)
 Set view to fit a given bounding box and refresh display.
void ZoomIn (const wxPoint &centerPoint=wxDefaultPosition)
 Zoom into current view and refresh display.
void ZoomOut (const wxPoint &centerPoint=wxDefaultPosition)
 Zoom out current view and refresh display.
void ZoomInX ()
 Zoom in current view along X and refresh display.
void ZoomOutX ()
 Zoom out current view along X and refresh display.
void ZoomInY ()
 Zoom in current view along Y and refresh display.
void ZoomOutY ()
 Zoom out current view along Y and refresh display.
void ZoomRect (wxPoint p0, wxPoint p1)
 Zoom view fitting given coordinates to the window (p0 and p1 do not need to be in any specific order)
void UpdateAll ()
 Refresh display.
unsigned int CountLayers ()
 Counts the number of plot layers, excluding axes or text: this is to count only the layers which have a bounding box.
unsigned int CountAllLayers ()
 Counts the number of plot layers, whether or not they have a bounding box.
void ShowPrintDialog ()
 Draws the mpWindow on a page for printing.
double GetDesiredXmin ()
 Returns the left-border layer coordinate that the user wants the mpWindow to show (it may be not exactly the actual shown coordinate in the case of locked aspect ratio).
double GetDesiredXmax ()
 Returns the right-border layer coordinate that the user wants the mpWindow to show (it may be not exactly the actual shown coordinate in the case of locked aspect ratio).
double GetDesiredYmin ()
 Returns the bottom-border layer coordinate that the user wants the mpWindow to show (it may be not exactly the actual shown coordinate in the case of locked aspect ratio).
double GetDesiredYmax ()
 Returns the top layer-border coordinate that the user wants the mpWindow to show (it may be not exactly the actual shown coordinate in the case of locked aspect ratio).
void GetBoundingBox (double *bbox)
 Returns the bounding box coordinates.
void SetMPScrollbars (bool status)
 Enable/disable scrollbars.
bool GetMPScrollbars ()
 Get scrollbars status.
bool SaveScreenshot (const wxString &filename, int type=wxBITMAP_TYPE_BMP, wxSize imageSize=wxDefaultSize, bool fit=false)
 Draw the window on a wxBitmap, then save it to a file.
void SetMargins (int top, int right, int bottom, int left)
 Set window margins, creating a blank area where some kinds of layers cannot draw.
void SetMarginTop (int top)
 Set the top margin.
void SetMarginRight (int right)
 Set the right margin.
void SetMarginBottom (int bottom)
 Set the bottom margin.
void SetMarginLeft (int left)
 Set the left margin.
int GetMarginTop ()
 Get the top margin.
int GetMarginRight ()
 Get the right margin.
int GetMarginBottom ()
 Get the bottom margin.
int GetMarginLeft ()
 Get the left margin.
mpInfoLayerIsInsideInfoLayer (wxPoint &point)
 Sets whether to show coordinate tooltip when mouse passes over the plot.
void SetLayerVisible (const wxString &name, bool viewable)
 Sets the visibility of a layer by its name.
bool IsLayerVisible (const wxString &name)
 Check whether a layer with given name is visible.
void SetLayerVisible (const unsigned int position, bool viewable)
 Sets the visibility of a layer by its position in layer list.
bool IsLayerVisible (const unsigned int position)
 Check whether the layer at given position is visible.
void SetColourTheme (const wxColour &bgColour, const wxColour &drawColour, const wxColour &axesColour)
 Set Color theme.
const wxColour & GetAxesColour ()
 Get axes draw colour.

Static Public Attributes

static double zoomIncrementalFactor
 This value sets the zoom steps whenever the user clicks "Zoom in/out" or performs zoom with the mouse wheel.

Protected Member Functions

void OnPaint (wxPaintEvent &event)
 Paint handler, will plot all attached layers.
void OnSize (wxSizeEvent &event)
 Size handler, will update scroll bar sizes.
void OnShowPopupMenu (wxMouseEvent &event)
 Mouse handler, will show context menu.
void OnMouseRightDown (wxMouseEvent &event)
 Mouse handler, for detecting when the user drags with the right button or just "clicks" for the menu.
void OnCenter (wxCommandEvent &event)
 Context menu handler.
void OnFit (wxCommandEvent &event)
 Context menu handler.
void OnZoomIn (wxCommandEvent &event)
 Context menu handler.
void OnZoomOut (wxCommandEvent &event)
 Context menu handler.
void OnLockAspect (wxCommandEvent &event)
 Context menu handler.
void OnMouseHelp (wxCommandEvent &event)
 Context menu handler.
void OnPrintMenu (wxCommandEvent &event)
 Context menu handler.
void OnMouseWheel (wxMouseEvent &event)
 Mouse handler for the wheel.
void OnMouseMove (wxMouseEvent &event)
 Mouse handler for mouse motion (for pan)
void OnMouseLeftDown (wxMouseEvent &event)
 Mouse left click (for rect zoom)
void OnMouseLeftRelease (wxMouseEvent &event)
 Mouse left click (for rect zoom)
void OnScrollThumbTrack (wxScrollWinEvent &event)
 Scroll thumb on scroll bar moving.
void OnScrollPageUp (wxScrollWinEvent &event)
 Scroll page up.
void OnScrollPageDown (wxScrollWinEvent &event)
 Scroll page down.
void OnScrollLineUp (wxScrollWinEvent &event)
 Scroll line up.
void OnScrollLineDown (wxScrollWinEvent &event)
 Scroll line down.
void OnScrollTop (wxScrollWinEvent &event)
 Scroll to top.
void OnScrollBottom (wxScrollWinEvent &event)
 Scroll to bottom.
void DoScrollCalc (const int position, const int orientation)
void DoZoomInXCalc (const int staticXpixel)
void DoZoomInYCalc (const int staticYpixel)
void DoZoomOutXCalc (const int staticXpixel)
void DoZoomOutYCalc (const int staticYpixel)
virtual bool UpdateBBox ()
 Recalculate global layer bounding box, and save it in m_minX,...

Protected Attributes

wxLayerList m_layers
 List of attached plot layers.
wxMenu m_popmenu
 Canvas' context menu.
bool m_lockaspect
 Scale aspect is locked or not.
wxColour m_bgColour
 Background Colour.
wxColour m_fgColour
 Foreground Colour.
wxColour m_axColour
 Axes Colour.
double m_minX
 Global layer bounding box, left border incl.
double m_maxX
 Global layer bounding box, right border incl.
double m_minY
 Global layer bounding box, bottom border incl.
double m_maxY
 Global layer bounding box, top border incl.
double m_scaleX
 Current view's X scale.
double m_scaleY
 Current view's Y scale.
double m_posX
 Current view's X position.
double m_posY
 Current view's Y position.
int m_scrX
 Current view's X dimension.
int m_scrY
 Current view's Y dimension.
int m_clickedX
 Last mouse click X position, for centering and zooming the view.
int m_clickedY
 Last mouse click Y position, for centering and zooming the view.
double m_desiredXmin
 These are updated in Fit() only, and may be different from the real borders (layer coordinates) only if lock aspect ratio is true.
double m_desiredXmax
double m_desiredYmin
double m_desiredYmax
int m_marginTop
int m_marginRight
int m_marginBottom
int m_marginLeft
int m_last_lx
int m_last_ly
 For double buffering.
wxMemoryDC m_buff_dc
 For double buffering.
wxBitmap * m_buff_bmp
 For double buffering.
bool m_enableDoubleBuffer
 For double buffering.
bool m_enableMouseNavigation
 For pan/zoom with the mouse.
bool m_mouseMovedAfterRightClick
long m_mouseRClick_X
long m_mouseRClick_Y
 For the right button "drag" feature.
int m_mouseLClick_X
int m_mouseLClick_Y
 Starting coords for rectangular zoom selection.
bool m_enableScrollBars
int m_scrollX
int m_scrollY
mpInfoLayerm_movingInfoLayer
 For moving info layers over the window area.

Constructor & Destructor Documentation

mpWindow::mpWindow (  ) [inline]

Definition at line 836 of file mathplot.h.

mpWindow::mpWindow ( wxWindow *  parent,
wxWindowID  id,
const wxPoint &  pos = wxDefaultPosition,
const wxSize &  size = wxDefaultSize,
long  flags = 0 
)
mpWindow::~mpWindow (  )

Member Function Documentation

bool mpWindow::AddLayer ( mpLayer layer,
bool  refreshDisplay = true 
)

Add a plot layer to the canvas.

Parameters:
layerPointer to layer. The mpLayer object will get under control of mpWindow, i.e. it will be delete'd on mpWindow destruction
refreshDisplayStates whether to refresh the display (UpdateAll) after adding the layer.
Return values:
TRUESuccess
FALSEFailure due to out of memory.
unsigned int mpWindow::CountAllLayers (  ) [inline]

Counts the number of plot layers, whether or not they have a bounding box.

Returns:
The number of layers in the mpWindow.

Definition at line 1056 of file mathplot.h.

unsigned int mpWindow::CountLayers (  )

Counts the number of plot layers, excluding axes or text: this is to count only the layers which have a bounding box.

Returns:
The number of profiles plotted.
void mpWindow::DelAllLayers ( bool  alsoDeleteObject,
bool  refreshDisplay = true 
)

Remove all layers from the plot.

Parameters:
alsoDeleteObjectIf set to true, the mpLayer objects will be also "deleted", not just removed from the internal list.
refreshDisplayStates whether to refresh the display (UpdateAll) after removing the layers.
bool mpWindow::DelLayer ( mpLayer layer,
bool  alsoDeleteObject = false,
bool  refreshDisplay = true 
)

Remove a plot layer from the canvas.

Parameters:
layerPointer to layer. The mpLayer object will be destructed using delete.
alsoDeleteObjectIf set to true, the mpLayer object will be also "deleted", not just removed from the internal list.
refreshDisplayStates whether to refresh the display (UpdateAll) after removing the layer.
Returns:
true if layer is deleted correctly

N.B. Only the layer reference in the mpWindow is deleted, the layer object still exists!

void mpWindow::DoScrollCalc ( const int  position,
const int  orientation 
) [protected]
void mpWindow::DoZoomInXCalc ( const int  staticXpixel ) [protected]
void mpWindow::DoZoomInYCalc ( const int  staticYpixel ) [protected]
void mpWindow::DoZoomOutXCalc ( const int  staticXpixel ) [protected]
void mpWindow::DoZoomOutYCalc ( const int  staticYpixel ) [protected]
void mpWindow::EnableDoubleBuffer ( bool  enabled ) [inline]

Enable/disable the double-buffering of the window, eliminating the flicker (default=disabled).

Definition at line 989 of file mathplot.h.

void mpWindow::EnableMousePanZoom ( bool  enabled ) [inline]

Enable/disable the feature of pan/zoom with the mouse (default=enabled)

Definition at line 993 of file mathplot.h.

void mpWindow::Fit (  )

Set view to fit global bounding box of all plot layers and refresh display.

Scale and position will be set to show all attached mpLayers. The X/Y scale aspect lock is taken into account.

void mpWindow::Fit ( double  xMin,
double  xMax,
double  yMin,
double  yMax,
wxCoord *  printSizeX = NULL,
wxCoord *  printSizeY = NULL 
)

Set view to fit a given bounding box and refresh display.

The X/Y scale aspect lock is taken into account. If provided, the parameters printSizeX and printSizeY are taken as the DC size, and the pixel scales are computed accordingly. Also, in this case the passed borders are not saved as the "desired borders", since this use will be invoked only when printing.

const wxColour& mpWindow::GetAxesColour (  ) [inline]

Get axes draw colour.

Returns:
reference to axis colour used in theme

Definition at line 1175 of file mathplot.h.

void mpWindow::GetBoundingBox ( double *  bbox )

Returns the bounding box coordinates.

Parameters:
bboxPointer to a 6-element double array where to store bounding box coordinates.
double mpWindow::GetDesiredXmax (  ) [inline]

Returns the right-border layer coordinate that the user wants the mpWindow to show (it may be not exactly the actual shown coordinate in the case of locked aspect ratio).

See also:
Fit

Definition at line 1077 of file mathplot.h.

double mpWindow::GetDesiredXmin (  ) [inline]

Returns the left-border layer coordinate that the user wants the mpWindow to show (it may be not exactly the actual shown coordinate in the case of locked aspect ratio).

See also:
Fit

Definition at line 1072 of file mathplot.h.

double mpWindow::GetDesiredYmax (  ) [inline]

Returns the top layer-border coordinate that the user wants the mpWindow to show (it may be not exactly the actual shown coordinate in the case of locked aspect ratio).

See also:
Fit

Definition at line 1087 of file mathplot.h.

double mpWindow::GetDesiredYmin (  ) [inline]

Returns the bottom-border layer coordinate that the user wants the mpWindow to show (it may be not exactly the actual shown coordinate in the case of locked aspect ratio).

See also:
Fit

Definition at line 1082 of file mathplot.h.

mpLayer* mpWindow::GetLayer ( int  position )

Get the layer in list position indicated. N.B. You must know the index of the layer inside the list!

Parameters:
positionposition of the layer in the layers list
Returns:
pointer to mpLayer
mpLayer* mpWindow::GetLayerByName ( const wxString &  name )

Get the layer by its name (case sensitive).

Parameters:
nameThe name of the layer to retrieve
Returns:
A pointer to the mpLayer object, or NULL if not found.
int mpWindow::GetMarginBottom (  ) [inline]

Get the bottom margin.

Parameters:
bottomBottom Margin

Definition at line 1133 of file mathplot.h.

int mpWindow::GetMarginLeft (  ) [inline]

Get the left margin.

Parameters:
leftLeft Margin

Definition at line 1135 of file mathplot.h.

int mpWindow::GetMarginRight (  ) [inline]

Get the right margin.

Parameters:
rightRight Margin

Definition at line 1131 of file mathplot.h.

int mpWindow::GetMarginTop (  ) [inline]

Get the top margin.

Parameters:
topTop Margin

Definition at line 1129 of file mathplot.h.

bool mpWindow::GetMPScrollbars (  ) [inline]

Get scrollbars status.

Returns:
true if scrollbars are visible

Definition at line 1099 of file mathplot.h.

wxMenu* mpWindow::GetPopupMenu (  ) [inline]

Get reference to context menu of the plot canvas.

Returns:
Pointer to menu. The menu can be modified.

Definition at line 846 of file mathplot.h.

double mpWindow::GetPosX ( void   ) const [inline]

Definition at line 906 of file mathplot.h.

double mpWindow::GetPosY ( void   ) const [inline]

Definition at line 913 of file mathplot.h.

double mpWindow::GetScaleX ( void   ) const [inline]

Definition at line 892 of file mathplot.h.

double mpWindow::GetScaleY ( void   ) const [inline]

Definition at line 899 of file mathplot.h.

int mpWindow::GetScrX ( void   ) const [inline]

Get current view's X dimension in device context units.

Usually this is equal to wxDC::GetSize, but it might differ thus mpLayer implementations should rely on the value returned by the function. See rules for coordinate transformation

Returns:
X dimension.

Definition at line 921 of file mathplot.h.

int mpWindow::GetScrY ( void   ) const [inline]

Get current view's Y dimension in device context units.

Usually this is equal to wxDC::GetSize, but it might differ thus mpLayer implementations should rely on the value returned by the function. See rules for coordinate transformation

Returns:
Y dimension.

Definition at line 930 of file mathplot.h.

double mpWindow::GetXpos (  ) const [inline]

Get current view's X position.

See rules for coordinate transformation

Returns:
X Position in layer coordinate system, that corresponds to the center point of the view.

Definition at line 905 of file mathplot.h.

double mpWindow::GetXscl (  ) [inline]

Get current view's X scale.

See rules for coordinate transformation

Returns:
Scale

Definition at line 891 of file mathplot.h.

int mpWindow::GetXScreen ( void   ) const [inline]

Definition at line 922 of file mathplot.h.

double mpWindow::GetYpos (  ) const [inline]

Get current view's Y position.

See rules for coordinate transformation

Returns:
Y Position in layer coordinate system, that corresponds to the center point of the view.

Definition at line 912 of file mathplot.h.

double mpWindow::GetYscl (  ) const [inline]

Get current view's Y scale.

See rules for coordinate transformation

Returns:
Scale

Definition at line 898 of file mathplot.h.

int mpWindow::GetYScreen ( void   ) const [inline]

Definition at line 931 of file mathplot.h.

bool mpWindow::IsAspectLocked (  ) [inline]

Checks whether the X/Y scale aspect is locked.

Return values:
TRUELocked
FALSEUnlocked

Definition at line 1006 of file mathplot.h.

mpInfoLayer* mpWindow::IsInsideInfoLayer ( wxPoint &  point )

Sets whether to show coordinate tooltip when mouse passes over the plot.

Parameters:
valuetrue for enable, false for disable Gets coordinate tooltip status.
Returns:
true for enable, false for disable Check if a given point is inside the area of a mpInfoLayer and eventually returns its pointer.
Parameters:
pointThe position to be checked
Returns:
If an info layer is found, returns its pointer, NULL otherwise
bool mpWindow::IsLayerVisible ( const wxString &  name )

Check whether a layer with given name is visible.

Parameters:
nameThe layer name
Returns:
layer visibility status
bool mpWindow::IsLayerVisible ( const unsigned int  position )

Check whether the layer at given position is visible.

Parameters:
positionThe layer position in layer list
Returns:
layer visibility status
void mpWindow::LockAspect ( bool  enable = TRUE )

Enable or disable X/Y scale aspect locking for the view.

Note:
Explicit calls to mpWindow::SetScaleX and mpWindow::SetScaleY will set an unlocked aspect, but any other action changing the view scale will lock the aspect again.
void mpWindow::OnCenter ( wxCommandEvent &  event ) [protected]

Context menu handler.

void mpWindow::OnFit ( wxCommandEvent &  event ) [protected]

Context menu handler.

void mpWindow::OnLockAspect ( wxCommandEvent &  event ) [protected]

Context menu handler.

void mpWindow::OnMouseHelp ( wxCommandEvent &  event ) [protected]

Context menu handler.

void mpWindow::OnMouseLeftDown ( wxMouseEvent &  event ) [protected]

Mouse left click (for rect zoom)

void mpWindow::OnMouseLeftRelease ( wxMouseEvent &  event ) [protected]

Mouse left click (for rect zoom)

void mpWindow::OnMouseMove ( wxMouseEvent &  event ) [protected]

Mouse handler for mouse motion (for pan)

void mpWindow::OnMouseRightDown ( wxMouseEvent &  event ) [protected]

Mouse handler, for detecting when the user drags with the right button or just "clicks" for the menu.

void mpWindow::OnMouseWheel ( wxMouseEvent &  event ) [protected]

Mouse handler for the wheel.

void mpWindow::OnPaint ( wxPaintEvent &  event ) [protected]

Paint handler, will plot all attached layers.

void mpWindow::OnPrintMenu ( wxCommandEvent &  event ) [protected]

Context menu handler.

void mpWindow::OnScrollBottom ( wxScrollWinEvent &  event ) [protected]

Scroll to bottom.

void mpWindow::OnScrollLineDown ( wxScrollWinEvent &  event ) [protected]

Scroll line down.

void mpWindow::OnScrollLineUp ( wxScrollWinEvent &  event ) [protected]

Scroll line up.

void mpWindow::OnScrollPageDown ( wxScrollWinEvent &  event ) [protected]

Scroll page down.

void mpWindow::OnScrollPageUp ( wxScrollWinEvent &  event ) [protected]

Scroll page up.

void mpWindow::OnScrollThumbTrack ( wxScrollWinEvent &  event ) [protected]

Scroll thumb on scroll bar moving.

void mpWindow::OnScrollTop ( wxScrollWinEvent &  event ) [protected]

Scroll to top.

void mpWindow::OnShowPopupMenu ( wxMouseEvent &  event ) [protected]

Mouse handler, will show context menu.

void mpWindow::OnSize ( wxSizeEvent &  event ) [protected]

Size handler, will update scroll bar sizes.

void mpWindow::OnZoomIn ( wxCommandEvent &  event ) [protected]

Context menu handler.

void mpWindow::OnZoomOut ( wxCommandEvent &  event ) [protected]

Context menu handler.

double mpWindow::p2x ( wxCoord  pixelCoordX ) [inline]

Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates, using current mpWindow position and scale.

See also:
p2y,x2p,y2p

Definition at line 969 of file mathplot.h.

double mpWindow::p2y ( wxCoord  pixelCoordY ) [inline]

Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates, using current mpWindow position and scale.

See also:
p2x,x2p,y2p

Definition at line 974 of file mathplot.h.

bool mpWindow::SaveScreenshot ( const wxString &  filename,
int  type = wxBITMAP_TYPE_BMP,
wxSize  imageSize = wxDefaultSize,
bool  fit = false 
)

Draw the window on a wxBitmap, then save it to a file.

Parameters:
filenameFile name where to save the screenshot
typeimage type to be saved: see wxImage output file types for flags
imageSizeSet a size for the output image. Default is the same as the screen size
fitDecide whether to fit the plot into the size
void mpWindow::SetColourTheme ( const wxColour &  bgColour,
const wxColour &  drawColour,
const wxColour &  axesColour 
)

Set Color theme.

Provide colours to set a new colour theme.

Parameters:
bgColourBackground colour
drawColourThe colour used to draw all elements in foreground, axes excluded
axesColourThe colour used to draw axes (but not their labels)
void mpWindow::SetLayerVisible ( const wxString &  name,
bool  viewable 
)

Sets the visibility of a layer by its name.

Parameters:
nameThe layer name to set visibility
viewablethe view status to be set
void mpWindow::SetLayerVisible ( const unsigned int  position,
bool  viewable 
)

Sets the visibility of a layer by its position in layer list.

Parameters:
positionThe layer position in layer list
viewablethe view status to be set
void mpWindow::SetMarginBottom ( int  bottom ) [inline]

Set the bottom margin.

Parameters:
bottomBottom Margin

Definition at line 1124 of file mathplot.h.

void mpWindow::SetMarginLeft ( int  left ) [inline]

Set the left margin.

Parameters:
leftLeft Margin

Definition at line 1126 of file mathplot.h.

void mpWindow::SetMarginRight ( int  right ) [inline]

Set the right margin.

Parameters:
rightRight Margin

Definition at line 1122 of file mathplot.h.

void mpWindow::SetMargins ( int  top,
int  right,
int  bottom,
int  left 
)

Set window margins, creating a blank area where some kinds of layers cannot draw.

This is useful for example to draw axes outside the area where the plots are drawn.

Parameters:
topTop border
rightRight border
bottomBottom border
leftLeft border
void mpWindow::SetMarginTop ( int  top ) [inline]

Set the top margin.

Parameters:
topTop Margin

Definition at line 1120 of file mathplot.h.

void mpWindow::SetMPScrollbars ( bool  status )

Enable/disable scrollbars.

Parameters:
statusSet to true to show scrollbars
void mpWindow::SetPos ( double  posX,
double  posY 
) [inline]

Set current view's X and Y position and refresh display.

Parameters:
posXNew position that corresponds to the center point of the view.
posYNew position that corresponds to the center point of the view.

Definition at line 957 of file mathplot.h.

void mpWindow::SetPosX ( double  posX ) [inline]

Set current view's X position and refresh display.

Parameters:
posXNew position that corresponds to the center point of the view.

Definition at line 946 of file mathplot.h.

void mpWindow::SetPosY ( double  posY ) [inline]

Set current view's Y position and refresh display.

Parameters:
posYNew position that corresponds to the center point of the view.

Definition at line 951 of file mathplot.h.

void mpWindow::SetScaleX ( double  scaleX )

Set current view's X scale and refresh display.

Parameters:
scaleXNew scale, must not be 0.
void mpWindow::SetScaleY ( double  scaleY ) [inline]

Set current view's Y scale and refresh display.

Parameters:
scaleYNew scale, must not be 0.

Definition at line 941 of file mathplot.h.

void mpWindow::SetScr ( int  scrX,
int  scrY 
) [inline]

Set current view's dimensions in device context units.

Needed by plotting functions. It doesn't refresh display.

Parameters:
scrXNew position that corresponds to the center point of the view.
scrYNew position that corresponds to the center point of the view.

Definition at line 964 of file mathplot.h.

void mpWindow::ShowPrintDialog (  ) [inline]

Draws the mpWindow on a page for printing.

Parameters:
printthe mpPrintout where to print the graph

Definition at line 1062 of file mathplot.h.

void mpWindow::UpdateAll (  )

Refresh display.

virtual bool mpWindow::UpdateBBox (  ) [protected, virtual]

Recalculate global layer bounding box, and save it in m_minX,...

Returns:
true if there is any valid BBox information.
wxCoord mpWindow::x2p ( double  x ) [inline]

Converts graph (floating point) coordinates into mpWindow (screen) pixel coordinates, using current mpWindow position and scale.

See also:
p2x,p2y,y2p

Definition at line 979 of file mathplot.h.

wxCoord mpWindow::y2p ( double  y ) [inline]

Converts graph (floating point) coordinates into mpWindow (screen) pixel coordinates, using current mpWindow position and scale.

See also:
p2x,p2y,x2p

Definition at line 984 of file mathplot.h.

References internal::y.

void mpWindow::ZoomIn ( const wxPoint &  centerPoint = wxDefaultPosition )

Zoom into current view and refresh display.

Parameters:
centerPointThe point (pixel coordinates) that will stay in the same position on the screen after the zoom (by default, the center of the mpWindow).
void mpWindow::ZoomInX (  )

Zoom in current view along X and refresh display.

void mpWindow::ZoomInY (  )

Zoom in current view along Y and refresh display.

void mpWindow::ZoomOut ( const wxPoint &  centerPoint = wxDefaultPosition )

Zoom out current view and refresh display.

Parameters:
centerPointThe point (pixel coordinates) that will stay in the same position on the screen after the zoom (by default, the center of the mpWindow).
void mpWindow::ZoomOutX (  )

Zoom out current view along X and refresh display.

void mpWindow::ZoomOutY (  )

Zoom out current view along Y and refresh display.

void mpWindow::ZoomRect ( wxPoint  p0,
wxPoint  p1 
)

Zoom view fitting given coordinates to the window (p0 and p1 do not need to be in any specific order)


Member Data Documentation

wxColour mpWindow::m_axColour [protected]

Axes Colour.

Definition at line 1221 of file mathplot.h.

wxColour mpWindow::m_bgColour [protected]

Background Colour.

Definition at line 1219 of file mathplot.h.

wxBitmap* mpWindow::m_buff_bmp [protected]

For double buffering.

Definition at line 1244 of file mathplot.h.

wxMemoryDC mpWindow::m_buff_dc [protected]

For double buffering.

Definition at line 1243 of file mathplot.h.

int mpWindow::m_clickedX [protected]

Last mouse click X position, for centering and zooming the view.

Definition at line 1233 of file mathplot.h.

int mpWindow::m_clickedY [protected]

Last mouse click Y position, for centering and zooming the view.

Definition at line 1234 of file mathplot.h.

double mpWindow::m_desiredXmax [protected]

Definition at line 1238 of file mathplot.h.

double mpWindow::m_desiredXmin [protected]

These are updated in Fit() only, and may be different from the real borders (layer coordinates) only if lock aspect ratio is true.

Definition at line 1238 of file mathplot.h.

double mpWindow::m_desiredYmax [protected]

Definition at line 1238 of file mathplot.h.

double mpWindow::m_desiredYmin [protected]

Definition at line 1238 of file mathplot.h.

For double buffering.

Definition at line 1245 of file mathplot.h.

For pan/zoom with the mouse.

Definition at line 1246 of file mathplot.h.

bool mpWindow::m_enableScrollBars [protected]

Definition at line 1250 of file mathplot.h.

wxColour mpWindow::m_fgColour [protected]

Foreground Colour.

Definition at line 1220 of file mathplot.h.

int mpWindow::m_last_lx [protected]

Definition at line 1242 of file mathplot.h.

int mpWindow::m_last_ly [protected]

For double buffering.

Definition at line 1242 of file mathplot.h.

List of attached plot layers.

Definition at line 1215 of file mathplot.h.

bool mpWindow::m_lockaspect [protected]

Scale aspect is locked or not.

Definition at line 1217 of file mathplot.h.

int mpWindow::m_marginBottom [protected]

Definition at line 1240 of file mathplot.h.

int mpWindow::m_marginLeft [protected]

Definition at line 1240 of file mathplot.h.

int mpWindow::m_marginRight [protected]

Definition at line 1240 of file mathplot.h.

int mpWindow::m_marginTop [protected]

Definition at line 1240 of file mathplot.h.

double mpWindow::m_maxX [protected]

Global layer bounding box, right border incl.

Definition at line 1224 of file mathplot.h.

double mpWindow::m_maxY [protected]

Global layer bounding box, top border incl.

Definition at line 1226 of file mathplot.h.

double mpWindow::m_minX [protected]

Global layer bounding box, left border incl.

Definition at line 1223 of file mathplot.h.

double mpWindow::m_minY [protected]

Global layer bounding box, bottom border incl.

Definition at line 1225 of file mathplot.h.

int mpWindow::m_mouseLClick_X [protected]

Definition at line 1249 of file mathplot.h.

int mpWindow::m_mouseLClick_Y [protected]

Starting coords for rectangular zoom selection.

Definition at line 1249 of file mathplot.h.

Definition at line 1247 of file mathplot.h.

long mpWindow::m_mouseRClick_X [protected]

Definition at line 1248 of file mathplot.h.

long mpWindow::m_mouseRClick_Y [protected]

For the right button "drag" feature.

Definition at line 1248 of file mathplot.h.

For moving info layers over the window area.

Definition at line 1252 of file mathplot.h.

wxMenu mpWindow::m_popmenu [protected]

Canvas' context menu.

Definition at line 1216 of file mathplot.h.

double mpWindow::m_posX [protected]

Current view's X position.

Definition at line 1229 of file mathplot.h.

double mpWindow::m_posY [protected]

Current view's Y position.

Definition at line 1230 of file mathplot.h.

double mpWindow::m_scaleX [protected]

Current view's X scale.

Definition at line 1227 of file mathplot.h.

double mpWindow::m_scaleY [protected]

Current view's Y scale.

Definition at line 1228 of file mathplot.h.

int mpWindow::m_scrollX [protected]

Definition at line 1251 of file mathplot.h.

int mpWindow::m_scrollY [protected]

Definition at line 1251 of file mathplot.h.

int mpWindow::m_scrX [protected]

Current view's X dimension.

Definition at line 1231 of file mathplot.h.

int mpWindow::m_scrY [protected]

Current view's Y dimension.

Definition at line 1232 of file mathplot.h.

This value sets the zoom steps whenever the user clicks "Zoom in/out" or performs zoom with the mouse wheel.

It must be a number above unity. This number is used for zoom in, and its inverse for zoom out. Set to 1.5 by default.

Definition at line 1110 of file mathplot.h.




Page generated by Doxygen 1.7.2 for MRPT 0.9.4 SVN: at Mon Jan 10 22:30:30 UTC 2011