KiCad PCB EDA Suite
mpWindow Class Reference

Canvas for plotting mpLayer implementations. More...

#include <mathplot.h>

Inheritance diagram for mpWindow:

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 EnableMouseWheelPan (bool enabled)
 Enable/disable trackpad friendly panning (2-axis scroll wheel) 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 ZoomIn (const wxPoint &centerPoint, double zoomFactor)
 
void ZoomOut (const wxPoint &centerPoint=wxDefaultPosition)
 Zoom out current view and refresh display. More...
 
void ZoomOut (const wxPoint &centerPoint, double zoomFactor)
 
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.1
 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 OnMagnify (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_enableMouseWheelPan
 
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 1047 of file mathplot.h.

Constructor & Destructor Documentation

◆ mpWindow() [1/2]

mpWindow::mpWindow ( )

◆ mpWindow() [2/2]

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

Definition at line 1733 of file mathplot.cpp.

1738  : wxWindow( parent, id, pos, size, flag, wxT( "mathplot" ) )
1739 {
1740  m_zooming = false;
1741  m_scaleX = m_scaleY = 1.0;
1742  m_posX = m_posY = 0;
1745  m_scrX = m_scrY = 64; // Fixed from m_scrX = m_scrX = 64;
1746  m_minX = m_minY = 0;
1747  m_maxX = m_maxY = 0;
1748  m_last_lx = m_last_ly = 0;
1749  m_buff_bmp = NULL;
1750  m_enableDoubleBuffer = false;
1751  m_enableMouseNavigation = true;
1752  m_enableLimitedView = false;
1754  // Set margins to 0
1756 
1757 
1758  m_lockaspect = false;
1759 
1760  m_popmenu.Append( mpID_CENTER, _( "Center" ), _( "Center plot view to this position" ) );
1761  m_popmenu.Append( mpID_FIT, _( "Fit on Screen" ), _( "Set plot view to show all items" ) );
1762  m_popmenu.Append( mpID_ZOOM_IN, _( "Zoom In" ), _( "Zoom in plot view." ) );
1763  m_popmenu.Append( mpID_ZOOM_OUT, _( "Zoom Out" ), _( "Zoom out plot view." ) );
1764  // m_popmenu.AppendCheckItem( mpID_LOCKASPECT, _("Lock aspect"), _("Lock horizontal and vertical zoom aspect."));
1765  // m_popmenu.Append( mpID_HELP_MOUSE, _("Show mouse commands..."), _("Show help about the mouse commands."));
1766 
1767  m_layers.clear();
1768  SetBackgroundColour( *wxWHITE );
1769  m_bgColour = *wxWHITE;
1770  m_fgColour = *wxBLACK;
1771 
1772  m_enableScrollBars = false;
1773  SetSizeHints( 128, 128 );
1774 
1775  // J.L.Blanco: Eliminates the "flick" with the double buffer.
1776  SetBackgroundStyle( wxBG_STYLE_CUSTOM );
1777 
1778  UpdateAll();
1779 }
int m_marginRight
Definition: mathplot.h:1523
bool m_enableScrollBars
Definition: mathplot.h:1534
bool m_zooming
Definition: mathplot.h:1537
int m_marginLeft
Definition: mathplot.h:1523
double m_desiredXmax
Definition: mathplot.h:1521
double m_scaleY
Definition: mathplot.h:1510
bool m_enableMouseNavigation
Definition: mathplot.h:1529
double m_posX
Definition: mathplot.h:1511
double m_minY
Definition: mathplot.h:1507
double m_scaleX
Definition: mathplot.h:1509
wxLayerList m_layers
Definition: mathplot.h:1497
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2748
#define NULL
double m_desiredYmax
Definition: mathplot.h:1521
bool m_lockaspect
Definition: mathplot.h:1499
double m_desiredXmin
These are updated in Fit() only, and may be different from the real borders (layer coordinates) only ...
Definition: mathplot.h:1521
mpInfoLayer * m_movingInfoLayer
Definition: mathplot.h:1536
wxColour m_fgColour
Definition: mathplot.h:1502
int m_last_ly
Definition: mathplot.h:1525
double m_posY
Definition: mathplot.h:1512
int m_marginTop
Definition: mathplot.h:1523
double m_minX
Definition: mathplot.h:1505
double m_desiredYmin
Definition: mathplot.h:1521
#define _(s)
Definition: 3d_actions.cpp:33
int m_marginBottom
Definition: mathplot.h:1523
int m_last_lx
Definition: mathplot.h:1525
int m_scrY
Definition: mathplot.h:1514
bool m_enableLimitedView
Definition: mathplot.h:1531
wxMenu m_popmenu
Definition: mathplot.h:1498
double m_maxX
Definition: mathplot.h:1506
wxColour m_bgColour
Definition: mathplot.h:1501
bool m_enableDoubleBuffer
Definition: mathplot.h:1528
int m_scrX
Definition: mathplot.h:1513
wxBitmap * m_buff_bmp
Definition: mathplot.h:1527
double m_maxY
Definition: mathplot.h:1508

References _, m_bgColour, m_buff_bmp, m_desiredXmax, m_desiredXmin, m_desiredYmax, m_desiredYmin, m_enableDoubleBuffer, m_enableLimitedView, m_enableMouseNavigation, m_enableScrollBars, m_fgColour, m_last_lx, m_last_ly, m_layers, m_lockaspect, m_marginBottom, m_marginLeft, m_marginRight, m_marginTop, m_maxX, m_maxY, m_minX, m_minY, m_movingInfoLayer, m_popmenu, m_posX, m_posY, m_scaleX, m_scaleY, m_scrX, m_scrY, m_zooming, mpID_CENTER, mpID_FIT, mpID_ZOOM_IN, mpID_ZOOM_OUT, NULL, and UpdateAll().

◆ ~mpWindow()

mpWindow::~mpWindow ( )

Definition at line 1782 of file mathplot.cpp.

1783 {
1784  // Free all the layers:
1785  DelAllLayers( true, false );
1786 
1787  if( m_buff_bmp )
1788  {
1789  delete m_buff_bmp;
1790  m_buff_bmp = NULL;
1791  }
1792 }
#define NULL
void DelAllLayers(bool alsoDeleteObject, bool refreshDisplay=true)
Remove all layers from the plot.
Definition: mathplot.cpp:2468
wxBitmap * m_buff_bmp
Definition: mathplot.h:1527

References DelAllLayers(), m_buff_bmp, and NULL.

Member Function Documentation

◆ AddLayer()

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

Add a plot layer to the canvas.

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

Definition at line 2424 of file mathplot.cpp.

2425 {
2426  if( layer != NULL )
2427  {
2428  m_layers.push_back( layer );
2429 
2430  if( refreshDisplay )
2431  UpdateAll();
2432 
2433  return true;
2434  }
2435 
2436  ;
2437  return false;
2438 }
wxLayerList m_layers
Definition: mathplot.h:1497
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2748
#define NULL

References m_layers, NULL, and UpdateAll().

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

◆ AdjustLimitedView()

void mpWindow::AdjustLimitedView ( )
protected

Definition at line 2143 of file mathplot.cpp.

2144 {
2145  if( !m_enableLimitedView )
2146  return;
2147 
2148  // m_min and m_max are plot limits for curves
2149  // xMin, xMax, yMin, yMax are the full limits (plot limit + margin)
2150  const double xMin = m_minX - m_marginLeft / m_scaleX;
2151  const double xMax = m_maxX + m_marginRight / m_scaleX;
2152  const double yMin = m_minY - m_marginTop / m_scaleY;
2153  const double yMax = m_maxY + m_marginBottom / m_scaleY;
2154 
2155  if( m_desiredXmin < xMin )
2156  {
2157  double diff = xMin - m_desiredXmin;
2158  m_posX += diff;
2159  m_desiredXmax += diff;
2160  m_desiredXmin = xMin;
2161  }
2162 
2163  if( m_desiredXmax > xMax )
2164  {
2165  double diff = m_desiredXmax - xMax;
2166  m_posX -= diff;
2167  m_desiredXmin -= diff;
2168  m_desiredXmax = xMax;
2169  }
2170 
2171  if( m_desiredYmin < yMin )
2172  {
2173  double diff = yMin - m_desiredYmin;
2174  m_posY += diff;
2175  m_desiredYmax += diff;
2176  m_desiredYmin = yMin;
2177  }
2178 
2179  if( m_desiredYmax > yMax )
2180  {
2181  double diff = m_desiredYmax - yMax;
2182  m_posY -= diff;
2183  m_desiredYmin -= diff;
2184  m_desiredYmax = yMax;
2185  }
2186 }
int m_marginRight
Definition: mathplot.h:1523
int m_marginLeft
Definition: mathplot.h:1523
double m_desiredXmax
Definition: mathplot.h:1521
double m_scaleY
Definition: mathplot.h:1510
double m_posX
Definition: mathplot.h:1511
double m_minY
Definition: mathplot.h:1507
double m_scaleX
Definition: mathplot.h:1509
double m_desiredYmax
Definition: mathplot.h:1521
double m_desiredXmin
These are updated in Fit() only, and may be different from the real borders (layer coordinates) only ...
Definition: mathplot.h:1521
double m_posY
Definition: mathplot.h:1512
int m_marginTop
Definition: mathplot.h:1523
double m_minX
Definition: mathplot.h:1505
double m_desiredYmin
Definition: mathplot.h:1521
int m_marginBottom
Definition: mathplot.h:1523
bool m_enableLimitedView
Definition: mathplot.h:1531
double m_maxX
Definition: mathplot.h:1506
double m_maxY
Definition: mathplot.h:1508

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

◆ CheckXLimits()

bool mpWindow::CheckXLimits ( double &  desiredMax,
double &  desiredMin 
) const
inlineprotected

Definition at line 1465 of file mathplot.h.

1466  {
1467  return !( m_enableLimitedView
1468  && (desiredMax > m_maxX - m_marginRight / m_scaleX
1469  || desiredMin < m_minX - m_marginLeft / m_scaleX) );
1470  }
int m_marginRight
Definition: mathplot.h:1523
int m_marginLeft
Definition: mathplot.h:1523
double m_scaleX
Definition: mathplot.h:1509
double m_minX
Definition: mathplot.h:1505
bool m_enableLimitedView
Definition: mathplot.h:1531
double m_maxX
Definition: mathplot.h:1506

Referenced by ZoomOut().

◆ CheckYLimits()

bool mpWindow::CheckYLimits ( double &  desiredMax,
double &  desiredMin 
) const
inlineprotected

Definition at line 1472 of file mathplot.h.

1473  {
1474  return !( m_enableLimitedView
1475  && (desiredMax > m_maxY + m_marginBottom / m_scaleY
1476  || desiredMin < m_minY + m_marginTop / m_scaleY) );
1477  }
double m_scaleY
Definition: mathplot.h:1510
double m_minY
Definition: mathplot.h:1507
int m_marginTop
Definition: mathplot.h:1523
int m_marginBottom
Definition: mathplot.h:1523
bool m_enableLimitedView
Definition: mathplot.h:1531
double m_maxY
Definition: mathplot.h:1508

Referenced by ZoomOut().

◆ CountAllLayers()

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

1290 { return m_layers.size(); };
wxLayerList m_layers
Definition: mathplot.h:1497

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

◆ CountLayers()

unsigned int mpWindow::CountLayers ( )

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

Returns
The number of profiles plotted.

Definition at line 2931 of file mathplot.cpp.

2932 {
2933  // wxNode *node = m_layers.GetFirst();
2934  unsigned int layerNo = 0;
2935 
2936  for( wxLayerList::iterator li = m_layers.begin(); li != m_layers.end(); li++ ) // while(node)
2937  {
2938  if( (*li)->HasBBox() )
2939  layerNo++;
2940 
2941  // node = node->GetNext();
2942  }
2943 
2944  ;
2945  return layerNo;
2946 }
wxLayerList m_layers
Definition: mathplot.h:1497

References m_layers.

◆ DelAllLayers()

void mpWindow::DelAllLayers ( bool  alsoDeleteObject,
bool  refreshDisplay = true 
)

Remove all layers from the plot.

Parameters
alsoDeleteObjectIf set to true, the mpLayer objects will be also "deleted", not just removed from the internal list.
refreshDisplayStates whether to refresh the display (UpdateAll) after removing the layers.

Definition at line 2468 of file mathplot.cpp.

2469 {
2470  while( m_layers.size()>0 )
2471  {
2472  // Also delete the object?
2473  if( alsoDeleteObject )
2474  delete m_layers[0];
2475 
2476  m_layers.erase( m_layers.begin() ); // this deleted the reference only
2477  }
2478 
2479  if( refreshDisplay )
2480  UpdateAll();
2481 }
wxLayerList m_layers
Definition: mathplot.h:1497
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2748

References m_layers, and UpdateAll().

Referenced by ~mpWindow().

◆ DelLayer()

bool mpWindow::DelLayer ( mpLayer layer,
bool  alsoDeleteObject = false,
bool  refreshDisplay = true 
)

Remove a plot layer from the canvas.

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

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

Definition at line 2441 of file mathplot.cpp.

2444 {
2445  wxLayerList::iterator layIt;
2446 
2447  for( layIt = m_layers.begin(); layIt != m_layers.end(); layIt++ )
2448  {
2449  if( *layIt == layer )
2450  {
2451  // Also delete the object?
2452  if( alsoDeleteObject )
2453  delete *layIt;
2454 
2455  m_layers.erase( layIt ); // this deleted the reference only
2456 
2457  if( refreshDisplay )
2458  UpdateAll();
2459 
2460  return true;
2461  }
2462  }
2463 
2464  return false;
2465 }
wxLayerList m_layers
Definition: mathplot.h:1497
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2748

References m_layers, and UpdateAll().

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

◆ DoScrollCalc()

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

Definition at line 2795 of file mathplot.cpp.

2796 {
2797  if( orientation == wxVERTICAL )
2798  {
2799  // Y axis
2800  // Get top margin in coord units
2801  double topMargin = m_marginTop / m_scaleY;
2802  // Calculate maximum Y coord to be shown in the graph
2803  double maxY = m_desiredYmax > m_maxY ? m_desiredYmax : m_maxY;
2804  // Set new position
2805  SetPosY( ( maxY - (position / m_scaleY) ) + topMargin );
2806  }
2807  else
2808  {
2809  // X Axis
2810  // Get left margin in coord units
2811  double leftMargin = m_marginLeft / m_scaleX;
2812  // Calculate minimum X coord to be shown in the graph
2813  double minX = (m_desiredXmin < m_minX) ? m_desiredXmin : m_minX;
2814  // Set new position
2815  SetPosX( ( minX + (position / m_scaleX) ) - leftMargin );
2816  }
2817 }
int m_marginLeft
Definition: mathplot.h:1523
double m_scaleY
Definition: mathplot.h:1510
double m_scaleX
Definition: mathplot.h:1509
void SetPosX(double posX)
Set current view's X position and refresh display.
Definition: mathplot.h:1166
void SetPosY(double posY)
Set current view's Y position and refresh display.
Definition: mathplot.h:1171
double m_desiredYmax
Definition: mathplot.h:1521
double m_desiredXmin
These are updated in Fit() only, and may be different from the real borders (layer coordinates) only ...
Definition: mathplot.h:1521
int m_marginTop
Definition: mathplot.h:1523
double m_minX
Definition: mathplot.h:1505
double m_maxY
Definition: mathplot.h:1508

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

◆ DoZoomInXCalc()

void mpWindow::DoZoomInXCalc ( const int  staticXpixel)
protected

Definition at line 2083 of file mathplot.cpp.

2084 {
2085  // Preserve the position of the clicked point:
2086  double staticX = p2x( staticXpixel );
2087 
2088  // Zoom in:
2090  // Adjust the new m_posx
2091  m_posX = staticX - (staticXpixel / m_scaleX);
2092  // Adjust desired
2095 }
int m_marginRight
Definition: mathplot.h:1523
int m_marginLeft
Definition: mathplot.h:1523
double p2x(wxCoord pixelCoordX)
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates,...
Definition: mathplot.h:1189
double m_desiredXmax
Definition: mathplot.h:1521
double m_posX
Definition: mathplot.h:1511
double m_scaleX
Definition: mathplot.h:1509
double m_desiredXmin
These are updated in Fit() only, and may be different from the real borders (layer coordinates) only ...
Definition: mathplot.h:1521
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:1348
int m_scrX
Definition: mathplot.h:1513

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

◆ DoZoomInYCalc()

void mpWindow::DoZoomInYCalc ( const int  staticYpixel)
protected

Definition at line 2098 of file mathplot.cpp.

2099 {
2100  // Preserve the position of the clicked point:
2101  double staticY = p2y( staticYpixel );
2102 
2103  // Zoom in:
2105  // Adjust the new m_posy:
2106  m_posY = staticY + (staticYpixel / m_scaleY);
2107  // Adjust desired
2110 }
double m_scaleY
Definition: mathplot.h:1510
double p2y(wxCoord pixelCoordY)
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates,...
Definition: mathplot.h:1194
double m_desiredYmax
Definition: mathplot.h:1521
double m_posY
Definition: mathplot.h:1512
int m_marginTop
Definition: mathplot.h:1523
double m_desiredYmin
Definition: mathplot.h:1521
int m_marginBottom
Definition: mathplot.h:1523
int m_scrY
Definition: mathplot.h:1514
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:1348

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

◆ DoZoomOutXCalc()

void mpWindow::DoZoomOutXCalc ( const int  staticXpixel)
protected

Definition at line 2113 of file mathplot.cpp.

2114 {
2115  // Preserve the position of the clicked point:
2116  double staticX = p2x( staticXpixel );
2117 
2118  // Zoom out:
2120  // Adjust the new m_posx/y:
2121  m_posX = staticX - (staticXpixel / m_scaleX);
2122  // Adjust desired
2125 }
int m_marginRight
Definition: mathplot.h:1523
int m_marginLeft
Definition: mathplot.h:1523
double p2x(wxCoord pixelCoordX)
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates,...
Definition: mathplot.h:1189
double m_desiredXmax
Definition: mathplot.h:1521
double m_posX
Definition: mathplot.h:1511
double m_scaleX
Definition: mathplot.h:1509
double m_desiredXmin
These are updated in Fit() only, and may be different from the real borders (layer coordinates) only ...
Definition: mathplot.h:1521
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:1348
int m_scrX
Definition: mathplot.h:1513

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

◆ DoZoomOutYCalc()

void mpWindow::DoZoomOutYCalc ( const int  staticYpixel)
protected

Definition at line 2128 of file mathplot.cpp.

2129 {
2130  // Preserve the position of the clicked point:
2131  double staticY = p2y( staticYpixel );
2132 
2133  // Zoom out:
2135  // Adjust the new m_posx/y:
2136  m_posY = staticY + (staticYpixel / m_scaleY);
2137  // Adjust desired
2140 }
double m_scaleY
Definition: mathplot.h:1510
double p2y(wxCoord pixelCoordY)
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates,...
Definition: mathplot.h:1194
double m_desiredYmax
Definition: mathplot.h:1521
double m_posY
Definition: mathplot.h:1512
int m_marginTop
Definition: mathplot.h:1523
double m_desiredYmin
Definition: mathplot.h:1521
int m_marginBottom
Definition: mathplot.h:1523
int m_scrY
Definition: mathplot.h:1514
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:1348

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

◆ EnableDoubleBuffer()

void mpWindow::EnableDoubleBuffer ( bool  enabled)
inline

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

Definition at line 1209 of file mathplot.h.

1209 { m_enableDoubleBuffer = enabled; }
bool m_enableDoubleBuffer
Definition: mathplot.h:1528

Referenced by SIM_PLOT_PANEL::SIM_PLOT_PANEL().

◆ EnableMousePanZoom()

void mpWindow::EnableMousePanZoom ( bool  enabled)
inline

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

Definition at line 1213 of file mathplot.h.

1213 { m_enableMouseNavigation = enabled; }
bool m_enableMouseNavigation
Definition: mathplot.h:1529

◆ EnableMouseWheelPan()

void mpWindow::EnableMouseWheelPan ( bool  enabled)
inline

Enable/disable trackpad friendly panning (2-axis scroll wheel)

Definition at line 1217 of file mathplot.h.

1217 { m_enableMouseWheelPan = enabled; }
bool m_enableMouseWheelPan
Definition: mathplot.h:1530

Referenced by SIM_PLOT_FRAME::NewPlotPanel().

◆ Fit() [1/2]

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 2012 of file mathplot.cpp.

2013 {
2014  if( UpdateBBox() )
2015  Fit( m_minX, m_maxX, m_minY, m_maxY );
2016 }
double m_minY
Definition: mathplot.h:1507
void Fit() override
Set view to fit global bounding box of all plot layers and refresh display.
Definition: mathplot.cpp:2012
double m_minX
Definition: mathplot.h:1505
virtual bool UpdateBBox()
Recalculate global layer bounding box, and save it in m_minX,...
Definition: mathplot.cpp:2649
double m_maxX
Definition: mathplot.h:1506
double m_maxY
Definition: mathplot.h:1508

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

◆ Fit() [2/2]

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

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

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

Definition at line 2020 of file mathplot.cpp.

2022 {
2023  // Save desired borders:
2024  m_desiredXmin = xMin; m_desiredXmax = xMax;
2025  m_desiredYmin = yMin; m_desiredYmax = yMax;
2026 
2027  // Give a small margin to plot area
2028  double xExtra = fabs( xMax - xMin ) * 0.00;
2029  double yExtra = fabs( yMax - yMin ) * 0.03;
2030 
2031  xMin -= xExtra;
2032  xMax += xExtra;
2033  yMin -= yExtra;
2034  yMax += yExtra;
2035 
2036  if( printSizeX!=NULL && printSizeY!=NULL )
2037  {
2038  // Printer:
2039  m_scrX = *printSizeX;
2040  m_scrY = *printSizeY;
2041  }
2042  else
2043  {
2044  // Normal case (screen):
2045  GetClientSize( &m_scrX, &m_scrY );
2046  }
2047 
2048  double Ax, Ay;
2049 
2050  Ax = xMax - xMin;
2051  Ay = yMax - yMin;
2052 
2053  m_scaleX = (Ax!=0) ? (m_scrX - m_marginLeft - m_marginRight) / Ax : 1; // m_scaleX = (Ax!=0) ? m_scrX/Ax : 1;
2054  m_scaleY = (Ay!=0) ? (m_scrY - m_marginTop - m_marginBottom) / Ay : 1; // m_scaleY = (Ay!=0) ? m_scrY/Ay : 1;
2055 
2056  if( m_lockaspect )
2057  {
2058  // Keep the lowest "scale" to fit the whole range required by that axis (to actually
2059  // "fit"!):
2060  double s = m_scaleX < m_scaleY ? m_scaleX : m_scaleY;
2061  m_scaleX = s;
2062  m_scaleY = s;
2063  }
2064 
2065  // Adjusts corner coordinates: This should be simply:
2066  // m_posX = m_minX;
2067  // m_posY = m_maxY;
2068  // But account for centering if we have lock aspect:
2069  m_posX = (xMin + xMax) / 2 - ( (m_scrX - m_marginLeft - m_marginRight) / 2 + m_marginLeft ) /
2070  m_scaleX; // m_posX = (xMin+xMax)/2 - (m_scrX/2)/m_scaleX;
2071  // 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;
2072  m_posY = (yMin + yMax) / 2 + ( (m_scrY - m_marginTop - m_marginBottom) / 2 + m_marginTop ) /
2073  m_scaleY; // m_posY = (yMin+yMax)/2 + (m_scrY/2)/m_scaleY;
2074 
2075  // It is VERY IMPORTANT to DO NOT call Refresh if we are drawing to the printer!!
2076  // Otherwise, the DC dimensions will be those of the window instead of the printer device
2077  if( printSizeX==NULL || printSizeY==NULL )
2078  UpdateAll();
2079 }
int m_marginRight
Definition: mathplot.h:1523
int m_marginLeft
Definition: mathplot.h:1523
double m_desiredXmax
Definition: mathplot.h:1521
double m_scaleY
Definition: mathplot.h:1510
double m_posX
Definition: mathplot.h:1511
double m_scaleX
Definition: mathplot.h:1509
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2748
#define NULL
double m_desiredYmax
Definition: mathplot.h:1521
bool m_lockaspect
Definition: mathplot.h:1499
double m_desiredXmin
These are updated in Fit() only, and may be different from the real borders (layer coordinates) only ...
Definition: mathplot.h:1521
double m_posY
Definition: mathplot.h:1512
int m_marginTop
Definition: mathplot.h:1523
double m_desiredYmin
Definition: mathplot.h:1521
int m_marginBottom
Definition: mathplot.h:1523
int m_scrY
Definition: mathplot.h:1514
int m_scrX
Definition: mathplot.h:1513

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, NULL, and UpdateAll().

◆ GetAxesColour()

const wxColour& mpWindow::GetAxesColour ( )
inline

Get axes draw colour.

Returns
reference to axis colour used in theme

Definition at line 1423 of file mathplot.h.

1423 { return m_axColour; };
wxColour m_axColour
Definition: mathplot.h:1503

Referenced by mpPrintout::OnPrintPage().

◆ GetBoundingBox()

void mpWindow::GetBoundingBox ( double *  bbox)

Returns the bounding box coordinates.

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

Definition at line 2969 of file mathplot.cpp.

2970 {
2971  bbox[0] = m_minX;
2972  bbox[1] = m_maxX;
2973  bbox[2] = m_minY;
2974  bbox[3] = m_maxY;
2975 }
double m_minY
Definition: mathplot.h:1507
double m_minX
Definition: mathplot.h:1505
double m_maxX
Definition: mathplot.h:1506
double m_maxY
Definition: mathplot.h:1508

References m_maxX, m_maxY, m_minX, and m_minY.

◆ GetDesiredXmax()

double mpWindow::GetDesiredXmax ( )
inline

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

See also
Fit

Definition at line 1309 of file mathplot.h.

1309 { return m_desiredXmax; }
double m_desiredXmax
Definition: mathplot.h:1521

Referenced by mpPrintout::OnPrintPage().

◆ GetDesiredXmin()

double mpWindow::GetDesiredXmin ( )
inline

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

See also
Fit

Definition at line 1303 of file mathplot.h.

1303 { 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:1521

Referenced by mpPrintout::OnPrintPage().

◆ GetDesiredYmax()

double mpWindow::GetDesiredYmax ( )
inline

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

See also
Fit

Definition at line 1321 of file mathplot.h.

1321 { return m_desiredYmax; }
double m_desiredYmax
Definition: mathplot.h:1521

Referenced by mpPrintout::OnPrintPage().

◆ GetDesiredYmin()

double mpWindow::GetDesiredYmin ( )
inline

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

See also
Fit

Definition at line 1315 of file mathplot.h.

1315 { return m_desiredYmin; }
double m_desiredYmin
Definition: mathplot.h:1521

Referenced by mpPrintout::OnPrintPage().

◆ GetLayer()

mpLayer * mpWindow::GetLayer ( int  position)

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

Parameters
positionposition of the layer in the layers list
Returns
pointer to mpLayer

Definition at line 2949 of file mathplot.cpp.

2950 {
2951  if( ( position >= (int) m_layers.size() ) || position < 0 )
2952  return NULL;
2953 
2954  return m_layers[position];
2955 }
wxLayerList m_layers
Definition: mathplot.h:1497
#define NULL

References m_layers, and NULL.

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

◆ GetLayerByName()

mpLayer * mpWindow::GetLayerByName ( const wxString &  name)

Get the layer by its name (case sensitive).

Parameters
nameThe name of the layer to retrieve
Returns
A pointer to the mpLayer object, or NULL if not found.

Definition at line 2958 of file mathplot.cpp.

2959 {
2960  for( wxLayerList::iterator it = m_layers.begin(); it!=m_layers.end(); it++ )
2961  if( !(*it)->GetName().Cmp( name ) )
2962  return *it;
2963 
2964 
2965  return NULL; // Not found
2966 }
wxLayerList m_layers
Definition: mathplot.h:1497
#define NULL
const char * name
Definition: DXF_plotter.cpp:59

References m_layers, name, and NULL.

Referenced by IsLayerVisible(), and SetLayerVisible().

◆ GetMarginBottom()

int mpWindow::GetMarginBottom ( )
inline

◆ GetMarginLeft()

int mpWindow::GetMarginLeft ( )
inline

◆ GetMarginRight()

int mpWindow::GetMarginRight ( )
inline

◆ GetMarginTop()

int mpWindow::GetMarginTop ( )
inline

◆ GetMPScrollbars()

bool mpWindow::GetMPScrollbars ( )
inline

Get scrollbars status.

Returns
true if scrollbars are visible

Definition at line 1334 of file mathplot.h.

1334 { return m_enableScrollBars; };
bool m_enableScrollBars
Definition: mathplot.h:1534

◆ GetPopupMenu()

wxMenu* mpWindow::GetPopupMenu ( )
inline

Get reference to context menu of the plot canvas.

Returns
Pointer to menu. The menu can be modified.

Definition at line 1060 of file mathplot.h.

1060 { return &m_popmenu; }
wxMenu m_popmenu
Definition: mathplot.h:1498

◆ GetPosX()

double mpWindow::GetPosX ( void  ) const
inline

Definition at line 1120 of file mathplot.h.

1120 { return m_posX; }
double m_posX
Definition: mathplot.h:1511

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

◆ GetPosY()

double mpWindow::GetPosY ( void  ) const
inline

Definition at line 1127 of file mathplot.h.

1127 { return m_posY; }
double m_posY
Definition: mathplot.h:1512

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

◆ GetScaleX()

double mpWindow::GetScaleX ( void  ) const
inline

Definition at line 1106 of file mathplot.h.

1106 { return m_scaleX; }; // Schaling's method: maybe another method esists with the same name
double m_scaleX
Definition: mathplot.h:1509

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

◆ GetScaleY()

double mpWindow::GetScaleY ( void  ) const
inline

Definition at line 1113 of file mathplot.h.

1113 { return m_scaleY; } // Schaling's method: maybe another method exists with the same name
double m_scaleY
Definition: mathplot.h:1510

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

◆ GetScrX()

int mpWindow::GetScrX ( void  ) const
inline

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

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

Returns
X dimension.

Definition at line 1135 of file mathplot.h.

1135 { return m_scrX; }
int m_scrX
Definition: mathplot.h:1513

Referenced by mpScaleXBase::getVisibleDataRange(), 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().

◆ GetScrY()

int mpWindow::GetScrY ( void  ) const
inline

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

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

Returns
Y dimension.

Definition at line 1144 of file mathplot.h.

1144 { return m_scrY; }
int m_scrY
Definition: mathplot.h:1514

Referenced by mpScaleY::getVisibleDataRange(), 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().

◆ GetXpos()

double mpWindow::GetXpos ( ) const
inline

Get current view's X position.

See rules for coordinate transformation

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

Definition at line 1119 of file mathplot.h.

1119 { return m_posX; }
double m_posX
Definition: mathplot.h:1511

◆ GetXscl()

double mpWindow::GetXscl ( )
inline

Get current view's X scale.

See rules for coordinate transformation

Returns
Scale

Definition at line 1105 of file mathplot.h.

1105 { return m_scaleX; }
double m_scaleX
Definition: mathplot.h:1509

◆ GetXScreen()

int mpWindow::GetXScreen ( void  ) const
inline

Definition at line 1136 of file mathplot.h.

1136 { return m_scrX; }
int m_scrX
Definition: mathplot.h:1513

Referenced by SIM_PLOT_PANEL::EnableCursor().

◆ GetYpos()

double mpWindow::GetYpos ( ) const
inline

Get current view's Y position.

See rules for coordinate transformation

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

Definition at line 1126 of file mathplot.h.

1126 { return m_posY; }
double m_posY
Definition: mathplot.h:1512

◆ GetYscl()

double mpWindow::GetYscl ( ) const
inline

Get current view's Y scale.

See rules for coordinate transformation

Returns
Scale

Definition at line 1112 of file mathplot.h.

1112 { return m_scaleY; }
double m_scaleY
Definition: mathplot.h:1510

◆ GetYScreen()

int mpWindow::GetYScreen ( void  ) const
inline

Definition at line 1145 of file mathplot.h.

1145 { return m_scrY; }
int m_scrY
Definition: mathplot.h:1514

◆ IsAspectLocked()

bool mpWindow::IsAspectLocked ( )
inline

Checks whether the X/Y scale aspect is locked.

Return values
TRUELocked
FALSEUnlocked

Definition at line 1230 of file mathplot.h.

1230 { return m_lockaspect; }
bool m_lockaspect
Definition: mathplot.h:1499

◆ IsInsideInfoLayer()

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 3045 of file mathplot.cpp.

3046 {
3047  wxLayerList::iterator li;
3048 
3049  for( li = m_layers.begin(); li != m_layers.end(); li++ )
3050  {
3051  if( (*li)->IsInfo() )
3052  {
3053  mpInfoLayer* tmpLyr = (mpInfoLayer*) (*li);
3054 
3055  if( tmpLyr->Inside( point ) )
3056  {
3057  return tmpLyr;
3058  }
3059  }
3060  }
3061 
3062  return NULL;
3063 }
virtual bool Inside(wxPoint &point)
Checks whether a point is inside the info box rectangle.
Definition: mathplot.cpp:135
wxLayerList m_layers
Definition: mathplot.h:1497
#define NULL
Base class to create small rectangular info boxes mpInfoLayer is the base class to create a small rec...
Definition: mathplot.h:336

References mpInfoLayer::Inside(), m_layers, and NULL.

Referenced by OnMouseLeftDown().

◆ IsLayerVisible() [1/2]

bool mpWindow::IsLayerVisible ( const wxString &  name)

Check whether a layer with given name is visible.

Parameters
nameThe layer name
Returns
layer visibility status

Definition at line 3078 of file mathplot.cpp.

3079 {
3080  mpLayer* lx = GetLayerByName( name );
3081 
3082  return (lx) ? lx->IsVisible() : false;
3083 }
bool IsVisible()
Checks whether the layer is visible or not.
Definition: mathplot.h:299
mpLayer * GetLayerByName(const wxString &name)
Definition: mathplot.cpp:2958
const char * name
Definition: DXF_plotter.cpp:59

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

◆ IsLayerVisible() [2/2]

bool mpWindow::IsLayerVisible ( const unsigned int  position)

Check whether the layer at given position is visible.

Parameters
positionThe layer position in layer list
Returns
layer visibility status

Definition at line 3098 of file mathplot.cpp.

3099 {
3100  mpLayer* lx = GetLayer( position );
3101 
3102  return (lx) ? lx->IsVisible() : false;
3103 }
mpLayer * GetLayer(int position)
Definition: mathplot.cpp:2949
bool IsVisible()
Checks whether the layer is visible or not.
Definition: mathplot.h:299

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

◆ LimitView()

void mpWindow::LimitView ( bool  aEnable)
inline

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

Definition at line 1426 of file mathplot.h.

1427  {
1428  m_enableLimitedView = aEnable;
1429  }
bool m_enableLimitedView
Definition: mathplot.h:1531

Referenced by SIM_PLOT_PANEL::SIM_PLOT_PANEL().

◆ LockAspect()

void mpWindow::LockAspect ( bool  enable = TRUE)

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

Note
Explicit calls to mpWindow::SetScaleX and mpWindow::SetScaleY will set an unlocked aspect, but any other action changing the view scale will lock the aspect again.

Definition at line 2365 of file mathplot.cpp.

2366 {
2367  m_lockaspect = enable;
2368  m_popmenu.Check( mpID_LOCKASPECT, enable );
2369 
2370  // Try to fit again with the new config:
2372 }
double m_desiredXmax
Definition: mathplot.h:1521
double m_desiredYmax
Definition: mathplot.h:1521
bool m_lockaspect
Definition: mathplot.h:1499
double m_desiredXmin
These are updated in Fit() only, and may be different from the real borders (layer coordinates) only ...
Definition: mathplot.h:1521
void Fit() override
Set view to fit global bounding box of all plot layers and refresh display.
Definition: mathplot.cpp:2012
double m_desiredYmin
Definition: mathplot.h:1521
wxMenu m_popmenu
Definition: mathplot.h:1498

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

Referenced by OnLockAspect().

◆ OnCenter()

void mpWindow::OnCenter ( wxCommandEvent &  event)
protected

Definition at line 2395 of file mathplot.cpp.

2396 {
2397  GetClientSize( &m_scrX, &m_scrY );
2398  int centerX = (m_scrX - m_marginLeft - m_marginRight) / 2; // + m_marginLeft; // c.x = m_scrX/2;
2399  int centerY = (m_scrY - m_marginTop - m_marginBottom) / 2; // - m_marginTop; // c.y = m_scrY/2;
2400  SetPos( p2x( m_clickedX - centerX ), p2y( m_clickedY - centerY ) );
2401  // 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);
2402 }
int m_marginRight
Definition: mathplot.h:1523
int m_marginLeft
Definition: mathplot.h:1523
int m_clickedX
Definition: mathplot.h:1515
double p2x(wxCoord pixelCoordX)
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates,...
Definition: mathplot.h:1189
double p2y(wxCoord pixelCoordY)
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates,...
Definition: mathplot.h:1194
int m_marginTop
Definition: mathplot.h:1523
void SetPos(double posX, double posY)
Set current view's X and Y position and refresh display.
Definition: mathplot.h:1177
int m_clickedY
Definition: mathplot.h:1516
int m_marginBottom
Definition: mathplot.h:1523
int m_scrY
Definition: mathplot.h:1514
int m_scrX
Definition: mathplot.h:1513

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

◆ OnFit()

void mpWindow::OnFit ( wxCommandEvent &  event)
protected

Definition at line 2389 of file mathplot.cpp.

2390 {
2391  Fit();
2392 }
void Fit() override
Set view to fit global bounding box of all plot layers and refresh display.
Definition: mathplot.cpp:2012

References Fit().

◆ OnLockAspect()

void mpWindow::OnLockAspect ( wxCommandEvent &  event)
protected

Definition at line 2383 of file mathplot.cpp.

2384 {
2386 }
bool m_lockaspect
Definition: mathplot.h:1499
void LockAspect(bool enable=TRUE)
Enable or disable X/Y scale aspect locking for the view.
Definition: mathplot.cpp:2365

References LockAspect(), and m_lockaspect.

◆ OnMagnify()

void mpWindow::OnMagnify ( wxMouseEvent &  event)
protected

◆ OnMouseLeftDown()

void mpWindow::OnMouseLeftDown ( wxMouseEvent &  event)
protected

Definition at line 1970 of file mathplot.cpp.

1971 {
1972  m_mouseLClick.x = event.GetX();
1973  m_mouseLClick.y = event.GetY();
1974  m_zooming = true;
1975  wxPoint pointClicked = event.GetPosition();
1976  m_movingInfoLayer = IsInsideInfoLayer( pointClicked );
1977 
1978  event.Skip();
1979 }
bool m_zooming
Definition: mathplot.h:1537
mpInfoLayer * IsInsideInfoLayer(wxPoint &point)
Check if a given point is inside the area of a mpInfoLayer and eventually returns its pointer.
Definition: mathplot.cpp:3045
wxPoint m_mouseLClick
Definition: mathplot.h:1533
mpInfoLayer * m_movingInfoLayer
Definition: mathplot.h:1536

References IsInsideInfoLayer(), m_mouseLClick, m_movingInfoLayer, and m_zooming.

◆ OnMouseLeftRelease()

void mpWindow::OnMouseLeftRelease ( wxMouseEvent &  event)
protected

Definition at line 1982 of file mathplot.cpp.

1983 {
1984  wxPoint release( event.GetX(), event.GetY() );
1985  wxPoint press( m_mouseLClick.x, m_mouseLClick.y );
1986 
1987  m_zooming = false;
1988 
1989  if( m_movingInfoLayer != NULL )
1990  {
1993  }
1994  else
1995  {
1996  if( release != press )
1997  {
1998  ZoomRect( press, release );
1999  } /*else {
2000  * if (m_coordTooltip) {
2001  * wxString toolTipContent;
2002  * toolTipContent.Printf( "X = %f\nY = %f", p2x(event.GetX()), p2y(event.GetY()));
2003  * SetToolTip(toolTipContent);
2004  * }
2005  * } */
2006  }
2007 
2008  event.Skip();
2009 }
bool m_zooming
Definition: mathplot.h:1537
wxPoint m_mouseLClick
Definition: mathplot.h:1533
#define NULL
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:2346
mpInfoLayer * m_movingInfoLayer
Definition: mathplot.h:1536
virtual void UpdateReference()
Updates the rectangle reference point.
Definition: mathplot.cpp:148

References m_mouseLClick, m_movingInfoLayer, m_zooming, NULL, mpInfoLayer::UpdateReference(), and ZoomRect().

◆ OnMouseMiddleDown()

void mpWindow::OnMouseMiddleDown ( wxMouseEvent &  event)
protected

Definition at line 1797 of file mathplot.cpp.

1798 {
1799  m_mouseMClick.x = event.GetX();
1800  m_mouseMClick.y = event.GetY();
1801 }
wxPoint m_mouseMClick
Definition: mathplot.h:1532

References m_mouseMClick.

◆ OnMouseMove()

void mpWindow::OnMouseMove ( wxMouseEvent &  event)
protected

Definition at line 1878 of file mathplot.cpp.

1879 {
1881  {
1882  event.Skip();
1883  return;
1884  }
1885 
1886  if( event.m_middleDown )
1887  {
1888  // The change:
1889  int Ax = m_mouseMClick.x - event.GetX();
1890  int Ay = m_mouseMClick.y - event.GetY();
1891 
1892  // For the next event, use relative to this coordinates.
1893  m_mouseMClick.x = event.GetX();
1894  m_mouseMClick.y = event.GetY();
1895 
1896  double Ax_units = Ax / m_scaleX;
1897  double Ay_units = -Ay / m_scaleY;
1898 
1899  bool updateRequired = false;
1900  updateRequired |= SetXView( m_posX + Ax_units,
1901  m_desiredXmax + Ax_units,
1902  m_desiredXmin + Ax_units );
1903  updateRequired |= SetYView( m_posY + Ay_units,
1904  m_desiredYmax + Ay_units,
1905  m_desiredYmin + Ay_units );
1906 
1907  if( updateRequired )
1908  UpdateAll();
1909  }
1910  else
1911  {
1912  if( event.m_leftDown )
1913  {
1914  if( m_movingInfoLayer == NULL )
1915  {
1916  wxClientDC dc( this );
1917  wxPen pen( m_fgColour, 1, wxPENSTYLE_DOT );
1918  dc.SetPen( pen );
1919  dc.SetBrush( *wxTRANSPARENT_BRUSH );
1920  dc.DrawRectangle( m_mouseLClick.x, m_mouseLClick.y,
1921  event.GetX() - m_mouseLClick.x, event.GetY() - m_mouseLClick.y );
1922  m_zooming = true;
1923  m_zoomRect.x = m_mouseLClick.x;
1924  m_zoomRect.y = m_mouseLClick.y;
1925  m_zoomRect.width = event.GetX() - m_mouseLClick.x;
1926  m_zoomRect.height = event.GetY() - m_mouseLClick.y;
1927  }
1928  else
1929  {
1930  wxPoint moveVector( event.GetX() - m_mouseLClick.x,
1931  event.GetY() - m_mouseLClick.y );
1932  m_movingInfoLayer->Move( moveVector );
1933  m_zooming = false;
1934  }
1935 
1936  UpdateAll();
1937  }
1938  else
1939  {
1940 #if 0
1941  wxLayerList::iterator li;
1942 
1943  for( li = m_layers.begin(); li != m_layers.end(); li++ )
1944  {
1945  if( (*li)->IsInfo() && (*li)->IsVisible() )
1946  {
1947  mpInfoLayer* tmpLyr = (mpInfoLayer*) (*li);
1948  tmpLyr->UpdateInfo( *this, event );
1949  // UpdateAll();
1950  RefreshRect( tmpLyr->GetRectangle() );
1951  }
1952  }
1953 
1954 #endif
1955  /* if (m_coordTooltip) {
1956  * wxString toolTipContent;
1957  * toolTipContent.Printf( "X = %f\nY = %f", p2x(event.GetX()), p2y(event.GetY()));
1958  * wxTipWindow** ptr = NULL;
1959  * wxRect rectBounds(event.GetX(), event.GetY(), 5, 5);
1960  * wxTipWindow* tip = new wxTipWindow(this, toolTipContent, 100, ptr, &rectBounds);
1961  *
1962  * } */
1963  }
1964  }
1965 
1966  event.Skip();
1967 }
bool m_zooming
Definition: mathplot.h:1537
virtual bool SetYView(double pos, double desiredMax, double desiredMin)
Applies new Y view coordinates depending on the settings.
Definition: mathplot.cpp:2203
double m_desiredXmax
Definition: mathplot.h:1521
double m_scaleY
Definition: mathplot.h:1510
bool m_enableMouseNavigation
Definition: mathplot.h:1529
double m_posX
Definition: mathplot.h:1511
wxPoint m_mouseMClick
Definition: mathplot.h:1532
double m_scaleX
Definition: mathplot.h:1509
wxLayerList m_layers
Definition: mathplot.h:1497
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2748
wxPoint m_mouseLClick
Definition: mathplot.h:1533
virtual void Move(wxPoint delta)
Moves the layer rectangle of given pixel deltas.
Definition: mathplot.cpp:141
#define NULL
double m_desiredYmax
Definition: mathplot.h:1521
virtual void UpdateInfo(mpWindow &w, wxEvent &event)
Updates the content of the info box.
Definition: mathplot.cpp:130
Base class to create small rectangular info boxes mpInfoLayer is the base class to create a small rec...
Definition: mathplot.h:336
wxRect m_zoomRect
Definition: mathplot.h:1538
double m_desiredXmin
These are updated in Fit() only, and may be different from the real borders (layer coordinates) only ...
Definition: mathplot.h:1521
mpInfoLayer * m_movingInfoLayer
Definition: mathplot.h:1536
wxColour m_fgColour
Definition: mathplot.h:1502
double m_posY
Definition: mathplot.h:1512
const wxRect & GetRectangle()
Returns the current rectangle coordinates.
Definition: mathplot.h:393
double m_desiredYmin
Definition: mathplot.h:1521
virtual bool SetXView(double pos, double desiredMax, double desiredMin)
Applies new X view coordinates depending on the settings.
Definition: mathplot.cpp:2189

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(), NULL, SetXView(), SetYView(), UpdateAll(), and mpInfoLayer::UpdateInfo().

◆ OnMouseWheel()

void mpWindow::OnMouseWheel ( wxMouseEvent &  event)
protected

Definition at line 1823 of file mathplot.cpp.

1824 {
1826  {
1827  event.Skip();
1828  return;
1829  }
1830 
1831  int change = event.GetWheelRotation();
1832  const int axis = event.GetWheelAxis();
1833  double changeUnitsX = change / m_scaleX;
1834  double changeUnitsY = change / m_scaleY;
1835 
1836  if( ( !m_enableMouseWheelPan && ( event.ControlDown() || event.ShiftDown() ) )
1837  || ( m_enableMouseWheelPan && !event.ControlDown() ) )
1838  {
1839  // Scrolling
1840  if( m_enableMouseWheelPan )
1841  {
1842  if( axis == wxMOUSE_WHEEL_HORIZONTAL || event.ShiftDown() )
1843  SetXView( m_posX + changeUnitsX, m_desiredXmax + changeUnitsX,
1844  m_desiredXmin + changeUnitsX );
1845  else
1846  SetYView( m_posY + changeUnitsY, m_desiredYmax + changeUnitsY,
1847  m_desiredYmin + changeUnitsY );
1848  }
1849  else
1850  {
1851  if( event.ControlDown() )
1852  SetXView( m_posX + changeUnitsX, m_desiredXmax + changeUnitsX,
1853  m_desiredXmin + changeUnitsX );
1854  else
1855  SetYView( m_posY + changeUnitsY, m_desiredYmax + changeUnitsY,
1856  m_desiredYmin + changeUnitsY );
1857  }
1858 
1859  UpdateAll();
1860  }
1861  else
1862  {
1863  // zoom in/out
1864  wxPoint clickPt( event.GetX(), event.GetY() );
1865 
1866  if( event.GetWheelRotation() > 0 )
1867  ZoomIn( clickPt );
1868  else
1869  ZoomOut( clickPt );
1870 
1871  return;
1872  }
1873 }
void ZoomOut(const wxPoint &centerPoint=wxDefaultPosition)
Zoom out current view and refresh display.
Definition: mathplot.cpp:2274
virtual bool SetYView(double pos, double desiredMax, double desiredMin)
Applies new Y view coordinates depending on the settings.
Definition: mathplot.cpp:2203
double m_desiredXmax
Definition: mathplot.h:1521
double m_scaleY
Definition: mathplot.h:1510
bool m_enableMouseNavigation
Definition: mathplot.h:1529
double m_posX
Definition: mathplot.h:1511
bool m_enableMouseWheelPan
Definition: mathplot.h:1530
double m_scaleX
Definition: mathplot.h:1509
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2748
double m_desiredYmax
Definition: mathplot.h:1521
void ZoomIn(const wxPoint &centerPoint=wxDefaultPosition)
Zoom into current view and refresh display.
Definition: mathplot.cpp:2217
double m_desiredXmin
These are updated in Fit() only, and may be different from the real borders (layer coordinates) only ...
Definition: mathplot.h:1521
double m_posY
Definition: mathplot.h:1512
double m_desiredYmin
Definition: mathplot.h:1521
virtual bool SetXView(double pos, double desiredMax, double desiredMin)
Applies new X view coordinates depending on the settings.
Definition: mathplot.cpp:2189

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

◆ OnPaint()

void mpWindow::OnPaint ( wxPaintEvent &  event)
protected

Definition at line 2484 of file mathplot.cpp.

2485 {
2486  wxPaintDC dc( this );
2487 
2488  dc.GetSize( &m_scrX, &m_scrY ); // This is the size of the visible area only!
2489 
2490  // Selects direct or buffered draw:
2491  wxDC* trgDc;
2492 
2493  // J.L.Blanco @ Aug 2007: Added double buffer support
2494  if( m_enableDoubleBuffer )
2495  {
2496  if( m_last_lx!=m_scrX || m_last_ly!=m_scrY )
2497  {
2498  if( m_buff_bmp )
2499  delete m_buff_bmp;
2500 
2501  m_buff_bmp = new wxBitmap( m_scrX, m_scrY );
2502  m_buff_dc.SelectObject( *m_buff_bmp );
2503  m_last_lx = m_scrX;
2504  m_last_ly = m_scrY;
2505  }
2506 
2507  trgDc = &m_buff_dc;
2508  }
2509  else
2510  {
2511  trgDc = &dc;
2512  }
2513 
2514  // Draw background:
2515  // trgDc->SetDeviceOrigin(0,0);
2516  trgDc->SetPen( *wxTRANSPARENT_PEN );
2517  wxBrush brush( GetBackgroundColour() );
2518  trgDc->SetBrush( brush );
2519  trgDc->SetTextForeground( m_fgColour );
2520  trgDc->DrawRectangle( 0, 0, m_scrX, m_scrY );
2521 
2522  // Draw all the layers:
2523  // trgDc->SetDeviceOrigin( m_scrX>>1, m_scrY>>1); // Origin at the center
2524  wxLayerList::iterator li;
2525 
2526  for( li = m_layers.begin(); li != m_layers.end(); li++ )
2527  {
2528  (*li)->Plot( *trgDc, *this );
2529  }
2530 
2531  ;
2532 
2533  if( m_zooming )
2534  {
2535  wxPen pen( m_fgColour, 1, wxPENSTYLE_DOT );
2536  trgDc->SetPen( pen );
2537  trgDc->SetBrush( *wxTRANSPARENT_BRUSH );
2538  trgDc->DrawRectangle( m_zoomRect );
2539  }
2540 
2541  // If doublebuffer, draw now to the window:
2542  if( m_enableDoubleBuffer )
2543  {
2544  // trgDc->SetDeviceOrigin(0,0);
2545  // dc.SetDeviceOrigin(0,0); // Origin at the center
2546  dc.Blit( 0, 0, m_scrX, m_scrY, trgDc, 0, 0 );
2547  }
2548 
2549  /* if (m_coordTooltip) {
2550  * wxString toolTipContent;
2551  * wxPoint mousePoint = wxGetMousePosition();
2552  * toolTipContent.Printf( "X = %f\nY = %f", p2x(mousePoint.x), p2y(mousePoint.y));
2553  * SetToolTip(toolTipContent);
2554  * }*/
2555  // If scrollbars are enabled, refresh them
2556  if( m_enableScrollBars )
2557  {
2558  /* m_scroll.x = (int) floor((m_posX - m_minX)*m_scaleX);
2559  * m_scroll.y = (int) floor((m_maxY - m_posY )*m_scaleY);
2560  * Scroll(m_scroll.x, m_scroll.y);*/
2561  // Scroll(x2p(m_posX), y2p(m_posY));
2562  // SetVirtualSize((int) ((m_maxX - m_minX)*m_scaleX), (int) ((m_maxY - m_minY)*m_scaleY));
2563  // int centerX = (m_scrX - m_marginLeft - m_marginRight)/2; // + m_marginLeft; // c.x = m_scrX/2;
2564  // int centerY = (m_scrY - m_marginTop - m_marginBottom)/2; // - m_marginTop; // c.y = m_scrY/2;
2565  /*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);
2566  }
2567 }
wxMemoryDC m_buff_dc
Definition: mathplot.h:1526
bool m_enableScrollBars
Definition: mathplot.h:1534
bool m_zooming
Definition: mathplot.h:1537
wxLayerList m_layers
Definition: mathplot.h:1497
wxRect m_zoomRect
Definition: mathplot.h:1538
wxColour m_fgColour
Definition: mathplot.h:1502
int m_last_ly
Definition: mathplot.h:1525
int m_last_lx
Definition: mathplot.h:1525
int m_scrY
Definition: mathplot.h:1514
bool m_enableDoubleBuffer
Definition: mathplot.h:1528
int m_scrX
Definition: mathplot.h:1513
wxBitmap * m_buff_bmp
Definition: mathplot.h:1527

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.

◆ OnScrollBottom()

void mpWindow::OnScrollBottom ( wxScrollWinEvent &  event)
protected

Definition at line 2906 of file mathplot.cpp.

2907 {
2908  int scrollOrientation = event.GetOrientation();
2909  // Get thumb size
2910  int thumbSize = GetScrollThumb( scrollOrientation );
2911  // Get scroll range
2912  int scrollRange = GetScrollRange( scrollOrientation );
2913 
2914  DoScrollCalc( scrollRange - thumbSize, scrollOrientation );
2915 }
void DoScrollCalc(const int position, const int orientation)
Definition: mathplot.cpp:2795

References DoScrollCalc().

◆ OnScrollLineDown()

void mpWindow::OnScrollLineDown ( wxScrollWinEvent &  event)
protected

Definition at line 2880 of file mathplot.cpp.

2881 {
2882  int scrollOrientation = event.GetOrientation();
2883  // Get position before page up
2884  int position = GetScrollPos( scrollOrientation );
2885  // Get thumb size
2886  int thumbSize = GetScrollThumb( scrollOrientation );
2887  // Get scroll range
2888  int scrollRange = GetScrollRange( scrollOrientation );
2889 
2890  // Need to adjust position by a page
2891  position += mpSCROLL_NUM_PIXELS_PER_LINE;
2892 
2893  if( position > (scrollRange - thumbSize) )
2894  position = scrollRange - thumbSize;
2895 
2896  DoScrollCalc( position, scrollOrientation );
2897 }
#define mpSCROLL_NUM_PIXELS_PER_LINE
Definition: mathplot.cpp:61
void DoScrollCalc(const int position, const int orientation)
Definition: mathplot.cpp:2795

References DoScrollCalc(), and mpSCROLL_NUM_PIXELS_PER_LINE.

◆ OnScrollLineUp()

void mpWindow::OnScrollLineUp ( wxScrollWinEvent &  event)
protected

Definition at line 2864 of file mathplot.cpp.

2865 {
2866  int scrollOrientation = event.GetOrientation();
2867  // Get position before page up
2868  int position = GetScrollPos( scrollOrientation );
2869 
2870  // Need to adjust position by a line
2871  position -= mpSCROLL_NUM_PIXELS_PER_LINE;
2872 
2873  if( position < 0 )
2874  position = 0;
2875 
2876  DoScrollCalc( position, scrollOrientation );
2877 }
#define mpSCROLL_NUM_PIXELS_PER_LINE
Definition: mathplot.cpp:61
void DoScrollCalc(const int position, const int orientation)
Definition: mathplot.cpp:2795

References DoScrollCalc(), and mpSCROLL_NUM_PIXELS_PER_LINE.

◆ OnScrollPageDown()

void mpWindow::OnScrollPageDown ( wxScrollWinEvent &  event)
protected

Definition at line 2844 of file mathplot.cpp.

2845 {
2846  int scrollOrientation = event.GetOrientation();
2847  // Get position before page up
2848  int position = GetScrollPos( scrollOrientation );
2849  // Get thumb size
2850  int thumbSize = GetScrollThumb( scrollOrientation );
2851  // Get scroll range
2852  int scrollRange = GetScrollRange( scrollOrientation );
2853 
2854  // Need to adjust position by a page
2855  position += thumbSize;
2856 
2857  if( position > (scrollRange - thumbSize) )
2858  position = scrollRange - thumbSize;
2859 
2860  DoScrollCalc( position, scrollOrientation );
2861 }
void DoScrollCalc(const int position, const int orientation)
Definition: mathplot.cpp:2795

References DoScrollCalc().

◆ OnScrollPageUp()

void mpWindow::OnScrollPageUp ( wxScrollWinEvent &  event)
protected

Definition at line 2826 of file mathplot.cpp.

2827 {
2828  int scrollOrientation = event.GetOrientation();
2829  // Get position before page up
2830  int position = GetScrollPos( scrollOrientation );
2831  // Get thumb size
2832  int thumbSize = GetScrollThumb( scrollOrientation );
2833 
2834  // Need to adjust position by a page
2835  position -= thumbSize;
2836 
2837  if( position < 0 )
2838  position = 0;
2839 
2840  DoScrollCalc( position, scrollOrientation );
2841 }
void DoScrollCalc(const int position, const int orientation)
Definition: mathplot.cpp:2795

References DoScrollCalc().

◆ OnScrollThumbTrack()

void mpWindow::OnScrollThumbTrack ( wxScrollWinEvent &  event)
protected

Definition at line 2820 of file mathplot.cpp.

2821 {
2822  DoScrollCalc( event.GetPosition(), event.GetOrientation() );
2823 }
void DoScrollCalc(const int position, const int orientation)
Definition: mathplot.cpp:2795

References DoScrollCalc().

◆ OnScrollTop()

void mpWindow::OnScrollTop ( wxScrollWinEvent &  event)
protected

Definition at line 2900 of file mathplot.cpp.

2901 {
2902  DoScrollCalc( 0, event.GetOrientation() );
2903 }
void DoScrollCalc(const int position, const int orientation)
Definition: mathplot.cpp:2795

References DoScrollCalc().

◆ OnShowPopupMenu()

void mpWindow::OnShowPopupMenu ( wxMouseEvent &  event)
protected

Definition at line 2375 of file mathplot.cpp.

2376 {
2377  m_clickedX = event.GetX();
2378  m_clickedY = event.GetY();
2379  PopupMenu( &m_popmenu, event.GetX(), event.GetY() );
2380 }
int m_clickedX
Definition: mathplot.h:1515
int m_clickedY
Definition: mathplot.h:1516
wxMenu m_popmenu
Definition: mathplot.h:1498

References m_clickedX, m_clickedY, and m_popmenu.

◆ OnSize()

void mpWindow::OnSize ( wxSizeEvent &  event)
protected

Definition at line 2417 of file mathplot.cpp.

2418 {
2419  // Try to fit again with the new window size:
2421 }
double m_desiredXmax
Definition: mathplot.h:1521
double m_desiredYmax
Definition: mathplot.h:1521
double m_desiredXmin
These are updated in Fit() only, and may be different from the real borders (layer coordinates) only ...
Definition: mathplot.h:1521
void Fit() override
Set view to fit global bounding box of all plot layers and refresh display.
Definition: mathplot.cpp:2012
double m_desiredYmin
Definition: mathplot.h:1521

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

◆ OnZoomIn()

void mpWindow::OnZoomIn ( wxCommandEvent &  event)
protected

Definition at line 2405 of file mathplot.cpp.

2406 {
2407  ZoomIn( wxPoint( m_mouseMClick.x, m_mouseMClick.y ) );
2408 }
wxPoint m_mouseMClick
Definition: mathplot.h:1532
void ZoomIn(const wxPoint &centerPoint=wxDefaultPosition)
Zoom into current view and refresh display.
Definition: mathplot.cpp:2217

References m_mouseMClick, and ZoomIn().

◆ OnZoomOut()

void mpWindow::OnZoomOut ( wxCommandEvent &  event)
protected

Definition at line 2411 of file mathplot.cpp.

2412 {
2413  ZoomOut();
2414 }
void ZoomOut(const wxPoint &centerPoint=wxDefaultPosition)
Zoom out current view and refresh display.
Definition: mathplot.cpp:2274

References ZoomOut().

◆ p2x()

double mpWindow::p2x ( wxCoord  pixelCoordX)
inline

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

See also
p2y,x2p,y2p

Definition at line 1189 of file mathplot.h.

1189 { return m_posX + pixelCoordX / m_scaleX; }
double m_posX
Definition: mathplot.h:1511
double m_scaleX
Definition: mathplot.h:1509

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

◆ p2y()

double mpWindow::p2y ( wxCoord  pixelCoordY)
inline

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

See also
p2x,x2p,y2p

Definition at line 1194 of file mathplot.h.

1194 { return m_posY - pixelCoordY / m_scaleY; }
double m_scaleY
Definition: mathplot.h:1510
double m_posY
Definition: mathplot.h:1512

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

◆ SaveScreenshot()

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 2978 of file mathplot.cpp.

2980 {
2981  int sizeX, sizeY;
2982  int bk_scrX, bk_scrY;
2983 
2984  if( imageSize == wxDefaultSize )
2985  {
2986  sizeX = m_scrX;
2987  sizeY = m_scrY;
2988  }
2989  else
2990  {
2991  sizeX = imageSize.x;
2992  sizeY = imageSize.y;
2993  bk_scrX = m_scrX;
2994  bk_scrY = m_scrY;
2995  SetScr( sizeX, sizeY );
2996  }
2997 
2998  wxBitmap screenBuffer( sizeX, sizeY );
2999  wxMemoryDC screenDC;
3000  screenDC.SelectObject( screenBuffer );
3001  screenDC.SetPen( *wxWHITE_PEN );
3002  screenDC.SetTextForeground( m_fgColour );
3003  wxBrush brush( GetBackgroundColour() );
3004  screenDC.SetBrush( brush );
3005  screenDC.DrawRectangle( 0, 0, sizeX, sizeY );
3006 
3007  if( fit )
3008  {
3009  Fit( m_minX, m_maxX, m_minY, m_maxY, &sizeX, &sizeY );
3010  }
3011  else
3012  {
3014  }
3015 
3016  // Draw all the layers:
3017  wxLayerList::iterator li;
3018 
3019  for( li = m_layers.begin(); li != m_layers.end(); li++ )
3020  (*li)->Plot( screenDC, *this );
3021 
3022  if( imageSize != wxDefaultSize )
3023  {
3024  // Restore dimensions
3025  SetScr( bk_scrX, bk_scrY );
3026  Fit( m_desiredXmin, m_desiredXmax, m_desiredYmin, m_desiredYmax, &bk_scrX, &bk_scrY );
3027  UpdateAll();
3028  }
3029 
3030  // Once drawing is complete, actually save screen shot
3031  wxImage screenImage = screenBuffer.ConvertToImage();
3032  return screenImage.SaveFile( filename, type );
3033 }
double m_desiredXmax
Definition: mathplot.h:1521
double m_minY
Definition: mathplot.h:1507
wxLayerList m_layers
Definition: mathplot.h:1497
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2748
double m_desiredYmax
Definition: mathplot.h:1521
double m_desiredXmin
These are updated in Fit() only, and may be different from the real borders (layer coordinates) only ...
Definition: mathplot.h:1521
wxColour m_fgColour
Definition: mathplot.h:1502
void Fit() override
Set view to fit global bounding box of all plot layers and refresh display.
Definition: mathplot.cpp:2012
double m_minX
Definition: mathplot.h:1505
double m_desiredYmin
Definition: mathplot.h:1521
void SetScr(int scrX, int scrY)
Set current view's dimensions in device context units.
Definition: mathplot.h:1184
int m_scrY
Definition: mathplot.h:1514
double m_maxX
Definition: mathplot.h:1506
int m_scrX
Definition: mathplot.h:1513
double m_maxY
Definition: mathplot.h:1508

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

Referenced by SIM_PLOT_FRAME::menuSaveImage().

◆ SetColourTheme()

void mpWindow::SetColourTheme ( const wxColour &  bgColour,
const wxColour &  drawColour,
const wxColour &  axesColour 
)

Set Color theme.

Provide colours to set a new colour theme.

Parameters
bgColourBackground colour
drawColourThe colour used to draw all elements in foreground, axes excluded
axesColourThe colour used to draw axes (but not their labels)

Definition at line 3106 of file mathplot.cpp.

3109 {
3110  SetBackgroundColour( bgColour );
3111  SetForegroundColour( drawColour );
3112  m_bgColour = bgColour;
3113  m_fgColour = drawColour;
3114  m_axColour = axesColour;
3115  // cycle between layers to set colours and properties to them
3116  wxLayerList::iterator li;
3117 
3118  for( li = m_layers.begin(); li != m_layers.end(); li++ )
3119  {
3120  if( (*li)->GetLayerType() == mpLAYER_AXIS )
3121  {
3122  wxPen axisPen = (*li)->GetPen(); // Get the old pen to modify only colour, not style or width
3123  axisPen.SetColour( axesColour );
3124  (*li)->SetPen( axisPen );
3125  }
3126 
3127  if( (*li)->GetLayerType() == mpLAYER_INFO )
3128  {
3129  wxPen infoPen = (*li)->GetPen(); // Get the old pen to modify only colour, not style or width
3130  infoPen.SetColour( drawColour );
3131  (*li)->SetPen( infoPen );
3132  }
3133  }
3134 }
wxColour m_axColour
Definition: mathplot.h:1503
wxLayerList m_layers
Definition: mathplot.h:1497
wxColour m_fgColour
Definition: mathplot.h:1502
wxColour m_bgColour
Definition: mathplot.h:1501

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

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

◆ SetLayerVisible() [1/2]

void mpWindow::SetLayerVisible ( const wxString &  name,
bool  viewable 
)

Sets the visibility of a layer by its name.

Parameters
nameThe layer name to set visibility
viewablethe view status to be set

Definition at line 3066 of file mathplot.cpp.

3067 {
3068  mpLayer* lx = GetLayerByName( name );
3069 
3070  if( lx )
3071  {
3072  lx->SetVisible( viewable );
3073  UpdateAll();
3074  }
3075 }
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2748
void SetVisible(bool show)
Sets layer visibility.
Definition: mathplot.h:303
mpLayer * GetLayerByName(const wxString &name)
Definition: mathplot.cpp:2958
const char * name
Definition: DXF_plotter.cpp:59

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

◆ SetLayerVisible() [2/2]

void mpWindow::SetLayerVisible ( const unsigned int  position,
bool  viewable 
)

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

Parameters
positionThe layer position in layer list
viewablethe view status to be set

Definition at line 3086 of file mathplot.cpp.

3087 {
3088  mpLayer* lx = GetLayer( position );
3089 
3090  if( lx )
3091  {
3092  lx->SetVisible( viewable );
3093  UpdateAll();
3094  }
3095 }
mpLayer * GetLayer(int position)
Definition: mathplot.cpp:2949
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2748
void SetVisible(bool show)
Sets layer visibility.
Definition: mathplot.h:303

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

◆ SetMarginBottom()

void mpWindow::SetMarginBottom ( int  bottom)
inline

Set the bottom margin.

Parameters
bottomBottom Margin

Definition at line 1363 of file mathplot.h.

1363 { m_marginBottom = bottom; };
int m_marginBottom
Definition: mathplot.h:1523

◆ SetMarginLeft()

void mpWindow::SetMarginLeft ( int  left)
inline

Set the left margin.

Parameters
leftLeft Margin

Definition at line 1365 of file mathplot.h.

1365 { m_marginLeft = left; };
int m_marginLeft
Definition: mathplot.h:1523

◆ SetMarginRight()

void mpWindow::SetMarginRight ( int  right)
inline

Set the right margin.

Parameters
rightRight Margin

Definition at line 1361 of file mathplot.h.

1361 { m_marginRight = right; };
int m_marginRight
Definition: mathplot.h:1523

◆ SetMargins()

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

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

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

Parameters
topTop border
rightRight border
bottomBottom border
leftLeft border

Definition at line 3036 of file mathplot.cpp.

3037 {
3038  m_marginTop = top;
3039  m_marginRight = right;
3040  m_marginBottom = bottom;
3041  m_marginLeft = left;
3042 }
int m_marginRight
Definition: mathplot.h:1523
int m_marginLeft
Definition: mathplot.h:1523
int m_marginTop
Definition: mathplot.h:1523
int m_marginBottom
Definition: mathplot.h:1523

References m_marginBottom, m_marginLeft, m_marginRight, and m_marginTop.

Referenced by SIM_PLOT_PANEL::SIM_PLOT_PANEL().

◆ SetMarginTop()

void mpWindow::SetMarginTop ( int  top)
inline

Set the top margin.

Parameters
topTop Margin

Definition at line 1359 of file mathplot.h.

1359 { m_marginTop = top; };
int m_marginTop
Definition: mathplot.h:1523

◆ SetMPScrollbars()

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 2611 of file mathplot.cpp.

2612 {
2613  // Temporary behaviour: always disable scrollbars
2614  m_enableScrollBars = status; // false;
2615 
2616  if( status == false )
2617  {
2618  SetScrollbar( wxHORIZONTAL, 0, 0, 0 );
2619  SetScrollbar( wxVERTICAL, 0, 0, 0 );
2620  }
2621 
2622  // else the scroll bars will be updated in UpdateAll();
2623  UpdateAll();
2624 
2625  // EnableScrolling(false, false);
2626  // m_enableScrollBars = status;
2627  // EnableScrolling(status, status);
2628  /* m_scroll.x = (int) floor((m_posX - m_minX)*m_scaleX);
2629  * m_scroll.y = (int) floor((m_posY - m_minY)*m_scaleY);*/
2630  // int scrollWidth = (int) floor((m_maxX - m_minX)*m_scaleX) - m_scrX;
2631  // int scrollHeight = (int) floor((m_minY - m_maxY)*m_scaleY) - m_scrY;
2632 
2634  // m_scroll.y = (int) floor((m_maxY - m_posY /*- m_minY*/)*m_scaleY);
2635  // int scrollWidth = (int) floor(((m_maxX - m_minX) - (m_desiredXmax - m_desiredXmin))*m_scaleX);
2636  // int scrollHeight = (int) floor(((m_maxY - m_minY) - (m_desiredYmax - m_desiredYmin))*m_scaleY);
2637  // if(status) {
2638  // SetScrollbars(1,
2639  // 1,
2640  // scrollWidth,
2641  // scrollHeight,
2642  // m_scroll.x,
2643  // m_scroll.y);
2645  // }
2646  // Refresh(false);*/
2647 }
bool m_enableScrollBars
Definition: mathplot.h:1534
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2748

References m_enableScrollBars, and UpdateAll().

◆ SetPos()

void mpWindow::SetPos ( double  posX,
double  posY 
)
inline

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

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

Definition at line 1177 of file mathplot.h.

1177 { m_posX = posX; m_posY = posY; UpdateAll(); }
double m_posX
Definition: mathplot.h:1511
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2748
double m_posY
Definition: mathplot.h:1512

Referenced by OnCenter().

◆ SetPosX()

void mpWindow::SetPosX ( double  posX)
inline

Set current view's X position and refresh display.

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

Definition at line 1166 of file mathplot.h.

1166 { m_posX = posX; UpdateAll(); }
double m_posX
Definition: mathplot.h:1511
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2748

Referenced by DoScrollCalc().

◆ SetPosY()

void mpWindow::SetPosY ( double  posY)
inline

Set current view's Y position and refresh display.

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

Definition at line 1171 of file mathplot.h.

1171 { m_posY = posY; UpdateAll(); }
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2748
double m_posY
Definition: mathplot.h:1512

Referenced by DoScrollCalc().

◆ SetScaleX()

void mpWindow::SetScaleX ( double  scaleX)

Set current view's X scale and refresh display.

Parameters
scaleXNew scale, must not be 0.

Definition at line 2920 of file mathplot.cpp.

2921 {
2922  if( scaleX!=0 )
2923  m_scaleX = scaleX;
2924 
2925  UpdateAll();
2926 }
double m_scaleX
Definition: mathplot.h:1509
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2748

References m_scaleX, and UpdateAll().

◆ SetScaleY()

void mpWindow::SetScaleY ( double  scaleY)
inline

Set current view's Y scale and refresh display.

Parameters
scaleYNew scale, must not be 0.

Definition at line 1155 of file mathplot.h.

1156  {
1157  if( scaleY!=0 )
1158  m_scaleY = scaleY;
1159 
1160  UpdateAll();
1161  }
double m_scaleY
Definition: mathplot.h:1510
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2748

◆ SetScr()

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

Set current view's dimensions in device context units.

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

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

Definition at line 1184 of file mathplot.h.

1184 { m_scrX = scrX; m_scrY = scrY; }
int m_scrY
Definition: mathplot.h:1514
int m_scrX
Definition: mathplot.h:1513

Referenced by SaveScreenshot().

◆ SetXView()

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 2189 of file mathplot.cpp.

2190 {
2191  // if(!CheckXLimits(desiredMax, desiredMin))
2192  // return false;
2193 
2194  m_posX = pos;
2195  m_desiredXmax = desiredMax;
2196  m_desiredXmin = desiredMin;
2198 
2199  return true;
2200 }
double m_desiredXmax
Definition: mathplot.h:1521
double m_posX
Definition: mathplot.h:1511
void AdjustLimitedView()
Definition: mathplot.cpp:2143
double m_desiredXmin
These are updated in Fit() only, and may be different from the real borders (layer coordinates) only ...
Definition: mathplot.h:1521

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

Referenced by OnMouseMove(), and OnMouseWheel().

◆ SetYView()

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 2203 of file mathplot.cpp.

2204 {
2205  // if(!CheckYLimits(desiredMax, desiredMin))
2206  // return false;
2207 
2208  m_posY = pos;
2209  m_desiredYmax = desiredMax;
2210  m_desiredYmin = desiredMin;
2212 
2213  return true;
2214 }
double m_desiredYmax
Definition: mathplot.h:1521
void AdjustLimitedView()
Definition: mathplot.cpp:2143
double m_posY
Definition: mathplot.h:1512
double m_desiredYmin
Definition: mathplot.h:1521

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

Referenced by OnMouseMove(), and OnMouseWheel().

◆ UpdateAll()

void mpWindow::UpdateAll ( )

Refresh display.

Definition at line 2748 of file mathplot.cpp.

2749 {
2750  if( UpdateBBox() )
2751  {
2752  if( m_enableScrollBars )
2753  {
2754  int cx, cy;
2755  GetClientSize( &cx, &cy );
2756  // Do x scroll bar
2757  {
2758  // Convert margin sizes from pixels to coordinates
2759  double leftMargin = m_marginLeft / m_scaleX;
2760  // Calculate the range in coords that we want to scroll over
2761  double maxX = (m_desiredXmax > m_maxX) ? m_desiredXmax : m_maxX;
2762  double minX = (m_desiredXmin < m_minX) ? m_desiredXmin : m_minX;
2763 
2764  if( (m_posX + leftMargin) < minX )
2765  minX = m_posX + leftMargin;
2766 
2767  // Calculate scroll bar size and thumb position
2768  int sizeX = (int) ( (maxX - minX) * m_scaleX );
2769  int thumbX = (int) ( ( (m_posX + leftMargin) - minX ) * m_scaleX );
2770  SetScrollbar( wxHORIZONTAL, thumbX, cx - (m_marginRight + m_marginLeft), sizeX );
2771  }
2772  // Do y scroll bar
2773  {
2774  // Convert margin sizes from pixels to coordinates
2775  double topMargin = m_marginTop / m_scaleY;
2776  // Calculate the range in coords that we want to scroll over
2777  double maxY = (m_desiredYmax > m_maxY) ? m_desiredYmax : m_maxY;
2778 
2779  if( (m_posY - topMargin) > maxY )
2780  maxY = m_posY - topMargin;
2781 
2782  double minY = (m_desiredYmin < m_minY) ? m_desiredYmin : m_minY;
2783  // Calculate scroll bar size and thumb position
2784  int sizeY = (int) ( (maxY - minY) * m_scaleY );
2785  int thumbY = (int) ( ( maxY - (m_posY - topMargin) ) * m_scaleY );
2786  SetScrollbar( wxVERTICAL, thumbY, cy - (m_marginTop + m_marginBottom), sizeY );
2787  }
2788  }
2789  }
2790 
2791  Refresh( false );
2792 }
int m_marginRight
Definition: mathplot.h:1523
bool m_enableScrollBars
Definition: mathplot.h:1534
int m_marginLeft
Definition: mathplot.h:1523
double m_desiredXmax
Definition: mathplot.h:1521
double m_scaleY
Definition: mathplot.h:1510
double m_posX
Definition: mathplot.h:1511
double m_minY
Definition: mathplot.h:1507
double m_scaleX
Definition: mathplot.h:1509
double m_desiredYmax
Definition: mathplot.h:1521
void Refresh()
Update the board display after modifying it by 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:1521
double m_posY
Definition: mathplot.h:1512
int m_marginTop
Definition: mathplot.h:1523
double m_minX
Definition: mathplot.h:1505
double m_desiredYmin
Definition: mathplot.h:1521
int m_marginBottom
Definition: mathplot.h:1523
virtual bool UpdateBBox()
Recalculate global layer bounding box, and save it in m_minX,...
Definition: mathplot.cpp:2649
double m_maxX
Definition: mathplot.h:1506
double m_maxY
Definition: mathplot.h:1508

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(), mpWindow(), OnMouseMove(), OnMouseWheel(), mpPrintout::OnPrintPage(), SIM_PLOT_FRAME::onSimFinished(), SaveScreenshot(), SIM_PLOT_PANEL::SetDottedCurrentPhase(), SetLayerVisible(), SetMPScrollbars(), SetScaleX(), SIM_PLOT_PANEL::ShowGrid(), SIM_PLOT_PANEL::ShowLegend(), SIM_PLOT_PANEL::SIM_PLOT_PANEL(), SIM_PLOT_PANEL::UpdatePlotColors(), ZoomIn(), ZoomInX(), ZoomInY(), ZoomOut(), ZoomOutX(), and ZoomOutY().

◆ UpdateBBox()

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 2649 of file mathplot.cpp.

2650 {
2651  m_minX = 0.0;
2652  m_maxX = 1.0;
2653  m_minY = 0.0;
2654  m_maxY = 1.0;
2655 
2656  return true;
2657 
2658 #if 0
2659  bool first = true;
2660 
2661  for( wxLayerList::iterator li = m_layers.begin(); li != m_layers.end(); li++ )
2662  {
2663  mpLayer* f = *li;
2664 
2665  if( f->HasBBox() )
2666  {
2667  if( first )
2668  {
2669  first = false;
2670  m_minX = f->GetMinX(); m_maxX = f->GetMaxX();
2671  m_minY = f->GetMinY(); m_maxY = f->GetMaxY();
2672  }
2673  else
2674  {
2675  if( f->GetMinX()<m_minX )
2676  m_minX = f->GetMinX();
2677 
2678  if( f->GetMaxX()>m_maxX )
2679  m_maxX = f->GetMaxX();
2680 
2681  if( f->GetMinY()<m_minY )
2682  m_minY = f->GetMinY();
2683 
2684  if( f->GetMaxY()>m_maxY )
2685  m_maxY = f->GetMaxY();
2686  }
2687  }
2688 
2689  // node = node->GetNext();
2690  }
2691 
2692  return first == false;
2693 #endif
2694 }
double m_minY
Definition: mathplot.h:1507
wxLayerList m_layers
Definition: mathplot.h:1497
virtual double GetMaxX()
Get inclusive right border of bounding box.
Definition: mathplot.h:181
virtual double GetMaxY()
Get inclusive top border of bounding box.
Definition: mathplot.h:191
virtual double GetMinX()
Get inclusive left border of bounding box.
Definition: mathplot.h:176
virtual double GetMinY()
Get inclusive bottom border of bounding box.
Definition: mathplot.h:186
double m_minX
Definition: mathplot.h:1505
virtual bool HasBBox()
Check whether this layer has a bounding box.
Definition: mathplot.h:162
double m_maxX
Definition: mathplot.h:1506
double m_maxY
Definition: mathplot.h:1508

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

◆ x2p()

wxCoord mpWindow::x2p ( double  x)
inline

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

See also
p2x,p2y,y2p

Definition at line 1199 of file mathplot.h.

1199 { return (wxCoord) ( (x - m_posX) * m_scaleX ); }
double m_posX
Definition: mathplot.h:1511
double m_scaleX
Definition: mathplot.h:1509

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

◆ y2p()

wxCoord mpWindow::y2p ( double  y)
inline

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

See also
p2x,p2y,x2p

Definition at line 1204 of file mathplot.h.

1204 { return (wxCoord) ( (m_posY - y) * m_scaleY ); }
double m_scaleY
Definition: mathplot.h:1510
double m_posY
Definition: mathplot.h:1512

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

◆ ZoomIn() [1/2]

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 2217 of file mathplot.cpp.

2218 {
2219  ZoomIn( centerPoint, zoomIncrementalFactor );
2220 }
void ZoomIn(const wxPoint &centerPoint=wxDefaultPosition)
Zoom into current view and refresh display.
Definition: mathplot.cpp:2217
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:1348

References zoomIncrementalFactor.

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

◆ ZoomIn() [2/2]

void mpWindow::ZoomIn ( const wxPoint &  centerPoint,
double  zoomFactor 
)

Definition at line 2223 of file mathplot.cpp.

2224 {
2225  wxPoint c( centerPoint );
2226 
2227  if( c == wxDefaultPosition )
2228  {
2229  GetClientSize( &m_scrX, &m_scrY );
2230  c.x = (m_scrX - m_marginLeft - m_marginRight) / 2 + m_marginLeft; // c.x = m_scrX/2;
2231  c.y = (m_scrY - m_marginTop - m_marginBottom) / 2 - m_marginTop; // c.y = m_scrY/2;
2232  }
2233  else
2234  {
2235  c.x = std::max( c.x, m_marginLeft );
2236  c.x = std::min( c.x, m_scrX - m_marginRight );
2237  c.y = std::max( c.y, m_marginTop );
2238  c.y = std::min( c.y, m_scrY - m_marginBottom );
2239  }
2240 
2241  // Preserve the position of the clicked point:
2242  double prior_layer_x = p2x( c.x );
2243  double prior_layer_y = p2y( c.y );
2244 
2245  // Zoom in:
2246  const double MAX_SCALE = 1e6;
2247  double newScaleX = m_scaleX * zoomFactor;
2248  double newScaleY = m_scaleY * zoomFactor;
2249 
2250  // Baaaaad things happen when you zoom in too much..
2251  if( newScaleX <= MAX_SCALE && newScaleY <= MAX_SCALE )
2252  {
2253  m_scaleX = newScaleX;
2254  m_scaleY = newScaleY;
2255  }
2256  else
2257  {
2258  return;
2259  }
2260 
2261  // Adjust the new m_posx/y:
2262  m_posX = prior_layer_x - c.x / m_scaleX;
2263  m_posY = prior_layer_y + c.y / m_scaleY;
2264 
2266  m_desiredXmax = m_posX + (m_scrX - m_marginLeft - m_marginRight) / m_scaleX; // m_desiredXmax = m_posX + m_scrX / m_scaleX;
2268  m_desiredYmin = m_posY - (m_scrY - m_marginTop - m_marginBottom) / m_scaleY; // m_desiredYmin = m_posY - m_scrY / m_scaleY;
2270  UpdateAll();
2271 }
#define MAX_SCALE
Definition: panel_prev_3d.h:48
int m_marginRight
Definition: mathplot.h:1523
int m_marginLeft
Definition: mathplot.h:1523
double p2x(wxCoord pixelCoordX)
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates,...
Definition: mathplot.h:1189
double m_desiredXmax
Definition: mathplot.h:1521
double m_scaleY
Definition: mathplot.h:1510
double m_posX
Definition: mathplot.h:1511
double p2y(wxCoord pixelCoordY)
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates,...
Definition: mathplot.h:1194
double m_scaleX
Definition: mathplot.h:1509
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2748
double m_desiredYmax
Definition: mathplot.h:1521
void AdjustLimitedView()
Definition: mathplot.cpp:2143
double m_desiredXmin
These are updated in Fit() only, and may be different from the real borders (layer coordinates) only ...
Definition: mathplot.h:1521
double m_posY
Definition: mathplot.h:1512
int m_marginTop
Definition: mathplot.h:1523
double m_desiredYmin
Definition: mathplot.h:1521
int m_marginBottom
Definition: mathplot.h:1523
int m_scrY
Definition: mathplot.h:1514
int m_scrX
Definition: mathplot.h:1513

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_SCALE, p2x(), p2y(), and UpdateAll().

◆ ZoomInX()

void mpWindow::ZoomInX ( )

Zoom in current view along X and refresh display.

Definition at line 2318 of file mathplot.cpp.

2319 {
2321  UpdateAll();
2322 }
double m_scaleX
Definition: mathplot.h:1509
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2748
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:1348

References m_scaleX, UpdateAll(), and zoomIncrementalFactor.

◆ ZoomInY()

void mpWindow::ZoomInY ( )

Zoom in current view along Y and refresh display.

Definition at line 2332 of file mathplot.cpp.

2333 {
2335  UpdateAll();
2336 }
double m_scaleY
Definition: mathplot.h:1510
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2748
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:1348

References m_scaleY, UpdateAll(), and zoomIncrementalFactor.

◆ ZoomOut() [1/2]

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 2274 of file mathplot.cpp.

2275 {
2276  ZoomOut( centerPoint, zoomIncrementalFactor );
2277 }
void ZoomOut(const wxPoint &centerPoint=wxDefaultPosition)
Zoom out current view and refresh display.
Definition: mathplot.cpp:2274
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:1348

References zoomIncrementalFactor.

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

◆ ZoomOut() [2/2]

void mpWindow::ZoomOut ( const wxPoint &  centerPoint,
double  zoomFactor 
)

Definition at line 2280 of file mathplot.cpp.

2281 {
2282  wxPoint c( centerPoint );
2283 
2284  if( c == wxDefaultPosition )
2285  {
2286  GetClientSize( &m_scrX, &m_scrY );
2287  c.x = (m_scrX - m_marginLeft - m_marginRight) / 2 + m_marginLeft; // c.x = m_scrX/2;
2288  c.y = (m_scrY - m_marginTop - m_marginBottom) / 2 - m_marginTop; // c.y = m_scrY/2;
2289  }
2290 
2291  // Preserve the position of the clicked point:
2292  double prior_layer_x = p2x( c.x );
2293  double prior_layer_y = p2y( c.y );
2294 
2295  // Zoom out:
2296  m_scaleX = m_scaleX / zoomFactor;
2297  m_scaleY = m_scaleY / zoomFactor;
2298 
2299  // Adjust the new m_posx/y:
2300  m_posX = prior_layer_x - c.x / m_scaleX;
2301  m_posY = prior_layer_y + c.y / m_scaleY;
2302 
2304  m_desiredXmax = m_posX + (m_scrX - m_marginLeft - m_marginRight) / m_scaleX; // m_desiredXmax = m_posX + m_scrX / m_scaleX;
2306  m_desiredYmin = m_posY - (m_scrY - m_marginTop - m_marginBottom) / m_scaleY; // m_desiredYmin = m_posY - m_scrY / m_scaleY;
2307 
2310  {
2311  Fit();
2312  }
2313 
2314  UpdateAll();
2315 }
int m_marginRight
Definition: mathplot.h:1523
int m_marginLeft
Definition: mathplot.h:1523
double p2x(wxCoord pixelCoordX)
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates,...
Definition: mathplot.h:1189
double m_desiredXmax
Definition: mathplot.h:1521
double m_scaleY
Definition: mathplot.h:1510
double m_posX
Definition: mathplot.h:1511
double p2y(wxCoord pixelCoordY)
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates,...
Definition: mathplot.h:1194
double m_scaleX
Definition: mathplot.h:1509
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2748
double m_desiredYmax
Definition: mathplot.h:1521
double m_desiredXmin
These are updated in Fit() only, and may be different from the real borders (layer coordinates) only ...
Definition: mathplot.h:1521
bool CheckYLimits(double &desiredMax, double &desiredMin) const
Definition: mathplot.h:1472
double m_posY
Definition: mathplot.h:1512
void Fit() override
Set view to fit global bounding box of all plot layers and refresh display.
Definition: mathplot.cpp:2012
int m_marginTop
Definition: mathplot.h:1523
double m_desiredYmin
Definition: mathplot.h:1521
int m_marginBottom
Definition: mathplot.h:1523
int m_scrY
Definition: mathplot.h:1514
bool CheckXLimits(double &desiredMax, double &desiredMin) const
Definition: mathplot.h:1465
int m_scrX
Definition: mathplot.h:1513

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(), and UpdateAll().

◆ ZoomOutX()

void mpWindow::ZoomOutX ( )

Zoom out current view along X and refresh display.

Definition at line 2325 of file mathplot.cpp.

2326 {
2328  UpdateAll();
2329 }
double m_scaleX
Definition: mathplot.h:1509
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2748
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:1348

References m_scaleX, UpdateAll(), and zoomIncrementalFactor.

◆ ZoomOutY()

void mpWindow::ZoomOutY ( )

Zoom out current view along Y and refresh display.

Definition at line 2339 of file mathplot.cpp.

2340 {
2342  UpdateAll();
2343 }
double m_scaleY
Definition: mathplot.h:1510
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2748
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:1348

References m_scaleY, UpdateAll(), and zoomIncrementalFactor.

◆ ZoomRect()

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

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

Definition at line 2346 of file mathplot.cpp.

2347 {
2348  // Compute the 2 corners in graph coordinates:
2349  double p0x = p2x( p0.x );
2350  double p0y = p2y( p0.y );
2351  double p1x = p2x( p1.x );
2352  double p1y = p2y( p1.y );
2353 
2354  // Order them:
2355  double zoom_x_min = p0x<p1x ? p0x : p1x;
2356  double zoom_x_max = p0x>p1x ? p0x : p1x;
2357  double zoom_y_min = p0y<p1y ? p0y : p1y;
2358  double zoom_y_max = p0y>p1y ? p0y : p1y;
2359 
2360  Fit( zoom_x_min, zoom_x_max, zoom_y_min, zoom_y_max );
2362 }
double p2x(wxCoord pixelCoordX)
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates,...
Definition: mathplot.h:1189
double p2y(wxCoord pixelCoordY)
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates,...
Definition: mathplot.h:1194
void AdjustLimitedView()
Definition: mathplot.cpp:2143
void Fit() override
Set view to fit global bounding box of all plot layers and refresh display.
Definition: mathplot.cpp:2012

References AdjustLimitedView(), Fit(), p2x(), and p2y().

Referenced by OnMouseLeftRelease().

Member Data Documentation

◆ m_axColour

wxColour mpWindow::m_axColour
protected

Definition at line 1503 of file mathplot.h.

Referenced by SetColourTheme().

◆ m_bgColour

wxColour mpWindow::m_bgColour
protected

Definition at line 1501 of file mathplot.h.

Referenced by mpWindow(), and SetColourTheme().

◆ m_buff_bmp

wxBitmap* mpWindow::m_buff_bmp
protected

Definition at line 1527 of file mathplot.h.

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

◆ m_buff_dc

wxMemoryDC mpWindow::m_buff_dc
protected

Definition at line 1526 of file mathplot.h.

Referenced by OnPaint().

◆ m_clickedX

int mpWindow::m_clickedX
protected

Definition at line 1515 of file mathplot.h.

Referenced by OnCenter(), and OnShowPopupMenu().

◆ m_clickedY

int mpWindow::m_clickedY
protected

Definition at line 1516 of file mathplot.h.

Referenced by OnCenter(), and OnShowPopupMenu().

◆ m_desiredXmax

◆ m_desiredXmin

double mpWindow::m_desiredXmin
protected

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

Definition at line 1521 of file mathplot.h.

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

◆ m_desiredYmax

◆ m_desiredYmin

◆ m_enableDoubleBuffer

bool mpWindow::m_enableDoubleBuffer
protected

Definition at line 1528 of file mathplot.h.

Referenced by mpWindow(), and OnPaint().

◆ m_enableLimitedView

bool mpWindow::m_enableLimitedView
protected

Definition at line 1531 of file mathplot.h.

Referenced by AdjustLimitedView(), and mpWindow().

◆ m_enableMouseNavigation

bool mpWindow::m_enableMouseNavigation
protected

Definition at line 1529 of file mathplot.h.

Referenced by mpWindow(), OnMouseMove(), and OnMouseWheel().

◆ m_enableMouseWheelPan

bool mpWindow::m_enableMouseWheelPan
protected

Definition at line 1530 of file mathplot.h.

Referenced by OnMouseWheel().

◆ m_enableScrollBars

bool mpWindow::m_enableScrollBars
protected

Definition at line 1534 of file mathplot.h.

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

◆ m_fgColour

wxColour mpWindow::m_fgColour
protected

Definition at line 1502 of file mathplot.h.

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

◆ m_last_lx

int mpWindow::m_last_lx
protected

Definition at line 1525 of file mathplot.h.

Referenced by mpWindow(), and OnPaint().

◆ m_last_ly

int mpWindow::m_last_ly
protected

Definition at line 1525 of file mathplot.h.

Referenced by mpWindow(), and OnPaint().

◆ m_layers

◆ m_lockaspect

bool mpWindow::m_lockaspect
protected

Definition at line 1499 of file mathplot.h.

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

◆ m_marginBottom

int mpWindow::m_marginBottom
protected

◆ m_marginLeft

int mpWindow::m_marginLeft
protected

◆ m_marginRight

int mpWindow::m_marginRight
protected

◆ m_marginTop

int mpWindow::m_marginTop
protected

◆ m_maxX

double mpWindow::m_maxX
protected

◆ m_maxY

double mpWindow::m_maxY
protected

◆ m_minX

double mpWindow::m_minX
protected

◆ m_minY

double mpWindow::m_minY
protected

◆ m_mouseLClick

wxPoint mpWindow::m_mouseLClick
protected

Definition at line 1533 of file mathplot.h.

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

◆ m_mouseMClick

wxPoint mpWindow::m_mouseMClick
protected

Definition at line 1532 of file mathplot.h.

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

◆ m_movingInfoLayer

mpInfoLayer* mpWindow::m_movingInfoLayer
protected

Definition at line 1536 of file mathplot.h.

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

◆ m_popmenu

wxMenu mpWindow::m_popmenu
protected

Definition at line 1498 of file mathplot.h.

Referenced by LockAspect(), mpWindow(), and OnShowPopupMenu().

◆ m_posX

double mpWindow::m_posX
protected

◆ m_posY

double mpWindow::m_posY
protected

◆ m_scaleX

◆ m_scaleY

◆ m_scroll

wxPoint mpWindow::m_scroll
protected

Definition at line 1535 of file mathplot.h.

◆ m_scrX

int mpWindow::m_scrX
protected

◆ m_scrY

int mpWindow::m_scrY
protected

◆ m_zooming

bool mpWindow::m_zooming
protected

Definition at line 1537 of file mathplot.h.

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

◆ m_zoomRect

wxRect mpWindow::m_zoomRect
protected

Definition at line 1538 of file mathplot.h.

Referenced by OnMouseMove(), and OnPaint().

◆ zoomIncrementalFactor

double mpWindow::zoomIncrementalFactor = 1.1
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 1348 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: