Main MRPT website > C++ reference for MRPT 1.4.0
List of all members | 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 841 of file mathplot.h.

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

Inheritance diagram for mpWindow:
Inheritance graph

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. More...
 
bool AddLayer (mpLayer *layer, bool refreshDisplay=true)
 Add a plot layer to the canvas. More...
 
bool DelLayer (mpLayer *layer, bool alsoDeleteObject=false, bool refreshDisplay=true)
 Remove a plot layer from the canvas. More...
 
void DelAllLayers (bool alsoDeleteObject, bool refreshDisplay=true)
 Remove all layers from the plot. More...
 
mpLayerGetLayer (int position)
 
mpLayerGetLayerByName (const wxString &name)
 
double GetXscl ()
 Get current view's X scale. More...
 
double GetScaleX (void) const
 
double GetYscl () const
 Get current view's Y scale. More...
 
double GetScaleY (void) const
 
double GetXpos () const
 Get current view's X position. More...
 
double GetPosX (void) const
 
double GetYpos () const
 Get current view's Y position. More...
 
double GetPosY (void) const
 
int GetScrX (void) const
 Get current view's X dimension in device context units. More...
 
int GetXScreen (void) const
 
int GetScrY (void) const
 Get current view's Y dimension in device context units. More...
 
int GetYScreen (void) const
 
void SetScaleX (double scaleX)
 Set current view's X scale and refresh display. More...
 
void SetScaleY (double scaleY)
 Set current view's Y scale and refresh display. More...
 
void SetPosX (double posX)
 Set current view's X position and refresh display. More...
 
void SetPosY (double posY)
 Set current view's Y position and refresh display. More...
 
void SetPos (double posX, double posY)
 Set current view's X and Y position and refresh display. More...
 
void SetScr (int scrX, int scrY)
 Set current view's dimensions in device context units. More...
 
double p2x (wxCoord pixelCoordX)
 Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates, using current mpWindow position and scale. More...
 
double p2y (wxCoord pixelCoordY)
 Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates, using current mpWindow position and scale. More...
 
wxCoord x2p (double x)
 Converts graph (floating point) coordinates into mpWindow (screen) pixel coordinates, using current mpWindow position and scale. More...
 
wxCoord y2p (double y)
 Converts graph (floating point) coordinates into mpWindow (screen) pixel coordinates, using current mpWindow position and scale. More...
 
void EnableDoubleBuffer (bool enabled)
 Enable/disable the double-buffering of the window, eliminating the flicker (default=disabled). More...
 
void EnableMousePanZoom (bool enabled)
 Enable/disable the feature of pan/zoom with the mouse (default=enabled) More...
 
void LockAspect (bool enable=TRUE)
 Enable or disable X/Y scale aspect locking for the view. More...
 
bool IsAspectLocked ()
 Checks whether the X/Y scale aspect is locked. More...
 
void Fit ()
 Set view to fit global bounding box of all plot layers and refresh display. More...
 
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. More...
 
void ZoomIn (const wxPoint &centerPoint=wxDefaultPosition)
 Zoom into current view and refresh display. More...
 
void ZoomOut (const wxPoint &centerPoint=wxDefaultPosition)
 Zoom out current view and refresh display. More...
 
void ZoomInX ()
 Zoom in current view along X and refresh display. More...
 
void ZoomOutX ()
 Zoom out current view along X and refresh display. More...
 
void ZoomInY ()
 Zoom in current view along Y and refresh display. More...
 
void ZoomOutY ()
 Zoom out current view along Y and refresh display. More...
 
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) More...
 
void UpdateAll ()
 Refresh display. More...
 
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. More...
 
size_t CountAllLayers ()
 Counts the number of plot layers, whether or not they have a bounding box. More...
 
void ShowPrintDialog ()
 Draws the mpWindow on a page for printing. More...
 
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). More...
 
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). More...
 
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). More...
 
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). More...
 
void GetBoundingBox (double *bbox)
 Returns the bounding box coordinates. More...
 
void SetMPScrollbars (bool status)
 Enable/disable scrollbars. More...
 
bool GetMPScrollbars ()
 Get scrollbars status. More...
 
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. More...
 
void SetMargins (int top, int right, int bottom, int left)
 Set window margins, creating a blank area where some kinds of layers cannot draw. More...
 
void SetMarginTop (int top)
 Set the top margin. More...
 
void SetMarginRight (int right)
 Set the right margin. More...
 
void SetMarginBottom (int bottom)
 Set the bottom margin. More...
 
void SetMarginLeft (int left)
 Set the left margin. More...
 
int GetMarginTop ()
 Get the top margin. More...
 
int GetMarginRight ()
 Get the right margin. More...
 
int GetMarginBottom ()
 Get the bottom margin. More...
 
int GetMarginLeft ()
 Get the left margin. More...
 
mpInfoLayerIsInsideInfoLayer (wxPoint &point)
 Sets whether to show coordinate tooltip when mouse passes over the plot. More...
 
void SetLayerVisible (const wxString &name, bool viewable)
 Sets the visibility of a layer by its name. More...
 
bool IsLayerVisible (const wxString &name)
 Check whether a layer with given name is visible. More...
 
void SetLayerVisible (const unsigned int position, bool viewable)
 Sets the visibility of a layer by its position in layer list. More...
 
bool IsLayerVisible (const unsigned int position)
 Check whether the layer at given position is visible. More...
 
void SetColourTheme (const wxColour &bgColour, const wxColour &drawColour, const wxColour &axesColour)
 Set Color theme. More...
 
const wxColour & GetAxesColour ()
 Get axes draw colour. More...
 
virtual bool UpdateBBox ()
 Recalculate global layer bounding box, and save it in m_minX,... More...
 

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. More...
 

Protected Member Functions

void OnPaint (wxPaintEvent &event)
 Paint handler, will plot all attached layers. More...
 
void OnSize (wxSizeEvent &event)
 Size handler, will update scroll bar sizes. More...
 
void OnShowPopupMenu (wxMouseEvent &event)
 Mouse handler, will show context menu. More...
 
void OnMouseRightDown (wxMouseEvent &event)
 Mouse handler, for detecting when the user drags with the right button or just "clicks" for the menu. More...
 
void OnCenter (wxCommandEvent &event)
 Context menu handler. More...
 
void OnFit (wxCommandEvent &event)
 Context menu handler. More...
 
void OnZoomIn (wxCommandEvent &event)
 Context menu handler. More...
 
void OnZoomOut (wxCommandEvent &event)
 Context menu handler. More...
 
void OnLockAspect (wxCommandEvent &event)
 Context menu handler. More...
 
void OnMouseHelp (wxCommandEvent &event)
 Context menu handler. More...
 
void OnPrintMenu (wxCommandEvent &event)
 Context menu handler. More...
 
void OnMouseWheel (wxMouseEvent &event)
 Mouse handler for the wheel. More...
 
void OnMouseMove (wxMouseEvent &event)
 Mouse handler for mouse motion (for pan) More...
 
void OnMouseLeftDown (wxMouseEvent &event)
 Mouse left click (for rect zoom) More...
 
void OnMouseLeftRelease (wxMouseEvent &event)
 Mouse left click (for rect zoom) More...
 
void OnScrollThumbTrack (wxScrollWinEvent &event)
 Scroll thumb on scroll bar moving. More...
 
void OnScrollPageUp (wxScrollWinEvent &event)
 Scroll page up. More...
 
void OnScrollPageDown (wxScrollWinEvent &event)
 Scroll page down. More...
 
void OnScrollLineUp (wxScrollWinEvent &event)
 Scroll line up. More...
 
void OnScrollLineDown (wxScrollWinEvent &event)
 Scroll line down. More...
 
void OnScrollTop (wxScrollWinEvent &event)
 Scroll to top. More...
 
void OnScrollBottom (wxScrollWinEvent &event)
 Scroll to bottom. More...
 
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)
 

Protected Attributes

wxLayerList m_layers
 List of attached plot layers. More...
 
wxMenu m_popmenu
 Canvas' context menu. More...
 
bool m_lockaspect
 Scale aspect is locked or not. More...
 
wxColour m_bgColour
 Background Colour. More...
 
wxColour m_fgColour
 Foreground Colour. More...
 
wxColour m_axColour
 Axes Colour. More...
 
double m_minX
 Global layer bounding box, left border incl. More...
 
double m_maxX
 Global layer bounding box, right border incl. More...
 
double m_minY
 Global layer bounding box, bottom border incl. More...
 
double m_maxY
 Global layer bounding box, top border incl. More...
 
double m_scaleX
 Current view's X scale. More...
 
double m_scaleY
 Current view's Y scale. More...
 
double m_posX
 Current view's X position. More...
 
double m_posY
 Current view's Y position. More...
 
int m_scrX
 Current view's X dimension. More...
 
int m_scrY
 Current view's Y dimension. More...
 
int m_clickedX
 Last mouse click X position, for centering and zooming the view. More...
 
int m_clickedY
 Last mouse click Y position, for centering and zooming the view. More...
 
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. More...
 
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. More...
 
wxMemoryDC m_buff_dc
 For double buffering. More...
 
wxBitmap * m_buff_bmp
 For double buffering. More...
 
bool m_enableDoubleBuffer
 For double buffering. More...
 
bool m_enableMouseNavigation
 For pan/zoom with the mouse. More...
 
bool m_mouseMovedAfterRightClick
 
long m_mouseRClick_X
 
long m_mouseRClick_Y
 For the right button "drag" feature. More...
 
int m_mouseLClick_X
 
int m_mouseLClick_Y
 Starting coords for rectangular zoom selection. More...
 
bool m_enableScrollBars
 
int m_scrollX
 
int m_scrollY
 
mpInfoLayerm_movingInfoLayer
 For moving info layers over the window area. More...
 

Constructor & Destructor Documentation

◆ mpWindow() [1/2]

mpWindow::mpWindow ( )
inline

Definition at line 844 of file mathplot.h.

References mpWindow, and mrpt::math::size().

◆ mpWindow() [2/2]

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

◆ ~mpWindow()

mpWindow::~mpWindow ( )

Member Function Documentation

◆ AddLayer()

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.

◆ CountAllLayers()

size_t 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 1064 of file mathplot.h.

◆ CountLayers()

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.

◆ DelAllLayers()

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.

◆ DelLayer()

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!

◆ DoScrollCalc()

void mpWindow::DoScrollCalc ( const int  position,
const int  orientation 
)
protected

◆ DoZoomInXCalc()

void mpWindow::DoZoomInXCalc ( const int  staticXpixel)
protected

◆ DoZoomInYCalc()

void mpWindow::DoZoomInYCalc ( const int  staticYpixel)
protected

◆ DoZoomOutXCalc()

void mpWindow::DoZoomOutXCalc ( const int  staticXpixel)
protected

◆ DoZoomOutYCalc()

void mpWindow::DoZoomOutYCalc ( const int  staticYpixel)
protected

◆ EnableDoubleBuffer()

void mpWindow::EnableDoubleBuffer ( bool  enabled)
inline

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

Definition at line 997 of file mathplot.h.

◆ EnableMousePanZoom()

void mpWindow::EnableMousePanZoom ( bool  enabled)
inline

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

Definition at line 1001 of file mathplot.h.

◆ Fit() [1/2]

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.

◆ Fit() [2/2]

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.

◆ GetAxesColour()

const wxColour& mpWindow::GetAxesColour ( )
inline

Get axes draw colour.

Returns
reference to axis colour used in theme

Definition at line 1183 of file mathplot.h.

◆ GetBoundingBox()

void mpWindow::GetBoundingBox ( double *  bbox)

Returns the bounding box coordinates.

Parameters
bboxPointer to a 6-element double array where to store bounding box coordinates.

◆ GetDesiredXmax()

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 1085 of file mathplot.h.

◆ GetDesiredXmin()

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 1080 of file mathplot.h.

◆ GetDesiredYmax()

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 1095 of file mathplot.h.

◆ GetDesiredYmin()

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 1090 of file mathplot.h.

◆ GetLayer()

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

◆ GetLayerByName()

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.

◆ GetMarginBottom()

int mpWindow::GetMarginBottom ( )
inline

Get the bottom margin.

Parameters
bottomBottom Margin

Definition at line 1141 of file mathplot.h.

◆ GetMarginLeft()

int mpWindow::GetMarginLeft ( )
inline

Get the left margin.

Parameters
leftLeft Margin

Definition at line 1143 of file mathplot.h.

◆ GetMarginRight()

int mpWindow::GetMarginRight ( )
inline

Get the right margin.

Parameters
rightRight Margin

Definition at line 1139 of file mathplot.h.

◆ GetMarginTop()

int mpWindow::GetMarginTop ( )
inline

Get the top margin.

Parameters
topTop Margin

Definition at line 1137 of file mathplot.h.

◆ GetMPScrollbars()

bool mpWindow::GetMPScrollbars ( )
inline

Get scrollbars status.

Returns
true if scrollbars are visible

Definition at line 1107 of file mathplot.h.

◆ GetPopupMenu()

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 854 of file mathplot.h.

◆ GetPosX()

double mpWindow::GetPosX ( void  ) const
inline

Definition at line 914 of file mathplot.h.

◆ GetPosY()

double mpWindow::GetPosY ( void  ) const
inline

Definition at line 921 of file mathplot.h.

◆ GetScaleX()

double mpWindow::GetScaleX ( void  ) const
inline

Definition at line 900 of file mathplot.h.

◆ GetScaleY()

double mpWindow::GetScaleY ( void  ) const
inline

Definition at line 907 of file mathplot.h.

◆ GetScrX()

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 929 of file mathplot.h.

◆ GetScrY()

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 938 of file mathplot.h.

◆ GetXpos()

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 913 of file mathplot.h.

◆ GetXscl()

double mpWindow::GetXscl ( )
inline

Get current view's X scale.

See rules for coordinate transformation

Returns
Scale

Definition at line 899 of file mathplot.h.

◆ GetXScreen()

int mpWindow::GetXScreen ( void  ) const
inline

Definition at line 930 of file mathplot.h.

◆ GetYpos()

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 920 of file mathplot.h.

◆ GetYscl()

double mpWindow::GetYscl ( ) const
inline

Get current view's Y scale.

See rules for coordinate transformation

Returns
Scale

Definition at line 906 of file mathplot.h.

◆ GetYScreen()

int mpWindow::GetYScreen ( void  ) const
inline

Definition at line 939 of file mathplot.h.

◆ IsAspectLocked()

bool mpWindow::IsAspectLocked ( )
inline

Checks whether the X/Y scale aspect is locked.

Return values
TRUELocked
FALSEUnlocked

Definition at line 1014 of file mathplot.h.

◆ IsInsideInfoLayer()

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

◆ IsLayerVisible() [1/2]

bool mpWindow::IsLayerVisible ( const wxString &  name)

Check whether a layer with given name is visible.

Parameters
nameThe layer name
Returns
layer visibility status

◆ IsLayerVisible() [2/2]

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

◆ LockAspect()

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.

◆ OnCenter()

void mpWindow::OnCenter ( wxCommandEvent &  event)
protected

Context menu handler.

◆ OnFit()

void mpWindow::OnFit ( wxCommandEvent &  event)
protected

Context menu handler.

◆ OnLockAspect()

void mpWindow::OnLockAspect ( wxCommandEvent &  event)
protected

Context menu handler.

◆ OnMouseHelp()

void mpWindow::OnMouseHelp ( wxCommandEvent &  event)
protected

Context menu handler.

◆ OnMouseLeftDown()

void mpWindow::OnMouseLeftDown ( wxMouseEvent &  event)
protected

Mouse left click (for rect zoom)

◆ OnMouseLeftRelease()

void mpWindow::OnMouseLeftRelease ( wxMouseEvent &  event)
protected

Mouse left click (for rect zoom)

◆ OnMouseMove()

void mpWindow::OnMouseMove ( wxMouseEvent &  event)
protected

Mouse handler for mouse motion (for pan)

◆ OnMouseRightDown()

void mpWindow::OnMouseRightDown ( wxMouseEvent &  event)
protected

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

◆ OnMouseWheel()

void mpWindow::OnMouseWheel ( wxMouseEvent &  event)
protected

Mouse handler for the wheel.

◆ OnPaint()

void mpWindow::OnPaint ( wxPaintEvent &  event)
protected

Paint handler, will plot all attached layers.

◆ OnPrintMenu()

void mpWindow::OnPrintMenu ( wxCommandEvent &  event)
protected

Context menu handler.

◆ OnScrollBottom()

void mpWindow::OnScrollBottom ( wxScrollWinEvent &  event)
protected

Scroll to bottom.

◆ OnScrollLineDown()

void mpWindow::OnScrollLineDown ( wxScrollWinEvent &  event)
protected

Scroll line down.

◆ OnScrollLineUp()

void mpWindow::OnScrollLineUp ( wxScrollWinEvent &  event)
protected

Scroll line up.

◆ OnScrollPageDown()

void mpWindow::OnScrollPageDown ( wxScrollWinEvent &  event)
protected

Scroll page down.

◆ OnScrollPageUp()

void mpWindow::OnScrollPageUp ( wxScrollWinEvent &  event)
protected

Scroll page up.

◆ OnScrollThumbTrack()

void mpWindow::OnScrollThumbTrack ( wxScrollWinEvent &  event)
protected

Scroll thumb on scroll bar moving.

◆ OnScrollTop()

void mpWindow::OnScrollTop ( wxScrollWinEvent &  event)
protected

Scroll to top.

◆ OnShowPopupMenu()

void mpWindow::OnShowPopupMenu ( wxMouseEvent &  event)
protected

Mouse handler, will show context menu.

◆ OnSize()

void mpWindow::OnSize ( wxSizeEvent &  event)
protected

Size handler, will update scroll bar sizes.

◆ OnZoomIn()

void mpWindow::OnZoomIn ( wxCommandEvent &  event)
protected

Context menu handler.

◆ OnZoomOut()

void mpWindow::OnZoomOut ( wxCommandEvent &  event)
protected

Context menu handler.

◆ p2x()

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 977 of file mathplot.h.

◆ p2y()

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 982 of file mathplot.h.

◆ SaveScreenshot()

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

◆ SetColourTheme()

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)

◆ SetLayerVisible() [1/2]

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

◆ SetLayerVisible() [2/2]

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

◆ SetMarginBottom()

void mpWindow::SetMarginBottom ( int  bottom)
inline

Set the bottom margin.

Parameters
bottomBottom Margin

Definition at line 1132 of file mathplot.h.

◆ SetMarginLeft()

void mpWindow::SetMarginLeft ( int  left)
inline

Set the left margin.

Parameters
leftLeft Margin

Definition at line 1134 of file mathplot.h.

◆ SetMarginRight()

void mpWindow::SetMarginRight ( int  right)
inline

Set the right margin.

Parameters
rightRight Margin

Definition at line 1130 of file mathplot.h.

◆ SetMargins()

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

◆ SetMarginTop()

void mpWindow::SetMarginTop ( int  top)
inline

Set the top margin.

Parameters
topTop Margin

Definition at line 1128 of file mathplot.h.

◆ SetMPScrollbars()

void mpWindow::SetMPScrollbars ( bool  status)

Enable/disable scrollbars.

Parameters
statusSet to true to show scrollbars

◆ SetPos()

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 965 of file mathplot.h.

◆ SetPosX()

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 954 of file mathplot.h.

◆ SetPosY()

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 959 of file mathplot.h.

◆ SetScaleX()

void mpWindow::SetScaleX ( double  scaleX)

Set current view's X scale and refresh display.

Parameters
scaleXNew scale, must not be 0.

◆ SetScaleY()

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 949 of file mathplot.h.

◆ SetScr()

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 972 of file mathplot.h.

◆ ShowPrintDialog()

void mpWindow::ShowPrintDialog ( )
inline

Draws the mpWindow on a page for printing.

Parameters
printthe mpPrintout where to print the graph

Definition at line 1070 of file mathplot.h.

◆ UpdateAll()

void mpWindow::UpdateAll ( )

Refresh display.

◆ UpdateBBox()

virtual bool mpWindow::UpdateBBox ( )
virtual

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

Returns
true if there is any valid BBox information.

◆ x2p()

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 987 of file mathplot.h.

◆ y2p()

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 992 of file mathplot.h.

◆ ZoomIn()

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).

◆ ZoomInX()

void mpWindow::ZoomInX ( )

Zoom in current view along X and refresh display.

◆ ZoomInY()

void mpWindow::ZoomInY ( )

Zoom in current view along Y and refresh display.

◆ ZoomOut()

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).

◆ ZoomOutX()

void mpWindow::ZoomOutX ( )

Zoom out current view along X and refresh display.

◆ ZoomOutY()

void mpWindow::ZoomOutY ( )

Zoom out current view along Y and refresh display.

◆ ZoomRect()

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

◆ m_axColour

wxColour mpWindow::m_axColour
protected

Axes Colour.

Definition at line 1229 of file mathplot.h.

◆ m_bgColour

wxColour mpWindow::m_bgColour
protected

Background Colour.

Definition at line 1227 of file mathplot.h.

◆ m_buff_bmp

wxBitmap* mpWindow::m_buff_bmp
protected

For double buffering.

Definition at line 1252 of file mathplot.h.

◆ m_buff_dc

wxMemoryDC mpWindow::m_buff_dc
protected

For double buffering.

Definition at line 1251 of file mathplot.h.

◆ m_clickedX

int mpWindow::m_clickedX
protected

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

Definition at line 1241 of file mathplot.h.

◆ m_clickedY

int mpWindow::m_clickedY
protected

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

Definition at line 1242 of file mathplot.h.

◆ m_desiredXmax

double mpWindow::m_desiredXmax
protected

Definition at line 1246 of file mathplot.h.

◆ m_desiredXmin

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 1246 of file mathplot.h.

◆ m_desiredYmax

double mpWindow::m_desiredYmax
protected

Definition at line 1246 of file mathplot.h.

◆ m_desiredYmin

double mpWindow::m_desiredYmin
protected

Definition at line 1246 of file mathplot.h.

◆ m_enableDoubleBuffer

bool mpWindow::m_enableDoubleBuffer
protected

For double buffering.

Definition at line 1253 of file mathplot.h.

◆ m_enableMouseNavigation

bool mpWindow::m_enableMouseNavigation
protected

For pan/zoom with the mouse.

Definition at line 1254 of file mathplot.h.

◆ m_enableScrollBars

bool mpWindow::m_enableScrollBars
protected

Definition at line 1258 of file mathplot.h.

◆ m_fgColour

wxColour mpWindow::m_fgColour
protected

Foreground Colour.

Definition at line 1228 of file mathplot.h.

◆ m_last_lx

int mpWindow::m_last_lx
protected

Definition at line 1250 of file mathplot.h.

◆ m_last_ly

int mpWindow::m_last_ly
protected

For double buffering.

Definition at line 1250 of file mathplot.h.

◆ m_layers

wxLayerList mpWindow::m_layers
protected

List of attached plot layers.

Definition at line 1223 of file mathplot.h.

◆ m_lockaspect

bool mpWindow::m_lockaspect
protected

Scale aspect is locked or not.

Definition at line 1225 of file mathplot.h.

◆ m_marginBottom

int mpWindow::m_marginBottom
protected

Definition at line 1248 of file mathplot.h.

◆ m_marginLeft

int mpWindow::m_marginLeft
protected

Definition at line 1248 of file mathplot.h.

◆ m_marginRight

int mpWindow::m_marginRight
protected

Definition at line 1248 of file mathplot.h.

◆ m_marginTop

int mpWindow::m_marginTop
protected

Definition at line 1248 of file mathplot.h.

◆ m_maxX

double mpWindow::m_maxX
protected

Global layer bounding box, right border incl.

Definition at line 1232 of file mathplot.h.

◆ m_maxY

double mpWindow::m_maxY
protected

Global layer bounding box, top border incl.

Definition at line 1234 of file mathplot.h.

◆ m_minX

double mpWindow::m_minX
protected

Global layer bounding box, left border incl.

Definition at line 1231 of file mathplot.h.

◆ m_minY

double mpWindow::m_minY
protected

Global layer bounding box, bottom border incl.

Definition at line 1233 of file mathplot.h.

◆ m_mouseLClick_X

int mpWindow::m_mouseLClick_X
protected

Definition at line 1257 of file mathplot.h.

◆ m_mouseLClick_Y

int mpWindow::m_mouseLClick_Y
protected

Starting coords for rectangular zoom selection.

Definition at line 1257 of file mathplot.h.

◆ m_mouseMovedAfterRightClick

bool mpWindow::m_mouseMovedAfterRightClick
protected

Definition at line 1255 of file mathplot.h.

◆ m_mouseRClick_X

long mpWindow::m_mouseRClick_X
protected

Definition at line 1256 of file mathplot.h.

◆ m_mouseRClick_Y

long mpWindow::m_mouseRClick_Y
protected

For the right button "drag" feature.

Definition at line 1256 of file mathplot.h.

◆ m_movingInfoLayer

mpInfoLayer* mpWindow::m_movingInfoLayer
protected

For moving info layers over the window area.

Definition at line 1260 of file mathplot.h.

◆ m_popmenu

wxMenu mpWindow::m_popmenu
protected

Canvas' context menu.

Definition at line 1224 of file mathplot.h.

◆ m_posX

double mpWindow::m_posX
protected

Current view's X position.

Definition at line 1237 of file mathplot.h.

◆ m_posY

double mpWindow::m_posY
protected

Current view's Y position.

Definition at line 1238 of file mathplot.h.

◆ m_scaleX

double mpWindow::m_scaleX
protected

Current view's X scale.

Definition at line 1235 of file mathplot.h.

◆ m_scaleY

double mpWindow::m_scaleY
protected

Current view's Y scale.

Definition at line 1236 of file mathplot.h.

◆ m_scrollX

int mpWindow::m_scrollX
protected

Definition at line 1259 of file mathplot.h.

◆ m_scrollY

int mpWindow::m_scrollY
protected

Definition at line 1259 of file mathplot.h.

◆ m_scrX

int mpWindow::m_scrX
protected

Current view's X dimension.

Definition at line 1239 of file mathplot.h.

◆ m_scrY

int mpWindow::m_scrY
protected

Current view's Y dimension.

Definition at line 1240 of file mathplot.h.

◆ zoomIncrementalFactor

double mpWindow::zoomIncrementalFactor
static

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 1118 of file mathplot.h.




Page generated by Doxygen 1.8.13 for MRPT 1.4.0 SVN: at Fri Mar 17 07:27:15 UTC 2017