KiCad PCB EDA Suite
mpWindow Class Reference

Canvas for plotting mpLayer implementations. More...

#include <mathplot.h>

Inheritance diagram for mpWindow:
SIM_PLOT_PANEL

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 () override
 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...
 
unsigned int CountAllLayers ()
 Counts the number of plot layers, whether or not they have a bounding box. 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, wxBitmapType 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 ()
 
int GetMarginRight ()
 
int GetMarginBottom ()
 
int GetMarginLeft ()
 
mpInfoLayerIsInsideInfoLayer (wxPoint &point)
 Check if a given point is inside the area of a mpInfoLayer and eventually returns its pointer. 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...
 
void LimitView (bool aEnable)
 Limit zooming & panning to the area used by the plots. More...
 

Static Public Attributes

static double zoomIncrementalFactor = 1.5
 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)
 
void OnSize (wxSizeEvent &event)
 
void OnShowPopupMenu (wxMouseEvent &event)
 
void OnMouseMiddleDown (wxMouseEvent &event)
 
void OnCenter (wxCommandEvent &event)
 
void OnFit (wxCommandEvent &event)
 
void OnZoomIn (wxCommandEvent &event)
 
void OnZoomOut (wxCommandEvent &event)
 
void OnLockAspect (wxCommandEvent &event)
 
void OnMouseWheel (wxMouseEvent &event)
 
void OnMouseMove (wxMouseEvent &event)
 
void OnMouseLeftDown (wxMouseEvent &event)
 
void OnMouseLeftRelease (wxMouseEvent &event)
 
void OnScrollThumbTrack (wxScrollWinEvent &event)
 
void OnScrollPageUp (wxScrollWinEvent &event)
 
void OnScrollPageDown (wxScrollWinEvent &event)
 
void OnScrollLineUp (wxScrollWinEvent &event)
 
void OnScrollLineDown (wxScrollWinEvent &event)
 
void OnScrollTop (wxScrollWinEvent &event)
 
void OnScrollBottom (wxScrollWinEvent &event)
 
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)
 
bool CheckXLimits (double &desiredMax, double &desiredMin) const
 
bool CheckYLimits (double &desiredMax, double &desiredMin) const
 
void AdjustLimitedView ()
 
virtual bool UpdateBBox ()
 Recalculate global layer bounding box, and save it in m_minX,... More...
 
virtual bool SetXView (double pos, double desiredMax, double desiredMin)
 Applies new X view coordinates depending on the settings. More...
 
virtual bool SetYView (double pos, double desiredMax, double desiredMin)
 Applies new Y view coordinates depending on the settings. More...
 

Protected Attributes

wxLayerList m_layers
 
wxMenu m_popmenu
 
bool m_lockaspect
 
wxColour m_bgColour
 
wxColour m_fgColour
 
wxColour m_axColour
 
double m_minX
 
double m_maxX
 
double m_minY
 
double m_maxY
 
double m_scaleX
 
double m_scaleY
 
double m_posX
 
double m_posY
 
int m_scrX
 
int m_scrY
 
int m_clickedX
 
int m_clickedY
 
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
 
wxMemoryDC m_buff_dc
 
wxBitmap * m_buff_bmp
 
bool m_enableDoubleBuffer
 
bool m_enableMouseNavigation
 
bool m_enableLimitedView
 
wxPoint m_mouseMClick
 
wxPoint m_mouseLClick
 
bool m_enableScrollBars
 
wxPoint m_scroll
 
mpInfoLayerm_movingInfoLayer
 
bool m_zooming
 
wxRect m_zoomRect
 

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:

  • DoubleBuffering (Default=disabled): Can be set with EnableDoubleBuffer
  • Mouse based pan/zoom (Default=enabled): Can be set with EnableMousePanZoom.

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

  • Mouse Move+CTRL: Pan (Move)
  • Mouse Wheel: Vertical scroll
  • Mouse Wheel+SHIFT: Horizontal scroll
  • Mouse Wheel UP+CTRL: Zoom in
  • Mouse Wheel DOWN+CTRL: Zoom out

Definition at line 1043 of file mathplot.h.

Constructor & Destructor Documentation

mpWindow::mpWindow ( )
inline

Definition at line 1046 of file mathplot.h.

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

Definition at line 1787 of file mathplot.cpp.

References DelAllLayers(), and m_buff_bmp.

1788 {
1789  // Free all the layers:
1790  DelAllLayers( true, false );
1791 
1792  if( m_buff_bmp )
1793  {
1794  delete m_buff_bmp;
1795  m_buff_bmp = NULL;
1796  }
1797 }
void DelAllLayers(bool alsoDeleteObject, bool refreshDisplay=true)
Remove all layers from the plot.
Definition: mathplot.cpp:2510
wxBitmap * m_buff_bmp
Definition: mathplot.h:1503

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.

Definition at line 2466 of file mathplot.cpp.

References m_layers, and UpdateAll().

Referenced by SIM_PLOT_PANEL::AddTrace(), SIM_PLOT_PANEL::EnableCursor(), and SIM_PLOT_PANEL::SIM_PLOT_PANEL().

2467 {
2468  if( layer != NULL )
2469  {
2470  m_layers.push_back( layer );
2471 
2472  if( refreshDisplay )
2473  UpdateAll();
2474 
2475  return true;
2476  }
2477 
2478  ;
2479  return false;
2480 }
wxLayerList m_layers
Definition: mathplot.h:1474
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2814
void mpWindow::AdjustLimitedView ( )
protected

Definition at line 2177 of file mathplot.cpp.

References m_desiredXmax, m_desiredXmin, m_desiredYmax, m_desiredYmin, m_enableLimitedView, m_marginBottom, m_marginLeft, m_marginRight, m_marginTop, m_maxX, m_maxY, m_minX, m_minY, m_posX, m_posY, m_scaleX, and m_scaleY.

Referenced by SetXView(), SetYView(), ZoomIn(), and ZoomRect().

2178 {
2179  if( !m_enableLimitedView )
2180  return;
2181 
2182  const double xMin = m_minX - m_marginLeft / m_scaleX;
2183  const double xMax = m_maxX - m_marginRight / m_scaleX;
2184  const double yMin = m_minY + m_marginTop / m_scaleY;
2185  const double yMax = m_maxY + m_marginBottom / m_scaleY;
2186 
2187  if( m_desiredXmin < xMin )
2188  {
2189  double diff = xMin - m_desiredXmin;
2190  m_posX += diff;
2191  m_desiredXmax += diff;
2192  m_desiredXmin = xMin;
2193  }
2194 
2195  if( m_desiredXmax > xMax )
2196  {
2197  double diff = m_desiredXmax - xMax;
2198  m_posX -= diff;
2199  m_desiredXmin -= diff;
2200  m_desiredXmax = xMax;
2201  }
2202 
2203  if( m_desiredYmin < yMin )
2204  {
2205  double diff = yMin - m_desiredYmin;
2206  m_posY += diff;
2207  m_desiredYmax += diff;
2208  m_desiredYmin = yMin;
2209  }
2210 
2211  if( m_desiredYmax > yMax )
2212  {
2213  double diff = m_desiredYmax - yMax;
2214  m_posY -= diff;
2215  m_desiredYmin -= diff;
2216  m_desiredYmax = yMax;
2217  }
2218 }
int m_marginRight
Definition: mathplot.h:1499
int m_marginLeft
Definition: mathplot.h:1499
double m_desiredXmax
Definition: mathplot.h:1497
double m_scaleY
Definition: mathplot.h:1487
double m_posX
Definition: mathplot.h:1488
double m_minY
Definition: mathplot.h:1484
double m_scaleX
Definition: mathplot.h:1486
double m_desiredYmax
Definition: mathplot.h:1497
double m_desiredXmin
These are updated in Fit() only, and may be different from the real borders (layer coordinates) only ...
Definition: mathplot.h:1497
double m_posY
Definition: mathplot.h:1489
int m_marginTop
Definition: mathplot.h:1499
double m_minX
Definition: mathplot.h:1482
double m_desiredYmin
Definition: mathplot.h:1497
int m_marginBottom
Definition: mathplot.h:1499
bool m_enableLimitedView
Definition: mathplot.h:1506
double m_maxX
Definition: mathplot.h:1483
double m_maxY
Definition: mathplot.h:1485
bool mpWindow::CheckXLimits ( double &  desiredMax,
double &  desiredMin 
) const
inlineprotected

Definition at line 1442 of file mathplot.h.

Referenced by ZoomOut().

1443  {
1444  return !( m_enableLimitedView
1445  && (desiredMax > m_maxX - m_marginRight / m_scaleX
1446  || desiredMin < m_minX - m_marginLeft / m_scaleX) );
1447  }
int m_marginRight
Definition: mathplot.h:1499
int m_marginLeft
Definition: mathplot.h:1499
double m_scaleX
Definition: mathplot.h:1486
double m_minX
Definition: mathplot.h:1482
bool m_enableLimitedView
Definition: mathplot.h:1506
double m_maxX
Definition: mathplot.h:1483
bool mpWindow::CheckYLimits ( double &  desiredMax,
double &  desiredMin 
) const
inlineprotected

Definition at line 1449 of file mathplot.h.

Referenced by ZoomOut().

1450  {
1451  return !( m_enableLimitedView
1452  && (desiredMax > m_maxY + m_marginBottom / m_scaleY
1453  || desiredMin < m_minY + m_marginTop / m_scaleY) );
1454  }
double m_scaleY
Definition: mathplot.h:1487
double m_minY
Definition: mathplot.h:1484
int m_marginTop
Definition: mathplot.h:1499
int m_marginBottom
Definition: mathplot.h:1499
bool m_enableLimitedView
Definition: mathplot.h:1506
double m_maxY
Definition: mathplot.h:1485
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 1276 of file mathplot.h.

Referenced by mpPrintout::OnPrintPage(), and mpInfoLegend::Plot().

1276 { return m_layers.size(); };
wxLayerList m_layers
Definition: mathplot.h:1474
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.

Definition at line 2997 of file mathplot.cpp.

References m_layers.

2998 {
2999  // wxNode *node = m_layers.GetFirst();
3000  unsigned int layerNo = 0;
3001 
3002  for( wxLayerList::iterator li = m_layers.begin(); li != m_layers.end(); li++ ) // while(node)
3003  {
3004  if( (*li)->HasBBox() )
3005  layerNo++;
3006 
3007  // node = node->GetNext();
3008  }
3009 
3010  ;
3011  return layerNo;
3012 }
wxLayerList m_layers
Definition: mathplot.h:1474
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.

Definition at line 2510 of file mathplot.cpp.

References m_layers, and UpdateAll().

Referenced by ~mpWindow().

2511 {
2512  while( m_layers.size()>0 )
2513  {
2514  // Also delete the object?
2515  if( alsoDeleteObject )
2516  delete m_layers[0];
2517 
2518  m_layers.erase( m_layers.begin() ); // this deleted the reference only
2519  }
2520 
2521  if( refreshDisplay )
2522  UpdateAll();
2523 }
wxLayerList m_layers
Definition: mathplot.h:1474
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2814
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!

Definition at line 2483 of file mathplot.cpp.

References m_layers, and UpdateAll().

Referenced by SIM_PLOT_PANEL::AddTrace(), SIM_PLOT_PANEL::DeleteTrace(), and SIM_PLOT_PANEL::EnableCursor().

2486 {
2487  wxLayerList::iterator layIt;
2488 
2489  for( layIt = m_layers.begin(); layIt != m_layers.end(); layIt++ )
2490  {
2491  if( *layIt == layer )
2492  {
2493  // Also delete the object?
2494  if( alsoDeleteObject )
2495  delete *layIt;
2496 
2497  m_layers.erase( layIt ); // this deleted the reference only
2498 
2499  if( refreshDisplay )
2500  UpdateAll();
2501 
2502  return true;
2503  }
2504  }
2505 
2506  return false;
2507 }
wxLayerList m_layers
Definition: mathplot.h:1474
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2814
void mpWindow::DoScrollCalc ( const int  position,
const int  orientation 
)
protected

Definition at line 2861 of file mathplot.cpp.

References m_desiredXmin, m_desiredYmax, m_marginLeft, m_marginTop, m_maxY, m_minX, m_scaleX, m_scaleY, SetPosX(), and SetPosY().

Referenced by OnScrollBottom(), OnScrollLineDown(), OnScrollLineUp(), OnScrollPageDown(), OnScrollPageUp(), OnScrollThumbTrack(), and OnScrollTop().

2862 {
2863  if( orientation == wxVERTICAL )
2864  {
2865  // Y axis
2866  // Get top margin in coord units
2867  double topMargin = m_marginTop / m_scaleY;
2868  // Calculate maximum Y coord to be shown in the graph
2869  double maxY = m_desiredYmax > m_maxY ? m_desiredYmax : m_maxY;
2870  // Set new position
2871  SetPosY( ( maxY - (position / m_scaleY) ) + topMargin );
2872  }
2873  else
2874  {
2875  // X Axis
2876  // Get left margin in coord units
2877  double leftMargin = m_marginLeft / m_scaleX;
2878  // Calculate minimum X coord to be shown in the graph
2879  double minX = (m_desiredXmin < m_minX) ? m_desiredXmin : m_minX;
2880  // Set new position
2881  SetPosX( ( minX + (position / m_scaleX) ) - leftMargin );
2882  }
2883 }
int m_marginLeft
Definition: mathplot.h:1499
double m_scaleY
Definition: mathplot.h:1487
double m_scaleX
Definition: mathplot.h:1486
void SetPosX(double posX)
Set current view's X position and refresh display.
Definition: mathplot.h:1162
void SetPosY(double posY)
Set current view's Y position and refresh display.
Definition: mathplot.h:1167
double m_desiredYmax
Definition: mathplot.h:1497
double m_desiredXmin
These are updated in Fit() only, and may be different from the real borders (layer coordinates) only ...
Definition: mathplot.h:1497
int m_marginTop
Definition: mathplot.h:1499
double m_minX
Definition: mathplot.h:1482
double m_maxY
Definition: mathplot.h:1485
void mpWindow::DoZoomInXCalc ( const int  staticXpixel)
protected

Definition at line 2097 of file mathplot.cpp.

References m_desiredXmax, m_desiredXmin, m_marginLeft, m_marginRight, m_posX, m_scaleX, m_scrX, p2x(), and zoomIncrementalFactor.

2098 {
2099  // Preserve the position of the clicked point:
2100  double staticX = p2x( staticXpixel );
2101 
2102  // Zoom in:
2104  // Adjust the new m_posx
2105  m_posX = staticX - (staticXpixel / m_scaleX);
2106  // Adjust desired
2109 #ifdef MATHPLOT_DO_LOGGING
2110  wxLogMessage(
2111  "mpWindow::DoZoomInXCalc() prior X coord: (%f), new X coord: (%f) SHOULD BE EQUAL!!",
2112  staticX, p2x( staticXpixel ) );
2113 #endif
2114 }
int m_marginRight
Definition: mathplot.h:1499
int m_marginLeft
Definition: mathplot.h:1499
double p2x(wxCoord pixelCoordX)
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates, using current mpWindow position and scale.
Definition: mathplot.h:1185
double m_desiredXmax
Definition: mathplot.h:1497
double m_posX
Definition: mathplot.h:1488
double m_scaleX
Definition: mathplot.h:1486
double m_desiredXmin
These are updated in Fit() only, and may be different from the real borders (layer coordinates) only ...
Definition: mathplot.h:1497
static double zoomIncrementalFactor
This value sets the zoom steps whenever the user clicks "Zoom in/out" or performs zoom with the mouse...
Definition: mathplot.h:1327
int m_scrX
Definition: mathplot.h:1490
void mpWindow::DoZoomInYCalc ( const int  staticYpixel)
protected

Definition at line 2117 of file mathplot.cpp.

References m_desiredYmax, m_desiredYmin, m_marginBottom, m_marginTop, m_posY, m_scaleY, m_scrY, p2y(), and zoomIncrementalFactor.

2118 {
2119  // Preserve the position of the clicked point:
2120  double staticY = p2y( staticYpixel );
2121 
2122  // Zoom in:
2124  // Adjust the new m_posy:
2125  m_posY = staticY + (staticYpixel / m_scaleY);
2126  // Adjust desired
2129 #ifdef MATHPLOT_DO_LOGGING
2130  wxLogMessage(
2131  "mpWindow::DoZoomInYCalc() prior Y coord: (%f), new Y coord: (%f) SHOULD BE EQUAL!!",
2132  staticY, p2y( staticYpixel ) );
2133 #endif
2134 }
double m_scaleY
Definition: mathplot.h:1487
double p2y(wxCoord pixelCoordY)
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates, using current mpWindow position and scale.
Definition: mathplot.h:1190
double m_desiredYmax
Definition: mathplot.h:1497
double m_posY
Definition: mathplot.h:1489
int m_marginTop
Definition: mathplot.h:1499
double m_desiredYmin
Definition: mathplot.h:1497
int m_marginBottom
Definition: mathplot.h:1499
int m_scrY
Definition: mathplot.h:1491
static double zoomIncrementalFactor
This value sets the zoom steps whenever the user clicks "Zoom in/out" or performs zoom with the mouse...
Definition: mathplot.h:1327
void mpWindow::DoZoomOutXCalc ( const int  staticXpixel)
protected

Definition at line 2137 of file mathplot.cpp.

References m_desiredXmax, m_desiredXmin, m_marginLeft, m_marginRight, m_posX, m_scaleX, m_scrX, p2x(), and zoomIncrementalFactor.

2138 {
2139  // Preserve the position of the clicked point:
2140  double staticX = p2x( staticXpixel );
2141 
2142  // Zoom out:
2144  // Adjust the new m_posx/y:
2145  m_posX = staticX - (staticXpixel / m_scaleX);
2146  // Adjust desired
2149 #ifdef MATHPLOT_DO_LOGGING
2150  wxLogMessage(
2151  "mpWindow::DoZoomOutXCalc() prior X coord: (%f), new X coord: (%f) SHOULD BE EQUAL!!",
2152  staticX, p2x( staticXpixel ) );
2153 #endif
2154 }
int m_marginRight
Definition: mathplot.h:1499
int m_marginLeft
Definition: mathplot.h:1499
double p2x(wxCoord pixelCoordX)
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates, using current mpWindow position and scale.
Definition: mathplot.h:1185
double m_desiredXmax
Definition: mathplot.h:1497
double m_posX
Definition: mathplot.h:1488
double m_scaleX
Definition: mathplot.h:1486
double m_desiredXmin
These are updated in Fit() only, and may be different from the real borders (layer coordinates) only ...
Definition: mathplot.h:1497
static double zoomIncrementalFactor
This value sets the zoom steps whenever the user clicks "Zoom in/out" or performs zoom with the mouse...
Definition: mathplot.h:1327
int m_scrX
Definition: mathplot.h:1490
void mpWindow::DoZoomOutYCalc ( const int  staticYpixel)
protected

Definition at line 2157 of file mathplot.cpp.

References m_desiredYmax, m_desiredYmin, m_marginBottom, m_marginTop, m_posY, m_scaleY, m_scrY, p2y(), and zoomIncrementalFactor.

2158 {
2159  // Preserve the position of the clicked point:
2160  double staticY = p2y( staticYpixel );
2161 
2162  // Zoom out:
2164  // Adjust the new m_posx/y:
2165  m_posY = staticY + (staticYpixel / m_scaleY);
2166  // Adjust desired
2169 #ifdef MATHPLOT_DO_LOGGING
2170  wxLogMessage(
2171  "mpWindow::DoZoomOutYCalc() prior Y coord: (%f), new Y coord: (%f) SHOULD BE EQUAL!!",
2172  staticY, p2y( staticYpixel ) );
2173 #endif
2174 }
double m_scaleY
Definition: mathplot.h:1487
double p2y(wxCoord pixelCoordY)
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates, using current mpWindow position and scale.
Definition: mathplot.h:1190
double m_desiredYmax
Definition: mathplot.h:1497
double m_posY
Definition: mathplot.h:1489
int m_marginTop
Definition: mathplot.h:1499
double m_desiredYmin
Definition: mathplot.h:1497
int m_marginBottom
Definition: mathplot.h:1499
int m_scrY
Definition: mathplot.h:1491
static double zoomIncrementalFactor
This value sets the zoom steps whenever the user clicks "Zoom in/out" or performs zoom with the mouse...
Definition: mathplot.h:1327
void mpWindow::EnableDoubleBuffer ( bool  enabled)
inline

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

Definition at line 1205 of file mathplot.h.

Referenced by SIM_PLOT_PANEL::SIM_PLOT_PANEL().

1205 { m_enableDoubleBuffer = enabled; }
bool m_enableDoubleBuffer
Definition: mathplot.h:1504
void mpWindow::EnableMousePanZoom ( bool  enabled)
inline

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

Definition at line 1209 of file mathplot.h.

1209 { m_enableMouseNavigation = enabled; }
bool m_enableMouseNavigation
Definition: mathplot.h:1505
void mpWindow::Fit ( )
override

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.

Definition at line 2006 of file mathplot.cpp.

References m_maxX, m_maxY, m_minX, m_minY, and UpdateBBox().

Referenced by LockAspect(), SIM_PLOT_FRAME::menuZoomFit(), OnFit(), mpPrintout::OnPrintPage(), OnSize(), SIM_PLOT_FRAME::removePlot(), SaveScreenshot(), ZoomOut(), and ZoomRect().

2007 {
2008  if( UpdateBBox() )
2009  Fit( m_minX, m_maxX, m_minY, m_maxY );
2010 }
double m_minY
Definition: mathplot.h:1484
void Fit() override
Set view to fit global bounding box of all plot layers and refresh display.
Definition: mathplot.cpp:2006
double m_minX
Definition: mathplot.h:1482
virtual bool UpdateBBox()
Recalculate global layer bounding box, and save it in m_minX,...
Definition: mathplot.cpp:2706
double m_maxX
Definition: mathplot.h:1483
double m_maxY
Definition: mathplot.h:1485
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.

Definition at line 2014 of file mathplot.cpp.

References m_desiredXmax, m_desiredXmin, m_desiredYmax, m_desiredYmin, m_lockaspect, m_marginBottom, m_marginLeft, m_marginRight, m_marginTop, m_posX, m_posY, m_scaleX, m_scaleY, m_scrX, m_scrY, and UpdateAll().

2016 {
2017  // Save desired borders:
2018  m_desiredXmin = xMin; m_desiredXmax = xMax;
2019  m_desiredYmin = yMin; m_desiredYmax = yMax;
2020 
2021  // Give a small margin to plot area
2022  double xExtra = fabs( xMax - xMin ) * 0.00;
2023  double yExtra = fabs( yMax - yMin ) * 0.03;
2024 
2025  xMin -= xExtra;
2026  xMax += xExtra;
2027  yMin -= yExtra;
2028  yMax += yExtra;
2029 
2030  if( printSizeX!=NULL && printSizeY!=NULL )
2031  {
2032  // Printer:
2033  m_scrX = *printSizeX;
2034  m_scrY = *printSizeY;
2035  }
2036  else
2037  {
2038  // Normal case (screen):
2039  GetClientSize( &m_scrX, &m_scrY );
2040  }
2041 
2042  double Ax, Ay;
2043 
2044  Ax = xMax - xMin;
2045  Ay = yMax - yMin;
2046 
2047  m_scaleX = (Ax!=0) ? (m_scrX - m_marginLeft - m_marginRight) / Ax : 1; // m_scaleX = (Ax!=0) ? m_scrX/Ax : 1;
2048  m_scaleY = (Ay!=0) ? (m_scrY - m_marginTop - m_marginBottom) / Ay : 1; // m_scaleY = (Ay!=0) ? m_scrY/Ay : 1;
2049 
2050  if( m_lockaspect )
2051  {
2052 #ifdef MATHPLOT_DO_LOGGING
2053  wxLogMessage( "mpWindow::Fit()(lock) m_scaleX=%f,m_scaleY=%f", m_scaleX, m_scaleY );
2054 #endif
2055  // Keep the lowest "scale" to fit the whole range required by that axis (to actually "fit"!):
2056  double s = m_scaleX < m_scaleY ? m_scaleX : m_scaleY;
2057  m_scaleX = s;
2058  m_scaleY = s;
2059  }
2060 
2061  // Adjusts corner coordinates: This should be simply:
2062  // m_posX = m_minX;
2063  // m_posY = m_maxY;
2064  // But account for centering if we have lock aspect:
2065  m_posX = (xMin + xMax) / 2 - ( (m_scrX - m_marginLeft - m_marginRight) / 2 + m_marginLeft ) /
2066  m_scaleX; // m_posX = (xMin+xMax)/2 - (m_scrX/2)/m_scaleX;
2067  // m_posY = (yMin+yMax)/2 + ((m_scrY - m_marginTop - m_marginBottom)/2 - m_marginTop)/m_scaleY; // m_posY = (yMin+yMax)/2 + (m_scrY/2)/m_scaleY;
2068  m_posY = (yMin + yMax) / 2 + ( (m_scrY - m_marginTop - m_marginBottom) / 2 + m_marginTop ) /
2069  m_scaleY; // m_posY = (yMin+yMax)/2 + (m_scrY/2)/m_scaleY;
2070 
2071 #ifdef MATHPLOT_DO_LOGGING
2072  wxLogMessage(
2073  "mpWindow::Fit() m_desiredXmin=%f m_desiredXmax=%f m_desiredYmin=%f m_desiredYmax=%f",
2074  xMin,
2075  xMax,
2076  yMin,
2077  yMax );
2078  wxLogMessage(
2079  "mpWindow::Fit() m_scaleX = %f , m_scrX = %d,m_scrY=%d, Ax=%f, Ay=%f, m_posX=%f, m_posY=%f",
2080  m_scaleX,
2081  m_scrX,
2082  m_scrY,
2083  Ax,
2084  Ay,
2085  m_posX,
2086  m_posY );
2087 #endif
2088 
2089  // It is VERY IMPORTANT to DO NOT call Refresh if we are drawing to the printer!!
2090  // Otherwise, the DC dimensions will be those of the window instead of the printer device
2091  if( printSizeX==NULL || printSizeY==NULL )
2092  UpdateAll();
2093 }
int m_marginRight
Definition: mathplot.h:1499
int m_marginLeft
Definition: mathplot.h:1499
double m_desiredXmax
Definition: mathplot.h:1497
double m_scaleY
Definition: mathplot.h:1487
double m_posX
Definition: mathplot.h:1488
double m_scaleX
Definition: mathplot.h:1486
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2814
double m_desiredYmax
Definition: mathplot.h:1497
bool m_lockaspect
Definition: mathplot.h:1476
double m_desiredXmin
These are updated in Fit() only, and may be different from the real borders (layer coordinates) only ...
Definition: mathplot.h:1497
double m_posY
Definition: mathplot.h:1489
int m_marginTop
Definition: mathplot.h:1499
double m_desiredYmin
Definition: mathplot.h:1497
int m_marginBottom
Definition: mathplot.h:1499
int m_scrY
Definition: mathplot.h:1491
int m_scrX
Definition: mathplot.h:1490
const wxColour& mpWindow::GetAxesColour ( )
inline

Get axes draw colour.

Returns
reference to axis colour used in theme

Definition at line 1401 of file mathplot.h.

Referenced by mpPrintout::OnPrintPage().

1401 { return m_axColour; };
wxColour m_axColour
Definition: mathplot.h:1480
void mpWindow::GetBoundingBox ( double *  bbox)

Returns the bounding box coordinates.

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

Definition at line 3035 of file mathplot.cpp.

References m_maxX, m_maxY, m_minX, and m_minY.

3036 {
3037  bbox[0] = m_minX;
3038  bbox[1] = m_maxX;
3039  bbox[2] = m_minY;
3040  bbox[3] = m_maxY;
3041 }
double m_minY
Definition: mathplot.h:1484
double m_minX
Definition: mathplot.h:1482
double m_maxX
Definition: mathplot.h:1483
double m_maxY
Definition: mathplot.h:1485
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 1293 of file mathplot.h.

Referenced by mpPrintout::OnPrintPage().

1293 { return m_desiredXmax; }
double m_desiredXmax
Definition: mathplot.h:1497
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 1288 of file mathplot.h.

Referenced by mpPrintout::OnPrintPage().

1288 { return m_desiredXmin; }
double m_desiredXmin
These are updated in Fit() only, and may be different from the real borders (layer coordinates) only ...
Definition: mathplot.h:1497
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 1303 of file mathplot.h.

Referenced by mpPrintout::OnPrintPage().

1303 { return m_desiredYmax; }
double m_desiredYmax
Definition: mathplot.h:1497
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 1298 of file mathplot.h.

Referenced by mpPrintout::OnPrintPage().

1298 { return m_desiredYmin; }
double m_desiredYmin
Definition: mathplot.h:1497
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

Definition at line 3015 of file mathplot.cpp.

References m_layers.

Referenced by IsLayerVisible(), mpPrintout::OnPrintPage(), mpInfoLegend::Plot(), and SetLayerVisible().

3016 {
3017  if( ( position >= (int) m_layers.size() ) || position < 0 )
3018  return NULL;
3019 
3020  return m_layers[position];
3021 }
wxLayerList m_layers
Definition: mathplot.h:1474
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.

Definition at line 3024 of file mathplot.cpp.

References m_layers.

Referenced by IsLayerVisible(), and SetLayerVisible().

3025 {
3026  for( wxLayerList::iterator it = m_layers.begin(); it!=m_layers.end(); it++ )
3027  if( !(*it)->GetName().Cmp( name ) )
3028  return *it;
3029 
3030 
3031  return NULL; // Not found
3032 }
wxLayerList m_layers
Definition: mathplot.h:1474
const char * name
int mpWindow::GetMarginBottom ( )
inline
Returns
the bottom margin.

Definition at line 1350 of file mathplot.h.

Referenced by mpScaleY::getVisibleDataRange(), CURSOR::Plot(), mpFX::Plot(), mpFY::Plot(), mpFXY::Plot(), mpProfile::Plot(), mpScaleXBase::Plot(), mpScaleY::Plot(), and mpText::Plot().

1350 { return m_marginBottom; };
int m_marginBottom
Definition: mathplot.h:1499
int mpWindow::GetMarginLeft ( )
inline
int mpWindow::GetMarginRight ( )
inline
int mpWindow::GetMarginTop ( )
inline
bool mpWindow::GetMPScrollbars ( )
inline

Get scrollbars status.

Returns
true if scrollbars are visible

Definition at line 1315 of file mathplot.h.

1315 { return m_enableScrollBars; };
bool m_enableScrollBars
Definition: mathplot.h:1509
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 1056 of file mathplot.h.

1056 { return &m_popmenu; }
wxMenu m_popmenu
Definition: mathplot.h:1475
double mpWindow::GetPosX ( void  ) const
inline

Definition at line 1116 of file mathplot.h.

Referenced by mpScaleXBase::Plot(), mpMovableObject::Plot(), and mpBitmapLayer::Plot().

1116 { return m_posX; }
double m_posX
Definition: mathplot.h:1488
double mpWindow::GetPosY ( void  ) const
inline

Definition at line 1123 of file mathplot.h.

Referenced by mpScaleY::Plot(), mpMovableObject::Plot(), and mpBitmapLayer::Plot().

1123 { return m_posY; }
double m_posY
Definition: mathplot.h:1489
double mpWindow::GetScaleX ( void  ) const
inline

Definition at line 1102 of file mathplot.h.

Referenced by mpScaleXBase::Plot(), mpMovableObject::Plot(), and mpBitmapLayer::Plot().

1102 { return m_scaleX; }; // Schaling's method: maybe another method esists with the same name
double m_scaleX
Definition: mathplot.h:1486
double mpWindow::GetScaleY ( void  ) const
inline

Definition at line 1109 of file mathplot.h.

Referenced by mpScaleY::Plot(), mpMovableObject::Plot(), and mpBitmapLayer::Plot().

1109 { return m_scaleY; } // Schaling's method: maybe another method exists with the same name
double m_scaleY
Definition: mathplot.h:1487
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 1131 of file mathplot.h.

Referenced by mpScaleXBase::getVisibleDataRange(), mpPrintout::OnPrintPage(), CURSOR::Plot(), mpInfoLayer::Plot(), mpInfoCoords::Plot(), mpInfoLegend::Plot(), mpFX::Plot(), mpFY::Plot(), mpFXY::Plot(), mpProfile::Plot(), mpScaleXBase::Plot(), mpScaleY::Plot(), mpText::Plot(), mpMovableObject::Plot(), and mpBitmapLayer::Plot().

1131 { return m_scrX; }
int m_scrX
Definition: mathplot.h:1490
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 1140 of file mathplot.h.

Referenced by mpScaleY::getVisibleDataRange(), mpPrintout::OnPrintPage(), CURSOR::Plot(), mpInfoLayer::Plot(), mpInfoCoords::Plot(), mpInfoLegend::Plot(), mpFX::Plot(), mpFY::Plot(), mpFXY::Plot(), mpProfile::Plot(), mpScaleXBase::Plot(), mpScaleY::Plot(), mpText::Plot(), mpMovableObject::Plot(), and mpBitmapLayer::Plot().

1140 { return m_scrY; }
int m_scrY
Definition: mathplot.h:1491
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 1115 of file mathplot.h.

1115 { return m_posX; }
double m_posX
Definition: mathplot.h:1488
double mpWindow::GetXscl ( )
inline

Get current view's X scale.

See rules for coordinate transformation

Returns
Scale

Definition at line 1101 of file mathplot.h.

1101 { return m_scaleX; }
double m_scaleX
Definition: mathplot.h:1486
int mpWindow::GetXScreen ( void  ) const
inline

Definition at line 1132 of file mathplot.h.

Referenced by SIM_PLOT_PANEL::EnableCursor().

1132 { return m_scrX; }
int m_scrX
Definition: mathplot.h:1490
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 1122 of file mathplot.h.

1122 { return m_posY; }
double m_posY
Definition: mathplot.h:1489
double mpWindow::GetYscl ( ) const
inline

Get current view's Y scale.

See rules for coordinate transformation

Returns
Scale

Definition at line 1108 of file mathplot.h.

1108 { return m_scaleY; }
double m_scaleY
Definition: mathplot.h:1487
int mpWindow::GetYScreen ( void  ) const
inline

Definition at line 1141 of file mathplot.h.

1141 { return m_scrY; }
int m_scrY
Definition: mathplot.h:1491
bool mpWindow::IsAspectLocked ( )
inline

Checks whether the X/Y scale aspect is locked.

Return values
TRUELocked
FALSEUnlocked

Definition at line 1222 of file mathplot.h.

1222 { return m_lockaspect; }
bool m_lockaspect
Definition: mathplot.h:1476
mpInfoLayer * mpWindow::IsInsideInfoLayer ( wxPoint point)

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

Definition at line 3110 of file mathplot.cpp.

References mpInfoLayer::Inside(), and m_layers.

Referenced by OnMouseLeftDown().

3111 {
3112  wxLayerList::iterator li;
3113 
3114  for( li = m_layers.begin(); li != m_layers.end(); li++ )
3115  {
3116 #ifdef MATHPLOT_DO_LOGGING
3117  wxLogMessage( "mpWindow::IsInsideInfoLayer() examinining layer = %p", (*li) );
3118 #endif // MATHPLOT_DO_LOGGING
3119 
3120  if( (*li)->IsInfo() )
3121  {
3122  mpInfoLayer* tmpLyr = (mpInfoLayer*) (*li);
3123 #ifdef MATHPLOT_DO_LOGGING
3124  wxLogMessage( "mpWindow::IsInsideInfoLayer() layer = %p", (*li) );
3125 #endif // MATHPLOT_DO_LOGGING
3126 
3127  if( tmpLyr->Inside( point ) )
3128  {
3129  return tmpLyr;
3130  }
3131  }
3132  }
3133 
3134  return NULL;
3135 }
virtual bool Inside(wxPoint &point)
Checks whether a point is inside the info box rectangle.
Definition: mathplot.cpp:134
wxLayerList m_layers
Definition: mathplot.h:1474
Base class to create small rectangular info boxes mpInfoLayer is the base class to create a small rec...
Definition: mathplot.h:334
bool mpWindow::IsLayerVisible ( const wxString &  name)

Check whether a layer with given name is visible.

Parameters
nameThe layer name
Returns
layer visibility status

Definition at line 3150 of file mathplot.cpp.

References GetLayerByName(), and mpLayer::IsVisible().

3151 {
3152  mpLayer* lx = GetLayerByName( name );
3153 
3154  return (lx) ? lx->IsVisible() : false;
3155 }
bool IsVisible()
Checks whether the layer is visible or not.
Definition: mathplot.h:297
mpLayer * GetLayerByName(const wxString &name)
Definition: mathplot.cpp:3024
const char * name
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

Definition at line 3170 of file mathplot.cpp.

References GetLayer(), and mpLayer::IsVisible().

3171 {
3172  mpLayer* lx = GetLayer( position );
3173 
3174  return (lx) ? lx->IsVisible() : false;
3175 }
mpLayer * GetLayer(int position)
Definition: mathplot.cpp:3015
bool IsVisible()
Checks whether the layer is visible or not.
Definition: mathplot.h:297
void mpWindow::LimitView ( bool  aEnable)
inline

Limit zooming & panning to the area used by the plots.

Definition at line 1404 of file mathplot.h.

Referenced by SIM_PLOT_PANEL::SIM_PLOT_PANEL().

1405  {
1406  m_enableLimitedView = aEnable;
1407  }
bool m_enableLimitedView
Definition: mathplot.h:1506
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.

Definition at line 2404 of file mathplot.cpp.

References Fit(), m_desiredXmax, m_desiredXmin, m_desiredYmax, m_desiredYmin, m_lockaspect, m_popmenu, and mpID_LOCKASPECT.

Referenced by OnLockAspect().

2405 {
2406  m_lockaspect = enable;
2407  m_popmenu.Check( mpID_LOCKASPECT, enable );
2408 
2409  // Try to fit again with the new config:
2411 }
double m_desiredXmax
Definition: mathplot.h:1497
double m_desiredYmax
Definition: mathplot.h:1497
bool m_lockaspect
Definition: mathplot.h:1476
double m_desiredXmin
These are updated in Fit() only, and may be different from the real borders (layer coordinates) only ...
Definition: mathplot.h:1497
void Fit() override
Set view to fit global bounding box of all plot layers and refresh display.
Definition: mathplot.cpp:2006
double m_desiredYmin
Definition: mathplot.h:1497
wxMenu m_popmenu
Definition: mathplot.h:1475
void mpWindow::OnCenter ( wxCommandEvent &  event)
protected

Definition at line 2434 of file mathplot.cpp.

References m_clickedX, m_clickedY, m_marginBottom, m_marginLeft, m_marginRight, m_marginTop, m_scrX, m_scrY, p2x(), p2y(), and SetPos().

2435 {
2436  GetClientSize( &m_scrX, &m_scrY );
2437  int centerX = (m_scrX - m_marginLeft - m_marginRight) / 2; // + m_marginLeft; // c.x = m_scrX/2;
2438  int centerY = (m_scrY - m_marginTop - m_marginBottom) / 2; // - m_marginTop; // c.y = m_scrY/2;
2439  SetPos( p2x( m_clickedX - centerX ), p2y( m_clickedY - centerY ) );
2440  // SetPos( p2x(m_clickedX-m_scrX/2), p2y(m_clickedY-m_scrY/2) ); //SetPos( (double)(m_clickedX-m_scrX/2) / m_scaleX + m_posX, (double)(m_scrY/2-m_clickedY) / m_scaleY + m_posY);
2441 }
int m_marginRight
Definition: mathplot.h:1499
int m_marginLeft
Definition: mathplot.h:1499
int m_clickedX
Definition: mathplot.h:1492
double p2x(wxCoord pixelCoordX)
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates, using current mpWindow position and scale.
Definition: mathplot.h:1185
double p2y(wxCoord pixelCoordY)
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates, using current mpWindow position and scale.
Definition: mathplot.h:1190
int m_marginTop
Definition: mathplot.h:1499
void SetPos(double posX, double posY)
Set current view's X and Y position and refresh display.
Definition: mathplot.h:1173
int m_clickedY
Definition: mathplot.h:1493
int m_marginBottom
Definition: mathplot.h:1499
int m_scrY
Definition: mathplot.h:1491
int m_scrX
Definition: mathplot.h:1490
void mpWindow::OnFit ( wxCommandEvent &  event)
protected

Definition at line 2428 of file mathplot.cpp.

References Fit().

2429 {
2430  Fit();
2431 }
void Fit() override
Set view to fit global bounding box of all plot layers and refresh display.
Definition: mathplot.cpp:2006
void mpWindow::OnLockAspect ( wxCommandEvent &  event)
protected

Definition at line 2422 of file mathplot.cpp.

References LockAspect(), and m_lockaspect.

2423 {
2425 }
bool m_lockaspect
Definition: mathplot.h:1476
void LockAspect(bool enable=TRUE)
Enable or disable X/Y scale aspect locking for the view.
Definition: mathplot.cpp:2404
void mpWindow::OnMouseLeftDown ( wxMouseEvent &  event)
protected

Definition at line 1953 of file mathplot.cpp.

References IsInsideInfoLayer(), m_mouseLClick, m_movingInfoLayer, m_zooming, wxPoint::x, and wxPoint::y.

1954 {
1955  m_mouseLClick.x = event.GetX();
1956  m_mouseLClick.y = event.GetY();
1957  m_zooming = true;
1958 #ifdef MATHPLOT_DO_LOGGING
1959  wxLogMessage( "mpWindow::OnMouseLeftDown() X = %d , Y = %d", event.GetX(), event.GetY() ); /*m_mouseLClick.x, m_mouseLClick.y);*/
1960 #endif
1961  wxPoint pointClicked = event.GetPosition();
1962  m_movingInfoLayer = IsInsideInfoLayer( pointClicked );
1963 
1964  if( m_movingInfoLayer != NULL )
1965  {
1966 #ifdef MATHPLOT_DO_LOGGING
1967  wxLogMessage( "mpWindow::OnMouseLeftDown() started moving layer %lx",
1968  (long int) m_movingInfoLayer ); /*m_mouseLClick.x, m_mouseLClick.y);*/
1969 #endif
1970  }
1971 
1972  event.Skip();
1973 }
bool m_zooming
Definition: mathplot.h:1512
mpInfoLayer * IsInsideInfoLayer(wxPoint &point)
Check if a given point is inside the area of a mpInfoLayer and eventually returns its pointer...
Definition: mathplot.cpp:3110
wxPoint m_mouseLClick
Definition: mathplot.h:1508
mpInfoLayer * m_movingInfoLayer
Definition: mathplot.h:1511
void mpWindow::OnMouseLeftRelease ( wxMouseEvent &  event)
protected

Definition at line 1976 of file mathplot.cpp.

References m_mouseLClick, m_movingInfoLayer, m_zooming, mpInfoLayer::UpdateReference(), wxPoint::x, wxPoint::y, and ZoomRect().

1977 {
1978  wxPoint release( event.GetX(), event.GetY() );
1980 
1981  m_zooming = false;
1982 
1983  if( m_movingInfoLayer != NULL )
1984  {
1986  m_movingInfoLayer = NULL;
1987  }
1988  else
1989  {
1990  if( release != press )
1991  {
1992  ZoomRect( press, release );
1993  } /*else {
1994  * if (m_coordTooltip) {
1995  * wxString toolTipContent;
1996  * toolTipContent.Printf( "X = %f\nY = %f", p2x(event.GetX()), p2y(event.GetY()));
1997  * SetToolTip(toolTipContent);
1998  * }
1999  * } */
2000  }
2001 
2002  event.Skip();
2003 }
bool m_zooming
Definition: mathplot.h:1512
wxPoint m_mouseLClick
Definition: mathplot.h:1508
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)...
Definition: mathplot.cpp:2381
mpInfoLayer * m_movingInfoLayer
Definition: mathplot.h:1511
virtual void UpdateReference()
Updates the rectangle reference point.
Definition: mathplot.cpp:147
void mpWindow::OnMouseMiddleDown ( wxMouseEvent &  event)
protected

Definition at line 1802 of file mathplot.cpp.

References m_mouseMClick, wxPoint::x, and wxPoint::y.

1803 {
1804  m_mouseMClick.x = event.GetX();
1805  m_mouseMClick.y = event.GetY();
1806 }
wxPoint m_mouseMClick
Definition: mathplot.h:1507
void mpWindow::OnMouseMove ( wxMouseEvent &  event)
protected

Definition at line 1853 of file mathplot.cpp.

References mpInfoLayer::GetRectangle(), m_desiredXmax, m_desiredXmin, m_desiredYmax, m_desiredYmin, m_enableMouseNavigation, m_fgColour, m_layers, m_mouseLClick, m_mouseMClick, m_movingInfoLayer, m_posX, m_posY, m_scaleX, m_scaleY, m_zooming, m_zoomRect, mpInfoLayer::Move(), SetXView(), SetYView(), UpdateAll(), mpInfoLayer::UpdateInfo(), wxPoint::x, and wxPoint::y.

1854 {
1856  {
1857  event.Skip();
1858  return;
1859  }
1860 
1861  if( event.m_middleDown )
1862  {
1863  // The change:
1864  int Ax = m_mouseMClick.x - event.GetX();
1865  int Ay = m_mouseMClick.y - event.GetY();
1866 
1867  // For the next event, use relative to this coordinates.
1868  m_mouseMClick.x = event.GetX();
1869  m_mouseMClick.y = event.GetY();
1870 
1871  double Ax_units = Ax / m_scaleX;
1872  double Ay_units = -Ay / m_scaleY;
1873 
1874  bool updateRequired = false;
1875  updateRequired |= SetXView( m_posX + Ax_units,
1876  m_desiredXmax + Ax_units,
1877  m_desiredXmin + Ax_units );
1878  updateRequired |= SetYView( m_posY + Ay_units,
1879  m_desiredYmax + Ay_units,
1880  m_desiredYmin + Ay_units );
1881 
1882  if( updateRequired )
1883  UpdateAll();
1884 
1885 #ifdef MATHPLOT_DO_LOGGING
1886  wxLogMessage( "[mpWindow::OnMouseMove] Ax:%i Ay:%i m_posX:%f m_posY:%f",
1887  Ax,
1888  Ay,
1889  m_posX,
1890  m_posY );
1891 #endif
1892  }
1893  else
1894  {
1895  if( event.m_leftDown )
1896  {
1897  if( m_movingInfoLayer == NULL )
1898  {
1899  wxClientDC dc( this );
1900  wxPen pen( m_fgColour, 1, wxPENSTYLE_DOT );
1901  dc.SetPen( pen );
1902  dc.SetBrush( *wxTRANSPARENT_BRUSH );
1903  dc.DrawRectangle( m_mouseLClick.x, m_mouseLClick.y,
1904  event.GetX() - m_mouseLClick.x, event.GetY() - m_mouseLClick.y );
1905  m_zooming = true;
1908  m_zoomRect.width = event.GetX() - m_mouseLClick.x;
1909  m_zoomRect.height = event.GetY() - m_mouseLClick.y;
1910  }
1911  else
1912  {
1913  wxPoint moveVector( event.GetX() - m_mouseLClick.x,
1914  event.GetY() - m_mouseLClick.y );
1915  m_movingInfoLayer->Move( moveVector );
1916  m_zooming = false;
1917  }
1918 
1919  UpdateAll();
1920  }
1921  else
1922  {
1923 #if 0
1924  wxLayerList::iterator li;
1925 
1926  for( li = m_layers.begin(); li != m_layers.end(); li++ )
1927  {
1928  if( (*li)->IsInfo() && (*li)->IsVisible() )
1929  {
1930  mpInfoLayer* tmpLyr = (mpInfoLayer*) (*li);
1931  tmpLyr->UpdateInfo( *this, event );
1932  // UpdateAll();
1933  RefreshRect( tmpLyr->GetRectangle() );
1934  }
1935  }
1936 
1937 #endif
1938  /* if (m_coordTooltip) {
1939  * wxString toolTipContent;
1940  * toolTipContent.Printf( "X = %f\nY = %f", p2x(event.GetX()), p2y(event.GetY()));
1941  * wxTipWindow** ptr = NULL;
1942  * wxRect rectBounds(event.GetX(), event.GetY(), 5, 5);
1943  * wxTipWindow* tip = new wxTipWindow(this, toolTipContent, 100, ptr, &rectBounds);
1944  *
1945  * } */
1946  }
1947  }
1948 
1949  event.Skip();
1950 }
bool m_zooming
Definition: mathplot.h:1512
virtual bool SetYView(double pos, double desiredMax, double desiredMin)
Applies new Y view coordinates depending on the settings.
Definition: mathplot.cpp:2235
double m_desiredXmax
Definition: mathplot.h:1497
double m_scaleY
Definition: mathplot.h:1487
bool m_enableMouseNavigation
Definition: mathplot.h:1505
double m_posX
Definition: mathplot.h:1488
wxPoint m_mouseMClick
Definition: mathplot.h:1507
double m_scaleX
Definition: mathplot.h:1486
wxLayerList m_layers
Definition: mathplot.h:1474
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2814
wxPoint m_mouseLClick
Definition: mathplot.h:1508
virtual void Move(wxPoint delta)
Moves the layer rectangle of given pixel deltas.
Definition: mathplot.cpp:140
double m_desiredYmax
Definition: mathplot.h:1497
virtual void UpdateInfo(mpWindow &w, wxEvent &event)
Updates the content of the info box.
Definition: mathplot.cpp:129
Base class to create small rectangular info boxes mpInfoLayer is the base class to create a small rec...
Definition: mathplot.h:334
wxRect m_zoomRect
Definition: mathplot.h:1513
double m_desiredXmin
These are updated in Fit() only, and may be different from the real borders (layer coordinates) only ...
Definition: mathplot.h:1497
mpInfoLayer * m_movingInfoLayer
Definition: mathplot.h:1511
wxColour m_fgColour
Definition: mathplot.h:1479
double m_posY
Definition: mathplot.h:1489
const wxRect & GetRectangle()
Returns the current rectangle coordinates.
Definition: mathplot.h:391
double m_desiredYmin
Definition: mathplot.h:1497
virtual bool SetXView(double pos, double desiredMax, double desiredMin)
Applies new X view coordinates depending on the settings.
Definition: mathplot.cpp:2221
void mpWindow::OnMouseWheel ( wxMouseEvent &  event)
protected

Definition at line 1811 of file mathplot.cpp.

References m_desiredXmax, m_desiredXmin, m_desiredYmax, m_desiredYmin, m_enableMouseNavigation, m_posX, m_posY, m_scaleX, m_scaleY, SetXView(), SetYView(), UpdateAll(), ZoomIn(), and ZoomOut().

1812 {
1814  {
1815  event.Skip();
1816  return;
1817  }
1818 
1819  // Scroll vertically or horizontally (this is SHIFT is hold down).
1820  int change = -event.GetWheelRotation(); // Opposite direction (More intuitive)!
1821  double changeUnitsX = change / m_scaleX;
1822  double changeUnitsY = change / m_scaleY;
1823 
1824  if( event.m_controlDown )
1825  {
1826  // horizontal scroll
1827  SetXView( m_posX + changeUnitsX, m_desiredXmax + changeUnitsX,
1828  m_desiredXmin + changeUnitsX );
1829  }
1830  else if( event.m_shiftDown )
1831  {
1832  // vertical scroll
1833  SetYView( m_posY - changeUnitsY, m_desiredYmax - changeUnitsY,
1834  m_desiredYmin - changeUnitsY );
1835  }
1836  else
1837  {
1838  // zoom in/out
1839  wxPoint clickPt( event.GetX(), event.GetY() );
1840 
1841  if( event.GetWheelRotation() > 0 )
1842  ZoomIn( clickPt );
1843  else
1844  ZoomOut( clickPt );
1845  }
1846 
1847  UpdateAll();
1848 }
void ZoomOut(const wxPoint &centerPoint=wxDefaultPosition)
Zoom out current view and refresh display.
Definition: mathplot.cpp:2306
virtual bool SetYView(double pos, double desiredMax, double desiredMin)
Applies new Y view coordinates depending on the settings.
Definition: mathplot.cpp:2235
double m_desiredXmax
Definition: mathplot.h:1497
double m_scaleY
Definition: mathplot.h:1487
bool m_enableMouseNavigation
Definition: mathplot.h:1505
double m_posX
Definition: mathplot.h:1488
double m_scaleX
Definition: mathplot.h:1486
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2814
double m_desiredYmax
Definition: mathplot.h:1497
void ZoomIn(const wxPoint &centerPoint=wxDefaultPosition)
Zoom into current view and refresh display.
Definition: mathplot.cpp:2249
double m_desiredXmin
These are updated in Fit() only, and may be different from the real borders (layer coordinates) only ...
Definition: mathplot.h:1497
double m_posY
Definition: mathplot.h:1489
double m_desiredYmin
Definition: mathplot.h:1497
virtual bool SetXView(double pos, double desiredMax, double desiredMin)
Applies new X view coordinates depending on the settings.
Definition: mathplot.cpp:2221
void mpWindow::OnPaint ( wxPaintEvent &  event)
protected

Definition at line 2526 of file mathplot.cpp.

References m_buff_bmp, m_buff_dc, m_enableDoubleBuffer, m_enableScrollBars, m_fgColour, m_last_lx, m_last_ly, m_layers, m_scrX, m_scrY, m_zooming, and m_zoomRect.

2527 {
2528  wxPaintDC dc( this );
2529 
2530  dc.GetSize( &m_scrX, &m_scrY ); // This is the size of the visible area only!
2531 
2532 #ifdef MATHPLOT_DO_LOGGING
2533  wxLogMessage( "[mpWindow::OnPaint] vis.area: x %i y%i", m_scrX, m_scrY );
2534 #endif
2535 
2536  // Selects direct or buffered draw:
2537  wxDC* trgDc;
2538 
2539  // J.L.Blanco @ Aug 2007: Added double buffer support
2540  if( m_enableDoubleBuffer )
2541  {
2542  if( m_last_lx!=m_scrX || m_last_ly!=m_scrY )
2543  {
2544  if( m_buff_bmp )
2545  delete m_buff_bmp;
2546 
2547  m_buff_bmp = new wxBitmap( m_scrX, m_scrY );
2548  m_buff_dc.SelectObject( *m_buff_bmp );
2549  m_last_lx = m_scrX;
2550  m_last_ly = m_scrY;
2551  }
2552 
2553  trgDc = &m_buff_dc;
2554  }
2555  else
2556  {
2557  trgDc = &dc;
2558  }
2559 
2560  // Draw background:
2561  // trgDc->SetDeviceOrigin(0,0);
2562  trgDc->SetPen( *wxTRANSPARENT_PEN );
2563  wxBrush brush( GetBackgroundColour() );
2564  trgDc->SetBrush( brush );
2565  trgDc->SetTextForeground( m_fgColour );
2566  trgDc->DrawRectangle( 0, 0, m_scrX, m_scrY );
2567 
2568  // Draw all the layers:
2569  // trgDc->SetDeviceOrigin( m_scrX>>1, m_scrY>>1); // Origin at the center
2570  wxLayerList::iterator li;
2571 
2572  for( li = m_layers.begin(); li != m_layers.end(); li++ )
2573  {
2574  (*li)->Plot( *trgDc, *this );
2575  }
2576 
2577  ;
2578 
2579  if( m_zooming )
2580  {
2581  wxPen pen( m_fgColour, 1, wxPENSTYLE_DOT );
2582  trgDc->SetPen( pen );
2583  trgDc->SetBrush( *wxTRANSPARENT_BRUSH );
2584  trgDc->DrawRectangle( m_zoomRect );
2585  }
2586 
2587  // If doublebuffer, draw now to the window:
2588  if( m_enableDoubleBuffer )
2589  {
2590  // trgDc->SetDeviceOrigin(0,0);
2591  // dc.SetDeviceOrigin(0,0); // Origin at the center
2592  dc.Blit( 0, 0, m_scrX, m_scrY, trgDc, 0, 0 );
2593  }
2594 
2595  /* if (m_coordTooltip) {
2596  * wxString toolTipContent;
2597  * wxPoint mousePoint = wxGetMousePosition();
2598  * toolTipContent.Printf( "X = %f\nY = %f", p2x(mousePoint.x), p2y(mousePoint.y));
2599  * SetToolTip(toolTipContent);
2600  * }*/
2601  // If scrollbars are enabled, refresh them
2602  if( m_enableScrollBars )
2603  {
2604  /* m_scroll.x = (int) floor((m_posX - m_minX)*m_scaleX);
2605  * m_scroll.y = (int) floor((m_maxY - m_posY )*m_scaleY);
2606  * Scroll(m_scroll.x, m_scroll.y);*/
2607  // Scroll(x2p(m_posX), y2p(m_posY));
2608  // SetVirtualSize((int) ((m_maxX - m_minX)*m_scaleX), (int) ((m_maxY - m_minY)*m_scaleY));
2609  // int centerX = (m_scrX - m_marginLeft - m_marginRight)/2; // + m_marginLeft; // c.x = m_scrX/2;
2610  // int centerY = (m_scrY - m_marginTop - m_marginBottom)/2; // - m_marginTop; // c.y = m_scrY/2;
2611  /*SetScrollbars(1, 1, (int) ((m_maxX - m_minX)*m_scaleX), (int) ((m_maxY - m_minY)*m_scaleY));*/ // , x2p(m_posX + centerX/m_scaleX), y2p(m_posY - centerY/m_scaleY), true);
2612  }
2613 }
wxMemoryDC m_buff_dc
Definition: mathplot.h:1502
bool m_enableScrollBars
Definition: mathplot.h:1509
bool m_zooming
Definition: mathplot.h:1512
wxLayerList m_layers
Definition: mathplot.h:1474
wxRect m_zoomRect
Definition: mathplot.h:1513
wxColour m_fgColour
Definition: mathplot.h:1479
int m_last_ly
Definition: mathplot.h:1501
int m_last_lx
Definition: mathplot.h:1501
int m_scrY
Definition: mathplot.h:1491
bool m_enableDoubleBuffer
Definition: mathplot.h:1504
int m_scrX
Definition: mathplot.h:1490
wxBitmap * m_buff_bmp
Definition: mathplot.h:1503
void mpWindow::OnScrollBottom ( wxScrollWinEvent &  event)
protected

Definition at line 2972 of file mathplot.cpp.

References DoScrollCalc().

2973 {
2974  int scrollOrientation = event.GetOrientation();
2975  // Get thumb size
2976  int thumbSize = GetScrollThumb( scrollOrientation );
2977  // Get scroll range
2978  int scrollRange = GetScrollRange( scrollOrientation );
2979 
2980  DoScrollCalc( scrollRange - thumbSize, scrollOrientation );
2981 }
void DoScrollCalc(const int position, const int orientation)
Definition: mathplot.cpp:2861
void mpWindow::OnScrollLineDown ( wxScrollWinEvent &  event)
protected

Definition at line 2946 of file mathplot.cpp.

References DoScrollCalc(), and mpSCROLL_NUM_PIXELS_PER_LINE.

2947 {
2948  int scrollOrientation = event.GetOrientation();
2949  // Get position before page up
2950  int position = GetScrollPos( scrollOrientation );
2951  // Get thumb size
2952  int thumbSize = GetScrollThumb( scrollOrientation );
2953  // Get scroll range
2954  int scrollRange = GetScrollRange( scrollOrientation );
2955 
2956  // Need to adjust position by a page
2957  position += mpSCROLL_NUM_PIXELS_PER_LINE;
2958 
2959  if( position > (scrollRange - thumbSize) )
2960  position = scrollRange - thumbSize;
2961 
2962  DoScrollCalc( position, scrollOrientation );
2963 }
#define mpSCROLL_NUM_PIXELS_PER_LINE
Definition: mathplot.cpp:60
void DoScrollCalc(const int position, const int orientation)
Definition: mathplot.cpp:2861
void mpWindow::OnScrollLineUp ( wxScrollWinEvent &  event)
protected

Definition at line 2930 of file mathplot.cpp.

References DoScrollCalc(), and mpSCROLL_NUM_PIXELS_PER_LINE.

2931 {
2932  int scrollOrientation = event.GetOrientation();
2933  // Get position before page up
2934  int position = GetScrollPos( scrollOrientation );
2935 
2936  // Need to adjust position by a line
2937  position -= mpSCROLL_NUM_PIXELS_PER_LINE;
2938 
2939  if( position < 0 )
2940  position = 0;
2941 
2942  DoScrollCalc( position, scrollOrientation );
2943 }
#define mpSCROLL_NUM_PIXELS_PER_LINE
Definition: mathplot.cpp:60
void DoScrollCalc(const int position, const int orientation)
Definition: mathplot.cpp:2861
void mpWindow::OnScrollPageDown ( wxScrollWinEvent &  event)
protected

Definition at line 2910 of file mathplot.cpp.

References DoScrollCalc().

2911 {
2912  int scrollOrientation = event.GetOrientation();
2913  // Get position before page up
2914  int position = GetScrollPos( scrollOrientation );
2915  // Get thumb size
2916  int thumbSize = GetScrollThumb( scrollOrientation );
2917  // Get scroll range
2918  int scrollRange = GetScrollRange( scrollOrientation );
2919 
2920  // Need to adjust position by a page
2921  position += thumbSize;
2922 
2923  if( position > (scrollRange - thumbSize) )
2924  position = scrollRange - thumbSize;
2925 
2926  DoScrollCalc( position, scrollOrientation );
2927 }
void DoScrollCalc(const int position, const int orientation)
Definition: mathplot.cpp:2861
void mpWindow::OnScrollPageUp ( wxScrollWinEvent &  event)
protected

Definition at line 2892 of file mathplot.cpp.

References DoScrollCalc().

2893 {
2894  int scrollOrientation = event.GetOrientation();
2895  // Get position before page up
2896  int position = GetScrollPos( scrollOrientation );
2897  // Get thumb size
2898  int thumbSize = GetScrollThumb( scrollOrientation );
2899 
2900  // Need to adjust position by a page
2901  position -= thumbSize;
2902 
2903  if( position < 0 )
2904  position = 0;
2905 
2906  DoScrollCalc( position, scrollOrientation );
2907 }
void DoScrollCalc(const int position, const int orientation)
Definition: mathplot.cpp:2861
void mpWindow::OnScrollThumbTrack ( wxScrollWinEvent &  event)
protected

Definition at line 2886 of file mathplot.cpp.

References DoScrollCalc().

2887 {
2888  DoScrollCalc( event.GetPosition(), event.GetOrientation() );
2889 }
void DoScrollCalc(const int position, const int orientation)
Definition: mathplot.cpp:2861
void mpWindow::OnScrollTop ( wxScrollWinEvent &  event)
protected

Definition at line 2966 of file mathplot.cpp.

References DoScrollCalc().

2967 {
2968  DoScrollCalc( 0, event.GetOrientation() );
2969 }
void DoScrollCalc(const int position, const int orientation)
Definition: mathplot.cpp:2861
void mpWindow::OnShowPopupMenu ( wxMouseEvent &  event)
protected

Definition at line 2414 of file mathplot.cpp.

References m_clickedX, m_clickedY, and m_popmenu.

2415 {
2416  m_clickedX = event.GetX();
2417  m_clickedY = event.GetY();
2418  PopupMenu( &m_popmenu, event.GetX(), event.GetY() );
2419 }
int m_clickedX
Definition: mathplot.h:1492
int m_clickedY
Definition: mathplot.h:1493
wxMenu m_popmenu
Definition: mathplot.h:1475
void mpWindow::OnSize ( wxSizeEvent &  event)
protected

Definition at line 2456 of file mathplot.cpp.

References Fit(), m_desiredXmax, m_desiredXmin, m_desiredYmax, m_desiredYmin, m_scrX, and m_scrY.

2457 {
2458  // Try to fit again with the new window size:
2460 #ifdef MATHPLOT_DO_LOGGING
2461  wxLogMessage( "mpWindow::OnSize() m_scrX = %d, m_scrY = %d", m_scrX, m_scrY );
2462 #endif // MATHPLOT_DO_LOGGING
2463 }
double m_desiredXmax
Definition: mathplot.h:1497
double m_desiredYmax
Definition: mathplot.h:1497
double m_desiredXmin
These are updated in Fit() only, and may be different from the real borders (layer coordinates) only ...
Definition: mathplot.h:1497
void Fit() override
Set view to fit global bounding box of all plot layers and refresh display.
Definition: mathplot.cpp:2006
double m_desiredYmin
Definition: mathplot.h:1497
int m_scrY
Definition: mathplot.h:1491
int m_scrX
Definition: mathplot.h:1490
void mpWindow::OnZoomIn ( wxCommandEvent &  event)
protected

Definition at line 2444 of file mathplot.cpp.

References m_mouseMClick, wxPoint::x, wxPoint::y, and ZoomIn().

2445 {
2447 }
wxPoint m_mouseMClick
Definition: mathplot.h:1507
void ZoomIn(const wxPoint &centerPoint=wxDefaultPosition)
Zoom into current view and refresh display.
Definition: mathplot.cpp:2249
void mpWindow::OnZoomOut ( wxCommandEvent &  event)
protected

Definition at line 2450 of file mathplot.cpp.

References ZoomOut().

2451 {
2452  ZoomOut();
2453 }
void ZoomOut(const wxPoint &centerPoint=wxDefaultPosition)
Zoom out current view and refresh display.
Definition: mathplot.cpp:2306
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 1185 of file mathplot.h.

Referenced by DoZoomInXCalc(), DoZoomOutXCalc(), mpScaleXBase::getVisibleDataRange(), OnCenter(), CURSOR::Plot(), mpFX::Plot(), mpProfile::Plot(), ZoomIn(), ZoomOut(), and ZoomRect().

1185 { return m_posX + pixelCoordX / m_scaleX; }
double m_posX
Definition: mathplot.h:1488
double m_scaleX
Definition: mathplot.h:1486
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 1190 of file mathplot.h.

Referenced by DoZoomInYCalc(), DoZoomOutYCalc(), mpScaleY::getVisibleDataRange(), OnCenter(), mpFY::Plot(), ZoomIn(), ZoomOut(), and ZoomRect().

1190 { return m_posY - pixelCoordY / m_scaleY; }
double m_scaleY
Definition: mathplot.h:1487
double m_posY
Definition: mathplot.h:1489
bool mpWindow::SaveScreenshot ( const wxString &  filename,
wxBitmapType  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

Definition at line 3044 of file mathplot.cpp.

References Fit(), m_desiredXmax, m_desiredXmin, m_desiredYmax, m_desiredYmin, m_layers, m_maxX, m_maxY, m_minX, m_minY, m_scrX, m_scrY, SetScr(), and UpdateAll().

Referenced by SIM_PLOT_FRAME::menuSaveImage().

3046 {
3047  int sizeX, sizeY;
3048  int bk_scrX, bk_scrY;
3049 
3050  if( imageSize == wxDefaultSize )
3051  {
3052  sizeX = m_scrX;
3053  sizeY = m_scrY;
3054  }
3055  else
3056  {
3057  sizeX = imageSize.x;
3058  sizeY = imageSize.y;
3059  bk_scrX = m_scrX;
3060  bk_scrY = m_scrY;
3061  SetScr( sizeX, sizeY );
3062  }
3063 
3064  wxBitmap screenBuffer( sizeX, sizeY );
3065  wxMemoryDC screenDC;
3066  screenDC.SelectObject( screenBuffer );
3067  screenDC.SetPen( *wxTRANSPARENT_PEN );
3068  wxBrush brush( GetBackgroundColour() );
3069  screenDC.SetBrush( brush );
3070  screenDC.DrawRectangle( 0, 0, sizeX, sizeY );
3071 
3072  if( fit )
3073  {
3074  Fit( m_minX, m_maxX, m_minY, m_maxY, &sizeX, &sizeY );
3075  }
3076  else
3077  {
3079  }
3080 
3081  // Draw all the layers:
3082  wxLayerList::iterator li;
3083 
3084  for( li = m_layers.begin(); li != m_layers.end(); li++ )
3085  (*li)->Plot( screenDC, *this );
3086 
3087  if( imageSize != wxDefaultSize )
3088  {
3089  // Restore dimensions
3090  SetScr( bk_scrX, bk_scrY );
3091  Fit( m_desiredXmin, m_desiredXmax, m_desiredYmin, m_desiredYmax, &bk_scrX, &bk_scrY );
3092  UpdateAll();
3093  }
3094 
3095  // Once drawing is complete, actually save screen shot
3096  wxImage screenImage = screenBuffer.ConvertToImage();
3097  return screenImage.SaveFile( filename, type );
3098 }
double m_desiredXmax
Definition: mathplot.h:1497
double m_minY
Definition: mathplot.h:1484
wxLayerList m_layers
Definition: mathplot.h:1474
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2814
double m_desiredYmax
Definition: mathplot.h:1497
double m_desiredXmin
These are updated in Fit() only, and may be different from the real borders (layer coordinates) only ...
Definition: mathplot.h:1497
void Fit() override
Set view to fit global bounding box of all plot layers and refresh display.
Definition: mathplot.cpp:2006
double m_minX
Definition: mathplot.h:1482
double m_desiredYmin
Definition: mathplot.h:1497
void SetScr(int scrX, int scrY)
Set current view's dimensions in device context units.
Definition: mathplot.h:1180
int m_scrY
Definition: mathplot.h:1491
double m_maxX
Definition: mathplot.h:1483
int m_scrX
Definition: mathplot.h:1490
double m_maxY
Definition: mathplot.h:1485
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)

Definition at line 3178 of file mathplot.cpp.

References m_axColour, m_bgColour, m_fgColour, m_layers, mpLAYER_AXIS, and mpLAYER_INFO.

Referenced by mpPrintout::OnPrintPage(), and SIM_PLOT_PANEL::SIM_PLOT_PANEL().

3181 {
3182  SetBackgroundColour( bgColour );
3183  SetForegroundColour( drawColour );
3184  m_bgColour = bgColour;
3185  m_fgColour = drawColour;
3186  m_axColour = axesColour;
3187  // cycle between layers to set colours and properties to them
3188  wxLayerList::iterator li;
3189 
3190  for( li = m_layers.begin(); li != m_layers.end(); li++ )
3191  {
3192  if( (*li)->GetLayerType() == mpLAYER_AXIS )
3193  {
3194  wxPen axisPen = (*li)->GetPen(); // Get the old pen to modify only colour, not style or width
3195  axisPen.SetColour( axesColour );
3196  (*li)->SetPen( axisPen );
3197  }
3198 
3199  if( (*li)->GetLayerType() == mpLAYER_INFO )
3200  {
3201  wxPen infoPen = (*li)->GetPen(); // Get the old pen to modify only colour, not style or width
3202  infoPen.SetColour( drawColour );
3203  (*li)->SetPen( infoPen );
3204  }
3205  }
3206 }
wxColour m_axColour
Definition: mathplot.h:1480
wxLayerList m_layers
Definition: mathplot.h:1474
wxColour m_fgColour
Definition: mathplot.h:1479
wxColour m_bgColour
Definition: mathplot.h:1478
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

Definition at line 3138 of file mathplot.cpp.

References GetLayerByName(), mpLayer::SetVisible(), and UpdateAll().

3139 {
3140  mpLayer* lx = GetLayerByName( name );
3141 
3142  if( lx )
3143  {
3144  lx->SetVisible( viewable );
3145  UpdateAll();
3146  }
3147 }
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2814
void SetVisible(bool show)
Sets layer visibility.
Definition: mathplot.h:301
mpLayer * GetLayerByName(const wxString &name)
Definition: mathplot.cpp:3024
const char * name
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

Definition at line 3158 of file mathplot.cpp.

References GetLayer(), mpLayer::SetVisible(), and UpdateAll().

3159 {
3160  mpLayer* lx = GetLayer( position );
3161 
3162  if( lx )
3163  {
3164  lx->SetVisible( viewable );
3165  UpdateAll();
3166  }
3167 }
mpLayer * GetLayer(int position)
Definition: mathplot.cpp:3015
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2814
void SetVisible(bool show)
Sets layer visibility.
Definition: mathplot.h:301
void mpWindow::SetMarginBottom ( int  bottom)
inline

Set the bottom margin.

Parameters
bottomBottom Margin

Definition at line 1341 of file mathplot.h.

1341 { m_marginBottom = bottom; };
int m_marginBottom
Definition: mathplot.h:1499
void mpWindow::SetMarginLeft ( int  left)
inline

Set the left margin.

Parameters
leftLeft Margin

Definition at line 1343 of file mathplot.h.

1343 { m_marginLeft = left; };
int m_marginLeft
Definition: mathplot.h:1499
void mpWindow::SetMarginRight ( int  right)
inline

Set the right margin.

Parameters
rightRight Margin

Definition at line 1339 of file mathplot.h.

1339 { m_marginRight = right; };
int m_marginRight
Definition: mathplot.h:1499
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

Definition at line 3101 of file mathplot.cpp.

References m_marginBottom, m_marginLeft, m_marginRight, and m_marginTop.

Referenced by SIM_PLOT_PANEL::SIM_PLOT_PANEL().

3102 {
3103  m_marginTop = top;
3104  m_marginRight = right;
3105  m_marginBottom = bottom;
3106  m_marginLeft = left;
3107 }
int m_marginRight
Definition: mathplot.h:1499
int m_marginLeft
Definition: mathplot.h:1499
int m_marginTop
Definition: mathplot.h:1499
int m_marginBottom
Definition: mathplot.h:1499
void mpWindow::SetMarginTop ( int  top)
inline

Set the top margin.

Parameters
topTop Margin

Definition at line 1337 of file mathplot.h.

1337 { m_marginTop = top; };
int m_marginTop
Definition: mathplot.h:1499
void mpWindow::SetMPScrollbars ( bool  status)

Enable/disable scrollbars.

Parameters
statusSet to true to show scrollbars
  • m_scroll.x = (int) floor((m_posX - m_minX)*m_scaleX);

Definition at line 2665 of file mathplot.cpp.

References m_enableScrollBars, and UpdateAll().

2666 {
2667  // Temporary behaviour: always disable scrollbars
2668  m_enableScrollBars = status; // false;
2669 
2670  if( status == false )
2671  {
2672  SetScrollbar( wxHORIZONTAL, 0, 0, 0 );
2673  SetScrollbar( wxVERTICAL, 0, 0, 0 );
2674  }
2675 
2676  // else the scroll bars will be updated in UpdateAll();
2677  UpdateAll();
2678 
2679  // EnableScrolling(false, false);
2680  // m_enableScrollBars = status;
2681  // EnableScrolling(status, status);
2682  /* m_scroll.x = (int) floor((m_posX - m_minX)*m_scaleX);
2683  * m_scroll.y = (int) floor((m_posY - m_minY)*m_scaleY);*/
2684  // int scrollWidth = (int) floor((m_maxX - m_minX)*m_scaleX) - m_scrX;
2685  // int scrollHeight = (int) floor((m_minY - m_maxY)*m_scaleY) - m_scrY;
2686 
2688  // m_scroll.y = (int) floor((m_maxY - m_posY /*- m_minY*/)*m_scaleY);
2689  // int scrollWidth = (int) floor(((m_maxX - m_minX) - (m_desiredXmax - m_desiredXmin))*m_scaleX);
2690  // int scrollHeight = (int) floor(((m_maxY - m_minY) - (m_desiredYmax - m_desiredYmin))*m_scaleY);
2691  // #ifdef MATHPLOT_DO_LOGGING
2692  // wxLogMessage( "mpWindow::SetMPScrollbars() scrollWidth = %d, scrollHeight = %d", scrollWidth, scrollHeight);
2693  // #endif
2694  // if(status) {
2695  // SetScrollbars(1,
2696  // 1,
2697  // scrollWidth,
2698  // scrollHeight,
2699  // m_scroll.x,
2700  // m_scroll.y);
2702  // }
2703  // Refresh(false);*/
2704 };
bool m_enableScrollBars
Definition: mathplot.h:1509
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2814
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 1173 of file mathplot.h.

Referenced by OnCenter().

1173 { m_posX = posX; m_posY = posY; UpdateAll(); }
double m_posX
Definition: mathplot.h:1488
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2814
double m_posY
Definition: mathplot.h:1489
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 1162 of file mathplot.h.

Referenced by DoScrollCalc().

1162 { m_posX = posX; UpdateAll(); }
double m_posX
Definition: mathplot.h:1488
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2814
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 1167 of file mathplot.h.

Referenced by DoScrollCalc().

1167 { m_posY = posY; UpdateAll(); }
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2814
double m_posY
Definition: mathplot.h:1489
void mpWindow::SetScaleX ( double  scaleX)

Set current view's X scale and refresh display.

Parameters
scaleXNew scale, must not be 0.

Definition at line 2986 of file mathplot.cpp.

References m_scaleX, and UpdateAll().

2987 {
2988  if( scaleX!=0 )
2989  m_scaleX = scaleX;
2990 
2991  UpdateAll();
2992 }
double m_scaleX
Definition: mathplot.h:1486
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2814
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 1151 of file mathplot.h.

1152  {
1153  if( scaleY!=0 )
1154  m_scaleY = scaleY;
1155 
1156  UpdateAll();
1157  }
double m_scaleY
Definition: mathplot.h:1487
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2814
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 1180 of file mathplot.h.

Referenced by SaveScreenshot().

1180 { m_scrX = scrX; m_scrY = scrY; }
int m_scrY
Definition: mathplot.h:1491
int m_scrX
Definition: mathplot.h:1490
bool mpWindow::SetXView ( double  pos,
double  desiredMax,
double  desiredMin 
)
protectedvirtual

Applies new X view coordinates depending on the settings.

Returns
true if the changes were applied

Definition at line 2221 of file mathplot.cpp.

References AdjustLimitedView(), m_desiredXmax, m_desiredXmin, and m_posX.

Referenced by OnMouseMove(), and OnMouseWheel().

2222 {
2223  // if(!CheckXLimits(desiredMax, desiredMin))
2224  // return false;
2225 
2226  m_posX = pos;
2227  m_desiredXmax = desiredMax;
2228  m_desiredXmin = desiredMin;
2230 
2231  return true;
2232 }
double m_desiredXmax
Definition: mathplot.h:1497
double m_posX
Definition: mathplot.h:1488
void AdjustLimitedView()
Definition: mathplot.cpp:2177
double m_desiredXmin
These are updated in Fit() only, and may be different from the real borders (layer coordinates) only ...
Definition: mathplot.h:1497
bool mpWindow::SetYView ( double  pos,
double  desiredMax,
double  desiredMin 
)
protectedvirtual

Applies new Y view coordinates depending on the settings.

Returns
true if the changes were applied

Definition at line 2235 of file mathplot.cpp.

References AdjustLimitedView(), m_desiredYmax, m_desiredYmin, and m_posY.

Referenced by OnMouseMove(), and OnMouseWheel().

2236 {
2237  // if(!CheckYLimits(desiredMax, desiredMin))
2238  // return false;
2239 
2240  m_posY = pos;
2241  m_desiredYmax = desiredMax;
2242  m_desiredYmin = desiredMin;
2244 
2245  return true;
2246 }
double m_desiredYmax
Definition: mathplot.h:1497
void AdjustLimitedView()
Definition: mathplot.cpp:2177
double m_posY
Definition: mathplot.h:1489
double m_desiredYmin
Definition: mathplot.h:1497
void mpWindow::UpdateAll ( )

Refresh display.

Definition at line 2814 of file mathplot.cpp.

References m_desiredXmax, m_desiredXmin, m_desiredYmax, m_desiredYmin, m_enableScrollBars, m_marginBottom, m_marginLeft, m_marginRight, m_marginTop, m_maxX, m_maxY, m_minX, m_minY, m_posX, m_posY, m_scaleX, m_scaleY, Refresh(), and UpdateBBox().

Referenced by AddLayer(), SIM_PLOT_PANEL::AddTrace(), DelAllLayers(), DelLayer(), Fit(), OnMouseMove(), OnMouseWheel(), mpPrintout::OnPrintPage(), SIM_PLOT_FRAME::onSimFinished(), SaveScreenshot(), SetLayerVisible(), SetMPScrollbars(), SetScaleX(), SIM_PLOT_PANEL::ShowGrid(), SIM_PLOT_PANEL::ShowLegend(), SIM_PLOT_PANEL::SIM_PLOT_PANEL(), ZoomIn(), ZoomInX(), ZoomInY(), ZoomOut(), ZoomOutX(), and ZoomOutY().

2815 {
2816  if( UpdateBBox() )
2817  {
2818  if( m_enableScrollBars )
2819  {
2820  int cx, cy;
2821  GetClientSize( &cx, &cy );
2822  // Do x scroll bar
2823  {
2824  // Convert margin sizes from pixels to coordinates
2825  double leftMargin = m_marginLeft / m_scaleX;
2826  // Calculate the range in coords that we want to scroll over
2827  double maxX = (m_desiredXmax > m_maxX) ? m_desiredXmax : m_maxX;
2828  double minX = (m_desiredXmin < m_minX) ? m_desiredXmin : m_minX;
2829 
2830  if( (m_posX + leftMargin) < minX )
2831  minX = m_posX + leftMargin;
2832 
2833  // Calculate scroll bar size and thumb position
2834  int sizeX = (int) ( (maxX - minX) * m_scaleX );
2835  int thumbX = (int) ( ( (m_posX + leftMargin) - minX ) * m_scaleX );
2836  SetScrollbar( wxHORIZONTAL, thumbX, cx - (m_marginRight + m_marginLeft), sizeX );
2837  }
2838  // Do y scroll bar
2839  {
2840  // Convert margin sizes from pixels to coordinates
2841  double topMargin = m_marginTop / m_scaleY;
2842  // Calculate the range in coords that we want to scroll over
2843  double maxY = (m_desiredYmax > m_maxY) ? m_desiredYmax : m_maxY;
2844 
2845  if( (m_posY - topMargin) > maxY )
2846  maxY = m_posY - topMargin;
2847 
2848  double minY = (m_desiredYmin < m_minY) ? m_desiredYmin : m_minY;
2849  // Calculate scroll bar size and thumb position
2850  int sizeY = (int) ( (maxY - minY) * m_scaleY );
2851  int thumbY = (int) ( ( maxY - (m_posY - topMargin) ) * m_scaleY );
2852  SetScrollbar( wxVERTICAL, thumbY, cy - (m_marginTop + m_marginBottom), sizeY );
2853  }
2854  }
2855  }
2856 
2857  Refresh( false );
2858 }
int m_marginRight
Definition: mathplot.h:1499
bool m_enableScrollBars
Definition: mathplot.h:1509
int m_marginLeft
Definition: mathplot.h:1499
double m_desiredXmax
Definition: mathplot.h:1497
double m_scaleY
Definition: mathplot.h:1487
double m_posX
Definition: mathplot.h:1488
double m_minY
Definition: mathplot.h:1484
double m_scaleX
Definition: mathplot.h:1486
double m_desiredYmax
Definition: mathplot.h:1497
void Refresh()
Update the board display after modifying it bu a python script (note: it is automatically called by a...
double m_desiredXmin
These are updated in Fit() only, and may be different from the real borders (layer coordinates) only ...
Definition: mathplot.h:1497
double m_posY
Definition: mathplot.h:1489
int m_marginTop
Definition: mathplot.h:1499
double m_minX
Definition: mathplot.h:1482
double m_desiredYmin
Definition: mathplot.h:1497
int m_marginBottom
Definition: mathplot.h:1499
virtual bool UpdateBBox()
Recalculate global layer bounding box, and save it in m_minX,...
Definition: mathplot.cpp:2706
double m_maxX
Definition: mathplot.h:1483
double m_maxY
Definition: mathplot.h:1485
bool mpWindow::UpdateBBox ( )
protectedvirtual

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

Returns
true if there is any valid BBox information.

Definition at line 2706 of file mathplot.cpp.

References mpLayer::GetMaxX(), mpLayer::GetMaxY(), mpLayer::GetMinX(), mpLayer::GetMinY(), mpLayer::HasBBox(), m_layers, m_maxX, m_maxY, m_minX, and m_minY.

Referenced by Fit(), and UpdateAll().

2707 {
2708  m_minX = 0.0;
2709  m_maxX = 1.0;
2710  m_minY = 0.0;
2711  m_maxY = 1.0;
2712 
2713  return true;
2714 
2715 #if 0
2716  bool first = true;
2717 
2718  for( wxLayerList::iterator li = m_layers.begin(); li != m_layers.end(); li++ )
2719  {
2720  mpLayer* f = *li;
2721 
2722  if( f->HasBBox() )
2723  {
2724  if( first )
2725  {
2726  first = false;
2727  m_minX = f->GetMinX(); m_maxX = f->GetMaxX();
2728  m_minY = f->GetMinY(); m_maxY = f->GetMaxY();
2729  }
2730  else
2731  {
2732  if( f->GetMinX()<m_minX )
2733  m_minX = f->GetMinX();
2734 
2735  if( f->GetMaxX()>m_maxX )
2736  m_maxX = f->GetMaxX();
2737 
2738  if( f->GetMinY()<m_minY )
2739  m_minY = f->GetMinY();
2740 
2741  if( f->GetMaxY()>m_maxY )
2742  m_maxY = f->GetMaxY();
2743  }
2744  }
2745 
2746  // node = node->GetNext();
2747  }
2748 
2749 #ifdef MATHPLOT_DO_LOGGING
2750  wxLogDebug( wxT(
2751  "[mpWindow::UpdateBBox] Bounding box: Xmin = %f, Xmax = %f, Ymin = %f, YMax = %f" ), m_minX, m_maxX, m_minY,
2752  m_maxY );
2753 #endif // MATHPLOT_DO_LOGGING
2754 
2755  return first == false;
2756 #endif
2757 }
double m_minY
Definition: mathplot.h:1484
wxLayerList m_layers
Definition: mathplot.h:1474
virtual double GetMaxX()
Get inclusive right border of bounding box.
Definition: mathplot.h:179
virtual double GetMaxY()
Get inclusive top border of bounding box.
Definition: mathplot.h:189
virtual double GetMinX()
Get inclusive left border of bounding box.
Definition: mathplot.h:174
virtual double GetMinY()
Get inclusive bottom border of bounding box.
Definition: mathplot.h:184
double m_minX
Definition: mathplot.h:1482
virtual bool HasBBox()
Check whether this layer has a bounding box.
Definition: mathplot.h:160
double m_maxX
Definition: mathplot.h:1483
double m_maxY
Definition: mathplot.h:1485
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 1195 of file mathplot.h.

Referenced by CURSOR::Inside(), CURSOR::Plot(), mpFY::Plot(), mpFXY::Plot(), mpScaleY::Plot(), mpMovableObject::Plot(), mpBitmapLayer::Plot(), and CURSOR::UpdateReference().

1195 { return (wxCoord) ( (x - m_posX) * m_scaleX ); }
double m_posX
Definition: mathplot.h:1488
double m_scaleX
Definition: mathplot.h:1486
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 1200 of file mathplot.h.

Referenced by CURSOR::Inside(), CURSOR::Plot(), mpFX::Plot(), mpFXY::Plot(), mpProfile::Plot(), mpScaleXBase::Plot(), mpMovableObject::Plot(), mpBitmapLayer::Plot(), and CURSOR::UpdateReference().

1200 { return (wxCoord) ( (m_posY - y) * m_scaleY ); }
double m_scaleY
Definition: mathplot.h:1487
double m_posY
Definition: mathplot.h:1489
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).

Definition at line 2249 of file mathplot.cpp.

References AdjustLimitedView(), m_desiredXmax, m_desiredXmin, m_desiredYmax, m_desiredYmin, m_marginBottom, m_marginLeft, m_marginRight, m_marginTop, m_posX, m_posY, m_scaleX, m_scaleY, m_scrX, m_scrY, max, MAX_SCALE, min, p2x(), p2y(), UpdateAll(), wxPoint::x, wxPoint::y, and zoomIncrementalFactor.

Referenced by SIM_PLOT_FRAME::menuZoomIn(), OnMouseWheel(), and OnZoomIn().

2250 {
2251  wxPoint c( centerPoint );
2252 
2253  if( c == wxDefaultPosition )
2254  {
2255  GetClientSize( &m_scrX, &m_scrY );
2256  c.x = (m_scrX - m_marginLeft - m_marginRight) / 2 + m_marginLeft; // c.x = m_scrX/2;
2257  c.y = (m_scrY - m_marginTop - m_marginBottom) / 2 - m_marginTop; // c.y = m_scrY/2;
2258  }
2259  else
2260  {
2261  c.x = std::max( c.x, m_marginLeft );
2262  c.x = std::min( c.x, m_scrX - m_marginRight );
2263  c.y = std::max( c.y, m_marginTop );
2264  c.y = std::min( c.y, m_scrY - m_marginBottom );
2265  }
2266 
2267  // Preserve the position of the clicked point:
2268  double prior_layer_x = p2x( c.x );
2269  double prior_layer_y = p2y( c.y );
2270 
2271  // Zoom in:
2272  const double MAX_SCALE = 1e6;
2273  double newScaleX = m_scaleX * zoomIncrementalFactor;
2274  double newScaleY = m_scaleY * zoomIncrementalFactor;
2275 
2276  // Baaaaad things happen when you zoom in too much..
2277  if( newScaleX <= MAX_SCALE && newScaleY <= MAX_SCALE )
2278  {
2279  m_scaleX = newScaleX;
2280  m_scaleY = newScaleY;
2281  }
2282  else
2283  {
2284  return;
2285  }
2286 
2287  // Adjust the new m_posx/y:
2288  m_posX = prior_layer_x - c.x / m_scaleX;
2289  m_posY = prior_layer_y + c.y / m_scaleY;
2290 
2292  m_desiredXmax = m_posX + (m_scrX - m_marginLeft - m_marginRight) / m_scaleX; // m_desiredXmax = m_posX + m_scrX / m_scaleX;
2294  m_desiredYmin = m_posY - (m_scrY - m_marginTop - m_marginBottom) / m_scaleY; // m_desiredYmin = m_posY - m_scrY / m_scaleY;
2296 
2297 #ifdef MATHPLOT_DO_LOGGING
2298  wxLogMessage( "mpWindow::ZoomIn() prior coords: (%f,%f), new coords: (%f,%f) SHOULD BE EQUAL!!",
2299  prior_layer_x, prior_layer_y, p2x( c.x ), p2y( c.y ) );
2300 #endif
2301 
2302  UpdateAll();
2303 }
int m_marginRight
Definition: mathplot.h:1499
int m_marginLeft
Definition: mathplot.h:1499
double p2x(wxCoord pixelCoordX)
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates, using current mpWindow position and scale.
Definition: mathplot.h:1185
double m_desiredXmax
Definition: mathplot.h:1497
double m_scaleY
Definition: mathplot.h:1487
double m_posX
Definition: mathplot.h:1488
double p2y(wxCoord pixelCoordY)
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates, using current mpWindow position and scale.
Definition: mathplot.h:1190
double m_scaleX
Definition: mathplot.h:1486
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2814
double m_desiredYmax
Definition: mathplot.h:1497
void AdjustLimitedView()
Definition: mathplot.cpp:2177
double m_desiredXmin
These are updated in Fit() only, and may be different from the real borders (layer coordinates) only ...
Definition: mathplot.h:1497
double m_posY
Definition: mathplot.h:1489
int m_marginTop
Definition: mathplot.h:1499
double m_desiredYmin
Definition: mathplot.h:1497
#define max(a, b)
Definition: auxiliary.h:86
int m_marginBottom
Definition: mathplot.h:1499
int m_scrY
Definition: mathplot.h:1491
static double zoomIncrementalFactor
This value sets the zoom steps whenever the user clicks "Zoom in/out" or performs zoom with the mouse...
Definition: mathplot.h:1327
int m_scrX
Definition: mathplot.h:1490
#define min(a, b)
Definition: auxiliary.h:85
void mpWindow::ZoomInX ( )

Zoom in current view along X and refresh display.

Definition at line 2353 of file mathplot.cpp.

References m_scaleX, UpdateAll(), and zoomIncrementalFactor.

2354 {
2356  UpdateAll();
2357 }
double m_scaleX
Definition: mathplot.h:1486
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2814
static double zoomIncrementalFactor
This value sets the zoom steps whenever the user clicks "Zoom in/out" or performs zoom with the mouse...
Definition: mathplot.h:1327
void mpWindow::ZoomInY ( )

Zoom in current view along Y and refresh display.

Definition at line 2367 of file mathplot.cpp.

References m_scaleY, UpdateAll(), and zoomIncrementalFactor.

2368 {
2370  UpdateAll();
2371 }
double m_scaleY
Definition: mathplot.h:1487
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2814
static double zoomIncrementalFactor
This value sets the zoom steps whenever the user clicks "Zoom in/out" or performs zoom with the mouse...
Definition: mathplot.h:1327
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).

Definition at line 2306 of file mathplot.cpp.

References CheckXLimits(), CheckYLimits(), Fit(), m_desiredXmax, m_desiredXmin, m_desiredYmax, m_desiredYmin, m_marginBottom, m_marginLeft, m_marginRight, m_marginTop, m_posX, m_posY, m_scaleX, m_scaleY, m_scrX, m_scrY, p2x(), p2y(), UpdateAll(), wxPoint::x, wxPoint::y, and zoomIncrementalFactor.

Referenced by SIM_PLOT_FRAME::menuZoomOut(), OnMouseWheel(), and OnZoomOut().

2307 {
2308  wxPoint c( centerPoint );
2309 
2310  if( c == wxDefaultPosition )
2311  {
2312  GetClientSize( &m_scrX, &m_scrY );
2313  c.x = (m_scrX - m_marginLeft - m_marginRight) / 2 + m_marginLeft; // c.x = m_scrX/2;
2314  c.y = (m_scrY - m_marginTop - m_marginBottom) / 2 - m_marginTop; // c.y = m_scrY/2;
2315  }
2316 
2317  // Preserve the position of the clicked point:
2318  double prior_layer_x = p2x( c.x );
2319  double prior_layer_y = p2y( c.y );
2320 
2321  // Zoom out:
2324 
2325  // Adjust the new m_posx/y:
2326  m_posX = prior_layer_x - c.x / m_scaleX;
2327  m_posY = prior_layer_y + c.y / m_scaleY;
2328 
2330  m_desiredXmax = m_posX + (m_scrX - m_marginLeft - m_marginRight) / m_scaleX; // m_desiredXmax = m_posX + m_scrX / m_scaleX;
2332  m_desiredYmin = m_posY - (m_scrY - m_marginTop - m_marginBottom) / m_scaleY; // m_desiredYmin = m_posY - m_scrY / m_scaleY;
2333 
2334  // printf("desired xmin %.1f ymin %.1f xmax %.1f ymax %.1f l %d\n", m_desiredXmin, m_desiredYmin, m_desiredXmax, m_desiredYmax, !!m_enableLimitedView);
2335  // printf("current xmin %.1f ymin %.1f xmax %.1f ymax %.1f\n", m_minX, m_minY, m_maxX, m_maxY);
2336 
2338  m_desiredXmin ) || !CheckYLimits( m_desiredYmax, m_desiredYmin ) )
2339  {
2340  // printf("call fit()\n");
2341  Fit();
2342  }
2343 
2344 #ifdef MATHPLOT_DO_LOGGING
2345  wxLogMessage(
2346  "mpWindow::ZoomOut() prior coords: (%f,%f), new coords: (%f,%f) SHOULD BE EQUAL!!",
2347  prior_layer_x, prior_layer_y, p2x( c.x ), p2y( c.y ) );
2348 #endif
2349  UpdateAll();
2350 }
int m_marginRight
Definition: mathplot.h:1499
int m_marginLeft
Definition: mathplot.h:1499
double p2x(wxCoord pixelCoordX)
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates, using current mpWindow position and scale.
Definition: mathplot.h:1185
double m_desiredXmax
Definition: mathplot.h:1497
double m_scaleY
Definition: mathplot.h:1487
double m_posX
Definition: mathplot.h:1488
double p2y(wxCoord pixelCoordY)
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates, using current mpWindow position and scale.
Definition: mathplot.h:1190
double m_scaleX
Definition: mathplot.h:1486
bool CheckXLimits(double &desiredMax, double &desiredMin) const
Definition: mathplot.h:1442
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2814
double m_desiredYmax
Definition: mathplot.h:1497
double m_desiredXmin
These are updated in Fit() only, and may be different from the real borders (layer coordinates) only ...
Definition: mathplot.h:1497
double m_posY
Definition: mathplot.h:1489
void Fit() override
Set view to fit global bounding box of all plot layers and refresh display.
Definition: mathplot.cpp:2006
int m_marginTop
Definition: mathplot.h:1499
double m_desiredYmin
Definition: mathplot.h:1497
bool CheckYLimits(double &desiredMax, double &desiredMin) const
Definition: mathplot.h:1449
int m_marginBottom
Definition: mathplot.h:1499
int m_scrY
Definition: mathplot.h:1491
static double zoomIncrementalFactor
This value sets the zoom steps whenever the user clicks "Zoom in/out" or performs zoom with the mouse...
Definition: mathplot.h:1327
int m_scrX
Definition: mathplot.h:1490
void mpWindow::ZoomOutX ( )

Zoom out current view along X and refresh display.

Definition at line 2360 of file mathplot.cpp.

References m_scaleX, UpdateAll(), and zoomIncrementalFactor.

2361 {
2363  UpdateAll();
2364 }
double m_scaleX
Definition: mathplot.h:1486
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2814
static double zoomIncrementalFactor
This value sets the zoom steps whenever the user clicks "Zoom in/out" or performs zoom with the mouse...
Definition: mathplot.h:1327
void mpWindow::ZoomOutY ( )

Zoom out current view along Y and refresh display.

Definition at line 2374 of file mathplot.cpp.

References m_scaleY, UpdateAll(), and zoomIncrementalFactor.

2375 {
2377  UpdateAll();
2378 }
double m_scaleY
Definition: mathplot.h:1487
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2814
static double zoomIncrementalFactor
This value sets the zoom steps whenever the user clicks "Zoom in/out" or performs zoom with the mouse...
Definition: mathplot.h:1327
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)

Definition at line 2381 of file mathplot.cpp.

References AdjustLimitedView(), Fit(), p2x(), p2y(), wxPoint::x, and wxPoint::y.

Referenced by OnMouseLeftRelease().

2382 {
2383  // Compute the 2 corners in graph coordinates:
2384  double p0x = p2x( p0.x );
2385  double p0y = p2y( p0.y );
2386  double p1x = p2x( p1.x );
2387  double p1y = p2y( p1.y );
2388 
2389  // Order them:
2390  double zoom_x_min = p0x<p1x ? p0x : p1x;
2391  double zoom_x_max = p0x>p1x ? p0x : p1x;
2392  double zoom_y_min = p0y<p1y ? p0y : p1y;
2393  double zoom_y_max = p0y>p1y ? p0y : p1y;
2394 
2395 #ifdef MATHPLOT_DO_LOGGING
2396  wxLogMessage( "Zoom: (%f,%f)-(%f,%f)", zoom_x_min, zoom_y_min, zoom_x_max, zoom_y_max );
2397 #endif
2398 
2399  Fit( zoom_x_min, zoom_x_max, zoom_y_min, zoom_y_max );
2401 }
double p2x(wxCoord pixelCoordX)
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates, using current mpWindow position and scale.
Definition: mathplot.h:1185
double p2y(wxCoord pixelCoordY)
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates, using current mpWindow position and scale.
Definition: mathplot.h:1190
void AdjustLimitedView()
Definition: mathplot.cpp:2177
void Fit() override
Set view to fit global bounding box of all plot layers and refresh display.
Definition: mathplot.cpp:2006

Member Data Documentation

wxColour mpWindow::m_axColour
protected

Definition at line 1480 of file mathplot.h.

Referenced by SetColourTheme().

wxColour mpWindow::m_bgColour
protected

Definition at line 1478 of file mathplot.h.

Referenced by SetColourTheme().

wxBitmap* mpWindow::m_buff_bmp
protected

Definition at line 1503 of file mathplot.h.

Referenced by OnPaint(), and ~mpWindow().

wxMemoryDC mpWindow::m_buff_dc
protected

Definition at line 1502 of file mathplot.h.

Referenced by OnPaint().

int mpWindow::m_clickedX
protected

Definition at line 1492 of file mathplot.h.

Referenced by OnCenter(), and OnShowPopupMenu().

int mpWindow::m_clickedY
protected

Definition at line 1493 of file mathplot.h.

Referenced by OnCenter(), and OnShowPopupMenu().

double mpWindow::m_desiredXmax
protected
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 1497 of file mathplot.h.

Referenced by AdjustLimitedView(), DoScrollCalc(), DoZoomInXCalc(), DoZoomOutXCalc(), Fit(), LockAspect(), OnMouseMove(), OnMouseWheel(), OnSize(), SaveScreenshot(), SetXView(), UpdateAll(), ZoomIn(), and ZoomOut().

double mpWindow::m_desiredYmin
protected
bool mpWindow::m_enableDoubleBuffer
protected

Definition at line 1504 of file mathplot.h.

Referenced by OnPaint().

bool mpWindow::m_enableLimitedView
protected

Definition at line 1506 of file mathplot.h.

Referenced by AdjustLimitedView().

bool mpWindow::m_enableMouseNavigation
protected

Definition at line 1505 of file mathplot.h.

Referenced by OnMouseMove(), and OnMouseWheel().

bool mpWindow::m_enableScrollBars
protected

Definition at line 1509 of file mathplot.h.

Referenced by OnPaint(), SetMPScrollbars(), and UpdateAll().

wxColour mpWindow::m_fgColour
protected

Definition at line 1479 of file mathplot.h.

Referenced by OnMouseMove(), OnPaint(), and SetColourTheme().

int mpWindow::m_last_lx
protected

Definition at line 1501 of file mathplot.h.

Referenced by OnPaint().

int mpWindow::m_last_ly
protected

Definition at line 1501 of file mathplot.h.

Referenced by OnPaint().

bool mpWindow::m_lockaspect
protected

Definition at line 1476 of file mathplot.h.

Referenced by Fit(), LockAspect(), and OnLockAspect().

int mpWindow::m_marginBottom
protected
int mpWindow::m_marginLeft
protected
int mpWindow::m_marginRight
protected
int mpWindow::m_marginTop
protected
double mpWindow::m_maxX
protected
double mpWindow::m_maxY
protected
double mpWindow::m_minX
protected
double mpWindow::m_minY
protected
wxPoint mpWindow::m_mouseLClick
protected

Definition at line 1508 of file mathplot.h.

Referenced by OnMouseLeftDown(), OnMouseLeftRelease(), and OnMouseMove().

wxPoint mpWindow::m_mouseMClick
protected

Definition at line 1507 of file mathplot.h.

Referenced by OnMouseMiddleDown(), OnMouseMove(), and OnZoomIn().

mpInfoLayer* mpWindow::m_movingInfoLayer
protected

Definition at line 1511 of file mathplot.h.

Referenced by OnMouseLeftDown(), OnMouseLeftRelease(), and OnMouseMove().

wxMenu mpWindow::m_popmenu
protected

Definition at line 1475 of file mathplot.h.

Referenced by LockAspect(), and OnShowPopupMenu().

double mpWindow::m_posX
protected
double mpWindow::m_posY
protected
double mpWindow::m_scaleY
protected
wxPoint mpWindow::m_scroll
protected

Definition at line 1510 of file mathplot.h.

int mpWindow::m_scrX
protected
int mpWindow::m_scrY
protected
bool mpWindow::m_zooming
protected

Definition at line 1512 of file mathplot.h.

Referenced by OnMouseLeftDown(), OnMouseLeftRelease(), OnMouseMove(), and OnPaint().

wxRect mpWindow::m_zoomRect
protected

Definition at line 1513 of file mathplot.h.

Referenced by OnMouseMove(), and OnPaint().

double mpWindow::zoomIncrementalFactor = 1.5
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 1327 of file mathplot.h.

Referenced by DoZoomInXCalc(), DoZoomInYCalc(), DoZoomOutXCalc(), DoZoomOutYCalc(), ZoomIn(), ZoomInX(), ZoomInY(), ZoomOut(), ZoomOutX(), and ZoomOutY().


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