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) const
 
const mpLayerGetLayerByName (const wxString &name) const
 
mpLayerGetLayerByName (const wxString &name)
 
double GetXscl () const
 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 () const
 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 () const
 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 () const
 Counts the number of plot layers, whether or not they have a bounding box. More...
 
double GetDesiredXmin () const
 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 () const
 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 () const
 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 () const
 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) const
 Returns the bounding box coordinates. More...
 
void SetMPScrollbars (bool status)
 Enable/disable scrollbars. More...
 
bool GetMPScrollbars () const
 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 () const
 
int GetMarginRight () const
 
int GetMarginBottom () const
 
int GetMarginLeft () const
 
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) const
 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 (unsigned int position) const
 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 1046 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 1649 of file mathplot.cpp.

1654 : wxWindow( parent, id, pos, size, flag, wxT( "mathplot" ) )
1655{
1656 m_zooming = false;
1657 m_scaleX = m_scaleY = 1.0;
1658 m_posX = m_posY = 0;
1661 m_scrX = m_scrY = 64; // Fixed from m_scrX = m_scrX = 64;
1662 m_minX = m_minY = 0;
1663 m_maxX = m_maxY = 0;
1664 m_last_lx = m_last_ly = 0;
1665 m_buff_bmp = NULL;
1666 m_enableDoubleBuffer = false;
1668 m_enableLimitedView = false;
1669 m_movingInfoLayer = NULL;
1670 // Set margins to 0
1672
1673
1674 m_lockaspect = false;
1675
1676 m_popmenu.Append( mpID_CENTER, _( "Center on Cursor" ), _( "Center plot view to this position" ) );
1677 m_popmenu.Append( mpID_FIT, _( "Fit on Screen" ), _( "Set plot view to show all items" ) );
1678 m_popmenu.Append( mpID_ZOOM_IN, _( "Zoom In" ), _( "Zoom in plot view." ) );
1679 m_popmenu.Append( mpID_ZOOM_OUT, _( "Zoom Out" ), _( "Zoom out plot view." ) );
1680 // m_popmenu.AppendCheckItem( mpID_LOCKASPECT, _("Lock aspect"), _("Lock horizontal and vertical zoom aspect."));
1681 // m_popmenu.Append( mpID_HELP_MOUSE, _("Show mouse commands..."), _("Show help about the mouse commands."));
1682
1683 m_layers.clear();
1684 SetBackgroundColour( *wxWHITE );
1685 m_bgColour = *wxWHITE;
1686 m_fgColour = *wxBLACK;
1687
1688 m_enableScrollBars = false;
1689 SetSizeHints( 128, 128 );
1690
1691 // J.L.Blanco: Eliminates the "flick" with the double buffer.
1692 SetBackgroundStyle( wxBG_STYLE_CUSTOM );
1693
1694 if( wxGraphicsContext* ctx = m_buff_dc.GetGraphicsContext() )
1695 {
1696 if( !ctx->SetInterpolationQuality( wxINTERPOLATION_BEST )
1697 || !ctx->SetInterpolationQuality( wxINTERPOLATION_GOOD ) )
1698 {
1699 ctx->SetInterpolationQuality( wxINTERPOLATION_FAST );
1700 }
1701
1702 ctx->SetAntialiasMode( wxANTIALIAS_DEFAULT );
1703 }
1704
1705 UpdateAll();
1706}
double m_desiredYmin
Definition: mathplot.h:1524
mpInfoLayer * m_movingInfoLayer
Definition: mathplot.h:1539
bool m_zooming
Definition: mathplot.h:1540
double m_maxY
Definition: mathplot.h:1511
double m_posY
Definition: mathplot.h:1515
bool m_enableMouseNavigation
Definition: mathplot.h:1532
double m_desiredXmax
Definition: mathplot.h:1524
int m_last_lx
Definition: mathplot.h:1528
int m_marginLeft
Definition: mathplot.h:1526
int m_marginTop
Definition: mathplot.h:1526
double m_minY
Definition: mathplot.h:1510
wxMemoryDC m_buff_dc
Definition: mathplot.h:1529
double m_maxX
Definition: mathplot.h:1509
int m_marginBottom
Definition: mathplot.h:1526
wxColour m_bgColour
Definition: mathplot.h:1504
double m_posX
Definition: mathplot.h:1514
bool m_lockaspect
Definition: mathplot.h:1502
bool m_enableScrollBars
Definition: mathplot.h:1537
double m_scaleY
Definition: mathplot.h:1513
int m_marginRight
Definition: mathplot.h:1526
wxColour m_fgColour
Definition: mathplot.h:1505
double m_minX
Definition: mathplot.h:1508
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2437
wxLayerList m_layers
Definition: mathplot.h:1500
wxMenu m_popmenu
Definition: mathplot.h:1501
bool m_enableLimitedView
Definition: mathplot.h:1534
wxBitmap * m_buff_bmp
Definition: mathplot.h:1530
double m_desiredYmax
Definition: mathplot.h:1524
double m_desiredXmin
These are updated in Fit() only, and may be different from the real borders (layer coordinates) only ...
Definition: mathplot.h:1524
double m_scaleX
Definition: mathplot.h:1512
bool m_enableDoubleBuffer
Definition: mathplot.h:1531
int m_scrY
Definition: mathplot.h:1517
int m_scrX
Definition: mathplot.h:1516
int m_last_ly
Definition: mathplot.h:1528
#define _(s)
@ mpID_FIT
Definition: mathplot.h:115
@ mpID_ZOOM_IN
Definition: mathplot.h:116
@ mpID_CENTER
Definition: mathplot.h:118
@ mpID_ZOOM_OUT
Definition: mathplot.h:117

References _, flag, m_bgColour, m_buff_bmp, m_buff_dc, 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, and UpdateAll().

◆ ~mpWindow()

mpWindow::~mpWindow ( )

Definition at line 1709 of file mathplot.cpp.

1710{
1711 // Free all the layers:
1712 DelAllLayers( true, false );
1713
1714 if( m_buff_bmp )
1715 {
1716 delete m_buff_bmp;
1717 m_buff_bmp = NULL;
1718 }
1719}
void DelAllLayers(bool alsoDeleteObject, bool refreshDisplay=true)
Remove all layers from the plot.
Definition: mathplot.cpp:2322

References DelAllLayers(), and m_buff_bmp.

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

2279{
2280 if( layer != NULL )
2281 {
2282 m_layers.push_back( layer );
2283
2284 if( refreshDisplay )
2285 UpdateAll();
2286
2287 return true;
2288 }
2289
2290 ;
2291 return false;
2292}

References m_layers, and UpdateAll().

Referenced by SIM_PLOT_PANEL::addTrace(), SIM_PLOT_PANEL::EnableCursor(), SIM_PLOT_PANEL::SIM_PLOT_PANEL(), and SIM_PLOT_PANEL::updateAxes().

◆ AdjustLimitedView()

void mpWindow::AdjustLimitedView ( )
protected

Definition at line 2018 of file mathplot.cpp.

2019{
2020 if( !m_enableLimitedView )
2021 return;
2022
2023 // m_min and m_max are plot limits for curves
2024 // xMin, xMax, yMin, yMax are the full limits (plot limit + margin)
2025 const double xMin = m_minX - m_marginLeft / m_scaleX;
2026 const double xMax = m_maxX + m_marginRight / m_scaleX;
2027 const double yMin = m_minY - m_marginTop / m_scaleY;
2028 const double yMax = m_maxY + m_marginBottom / m_scaleY;
2029
2030 if( m_desiredXmin < xMin )
2031 {
2032 double diff = xMin - m_desiredXmin;
2033 m_posX += diff;
2034 m_desiredXmax += diff;
2035 m_desiredXmin = xMin;
2036 }
2037
2038 if( m_desiredXmax > xMax )
2039 {
2040 double diff = m_desiredXmax - xMax;
2041 m_posX -= diff;
2042 m_desiredXmin -= diff;
2043 m_desiredXmax = xMax;
2044 }
2045
2046 if( m_desiredYmin < yMin )
2047 {
2048 double diff = yMin - m_desiredYmin;
2049 m_posY += diff;
2050 m_desiredYmax += diff;
2051 m_desiredYmin = yMin;
2052 }
2053
2054 if( m_desiredYmax > yMax )
2055 {
2056 double diff = m_desiredYmax - yMax;
2057 m_posY -= diff;
2058 m_desiredYmin -= diff;
2059 m_desiredYmax = yMax;
2060 }
2061}

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

1469 {
1470 return !( m_enableLimitedView
1471 && (desiredMax > m_maxX - m_marginRight / m_scaleX
1472 || desiredMin < m_minX - m_marginLeft / m_scaleX) );
1473 }

Referenced by ZoomOut().

◆ CheckYLimits()

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

Definition at line 1475 of file mathplot.h.

1476 {
1477 return !( m_enableLimitedView
1478 && (desiredMax > m_maxY + m_marginBottom / m_scaleY
1479 || desiredMin < m_minY + m_marginTop / m_scaleY) );
1480 }

Referenced by ZoomOut().

◆ CountAllLayers()

unsigned int mpWindow::CountAllLayers ( ) const
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 1293 of file mathplot.h.

1293{ return m_layers.size(); };

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

◆ CountLayers()

unsigned int mpWindow::CountLayers ( ) const

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

2621{
2622 unsigned int layerNo = 0;
2623
2624 for( const mpLayer* layer : m_layers )
2625 {
2626 if( layer->HasBBox() )
2627 layerNo++;
2628 }
2629
2630 return layerNo;
2631}

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

2323{
2324 while( m_layers.size()>0 )
2325 {
2326 // Also delete the object?
2327 if( alsoDeleteObject )
2328 delete m_layers[0];
2329
2330 m_layers.erase( m_layers.begin() ); // this deleted the reference only
2331 }
2332
2333 if( refreshDisplay )
2334 UpdateAll();
2335}

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

2298{
2299 wxLayerList::iterator layIt;
2300
2301 for( layIt = m_layers.begin(); layIt != m_layers.end(); layIt++ )
2302 {
2303 if( *layIt == layer )
2304 {
2305 // Also delete the object?
2306 if( alsoDeleteObject )
2307 delete *layIt;
2308
2309 m_layers.erase( layIt ); // this deleted the reference only
2310
2311 if( refreshDisplay )
2312 UpdateAll();
2313
2314 return true;
2315 }
2316 }
2317
2318 return false;
2319}

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

2485{
2486 if( orientation == wxVERTICAL )
2487 {
2488 // Y axis
2489 // Get top margin in coord units
2490 double topMargin = m_marginTop / m_scaleY;
2491 // Calculate maximum Y coord to be shown in the graph
2492 double maxY = m_desiredYmax > m_maxY ? m_desiredYmax : m_maxY;
2493 // Set new position
2494 SetPosY( ( maxY - (position / m_scaleY) ) + topMargin );
2495 }
2496 else
2497 {
2498 // X Axis
2499 // Get left margin in coord units
2500 double leftMargin = m_marginLeft / m_scaleX;
2501 // Calculate minimum X coord to be shown in the graph
2502 double minX = (m_desiredXmin < m_minX) ? m_desiredXmin : m_minX;
2503 // Set new position
2504 SetPosX( ( minX + (position / m_scaleX) ) - leftMargin );
2505 }
2506}
void SetPosX(double posX)
Set current view's X position and refresh display.
Definition: mathplot.h:1169
void SetPosY(double posY)
Set current view's Y position and refresh display.
Definition: mathplot.h:1174

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

2004{
2005 // Preserve the position of the clicked point:
2006 double staticX = p2x( staticXpixel );
2007
2008 // Zoom in:
2010 // Adjust the new m_posx
2011 m_posX = staticX - (staticXpixel / m_scaleX);
2012 // Adjust desired
2015}
double p2x(wxCoord pixelCoordX)
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates,...
Definition: mathplot.h:1192
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:1351

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

◆ DoZoomOutXCalc()

void mpWindow::DoZoomOutXCalc ( const int  staticXpixel)
protected

◆ DoZoomOutYCalc()

void mpWindow::DoZoomOutYCalc ( const int  staticYpixel)
protected

◆ EnableDoubleBuffer()

void mpWindow::EnableDoubleBuffer ( bool  enabled)
inline

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

Definition at line 1212 of file mathplot.h.

1212{ m_enableDoubleBuffer = enabled; }

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

1216{ m_enableMouseNavigation = enabled; }

◆ EnableMouseWheelPan()

void mpWindow::EnableMouseWheelPan ( bool  enabled)
inline

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

Definition at line 1220 of file mathplot.h.

1220{ m_enableMouseWheelPan = enabled; }
bool m_enableMouseWheelPan
Definition: mathplot.h:1533

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

1933{
1934 if( UpdateBBox() )
1936}
virtual bool UpdateBBox()
Recalculate global layer bounding box, and save it in m_minX,...
Definition: mathplot.cpp:2426
void Fit() override
Set view to fit global bounding box of all plot layers and refresh display.
Definition: mathplot.cpp:1932

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

Referenced by Fit(), 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 1940 of file mathplot.cpp.

1942{
1943 // Save desired borders:
1944 m_desiredXmin = xMin; m_desiredXmax = xMax;
1945 m_desiredYmin = yMin; m_desiredYmax = yMax;
1946
1947 // Give a small margin to plot area
1948 double xExtra = fabs( xMax - xMin ) * 0.00;
1949 double yExtra = fabs( yMax - yMin ) * 0.03;
1950
1951 xMin -= xExtra;
1952 xMax += xExtra;
1953 yMin -= yExtra;
1954 yMax += yExtra;
1955
1956 if( printSizeX != NULL && printSizeY != NULL )
1957 {
1958 // Printer:
1959 m_scrX = *printSizeX;
1960 m_scrY = *printSizeY;
1961 }
1962 else
1963 {
1964 // Normal case (screen):
1965 GetClientSize( &m_scrX, &m_scrY );
1966 }
1967
1968 double Ax, Ay;
1969
1970 Ax = xMax - xMin;
1971 Ay = yMax - yMin;
1972
1973 m_scaleX = (Ax != 0) ? (m_scrX - m_marginLeft - m_marginRight) / Ax : 1; // m_scaleX = (Ax != 0) ? m_scrX / Ax : 1;
1974 m_scaleY = (Ay != 0) ? (m_scrY - m_marginTop - m_marginBottom) / Ay : 1; // m_scaleY = (Ay != 0) ? m_scrY / Ay : 1;
1975
1976 if( m_lockaspect )
1977 {
1978 // Keep the lowest "scale" to fit the whole range required by that axis (to actually
1979 // "fit"!):
1980 double s = m_scaleX < m_scaleY ? m_scaleX : m_scaleY;
1981 m_scaleX = s;
1982 m_scaleY = s;
1983 }
1984
1985 // Adjusts corner coordinates: This should be simply:
1986 // m_posX = m_minX;
1987 // m_posY = m_maxY;
1988 // But account for centering if we have lock aspect:
1989 m_posX = (xMin + xMax) / 2 - ( (m_scrX - m_marginLeft - m_marginRight) / 2 + m_marginLeft ) /
1990 m_scaleX; // m_posX = (xMin+xMax)/2 - (m_scrX/2)/m_scaleX;
1991 // 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;
1992 m_posY = (yMin + yMax) / 2 + ( (m_scrY - m_marginTop - m_marginBottom) / 2 + m_marginTop ) /
1993 m_scaleY; // m_posY = (yMin+yMax)/2 + (m_scrY/2)/m_scaleY;
1994
1995 // It is VERY IMPORTANT to DO NOT call Refresh if we are drawing to the printer!!
1996 // Otherwise, the DC dimensions will be those of the window instead of the printer device
1997 if( printSizeX == NULL || printSizeY == NULL )
1998 UpdateAll();
1999}

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

◆ GetAxesColour()

const wxColour & mpWindow::GetAxesColour ( )
inline

Get axes draw colour.

Returns
reference to axis colour used in theme

Definition at line 1426 of file mathplot.h.

1426{ return m_axColour; };
wxColour m_axColour
Definition: mathplot.h:1506

Referenced by mpPrintout::OnPrintPage().

◆ GetBoundingBox()

void mpWindow::GetBoundingBox ( double *  bbox) const

Returns the bounding box coordinates.

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

Definition at line 2655 of file mathplot.cpp.

2656{
2657 bbox[0] = m_minX;
2658 bbox[1] = m_maxX;
2659 bbox[2] = m_minY;
2660 bbox[3] = m_maxY;
2661}

References m_maxX, m_maxY, m_minX, and m_minY.

◆ GetDesiredXmax()

double mpWindow::GetDesiredXmax ( ) const
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 1312 of file mathplot.h.

1312{ return m_desiredXmax; }

Referenced by mpPrintout::OnPrintPage().

◆ GetDesiredXmin()

double mpWindow::GetDesiredXmin ( ) const
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 1306 of file mathplot.h.

1306{ return m_desiredXmin; }

Referenced by mpPrintout::OnPrintPage().

◆ GetDesiredYmax()

double mpWindow::GetDesiredYmax ( ) const
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 1324 of file mathplot.h.

1324{ return m_desiredYmax; }

Referenced by mpPrintout::OnPrintPage().

◆ GetDesiredYmin()

double mpWindow::GetDesiredYmin ( ) const
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 1318 of file mathplot.h.

1318{ return m_desiredYmin; }

Referenced by mpPrintout::OnPrintPage().

◆ GetLayer()

mpLayer * mpWindow::GetLayer ( int  position) const

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

2635{
2636 if( ( position >= (int) m_layers.size() ) || position < 0 )
2637 return NULL;
2638
2639 return m_layers[position];
2640}

References m_layers.

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

◆ GetLayerByName() [1/2]

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

Definition at line 1099 of file mathplot.h.

1100 {
1101 return const_cast<mpLayer*>( static_cast<const mpWindow*>( this )->GetLayerByName( name ) );
1102 }
const char * name
Definition: DXF_plotter.cpp:56
Canvas for plotting mpLayer implementations.
Definition: mathplot.h:1047
const mpLayer * GetLayerByName(const wxString &name) const
Definition: mathplot.cpp:2643

References name.

◆ GetLayerByName() [2/2]

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

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

2644{
2645 for( const mpLayer* layer : m_layers )
2646 {
2647 if( !layer->GetName().Cmp( name ) )
2648 return layer;
2649 }
2650
2651 return NULL; // Not found
2652}

References m_layers, and name.

Referenced by IsLayerVisible(), and SetLayerVisible().

◆ GetMarginBottom()

int mpWindow::GetMarginBottom ( ) const
inline

◆ GetMarginLeft()

int mpWindow::GetMarginLeft ( ) const
inline

◆ GetMarginRight()

int mpWindow::GetMarginRight ( ) const
inline

◆ GetMarginTop()

int mpWindow::GetMarginTop ( ) const
inline

◆ GetMPScrollbars()

bool mpWindow::GetMPScrollbars ( ) const
inline

Get scrollbars status.

Returns
true if scrollbars are visible

Definition at line 1337 of file mathplot.h.

1337{ return m_enableScrollBars; };

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

1059{ return &m_popmenu; }

◆ GetPosX()

double mpWindow::GetPosX ( void  ) const
inline

Definition at line 1123 of file mathplot.h.

1123{ return m_posX; }

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

◆ GetPosY()

double mpWindow::GetPosY ( void  ) const
inline

Definition at line 1130 of file mathplot.h.

1130{ return m_posY; }

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

◆ GetScaleX()

double mpWindow::GetScaleX ( void  ) const
inline

Definition at line 1109 of file mathplot.h.

1109{ return m_scaleX; }; // Schaling's method: maybe another method exists with the same name

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

◆ GetScaleY()

double mpWindow::GetScaleY ( void  ) const
inline

Definition at line 1116 of file mathplot.h.

1116{ return m_scaleY; } // Schaling's method: maybe another method exists with the same name

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

1138{ return m_scrX; }

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

1147{ return m_scrY; }

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

1122{ return m_posX; }

◆ GetXscl()

double mpWindow::GetXscl ( ) const
inline

Get current view's X scale.

See rules for coordinate transformation

Returns
Scale

Definition at line 1108 of file mathplot.h.

1108{ return m_scaleX; }

◆ GetXScreen()

int mpWindow::GetXScreen ( void  ) const
inline

Definition at line 1139 of file mathplot.h.

1139{ return m_scrX; }

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

1129{ return m_posY; }

◆ GetYscl()

double mpWindow::GetYscl ( ) const
inline

Get current view's Y scale.

See rules for coordinate transformation

Returns
Scale

Definition at line 1115 of file mathplot.h.

1115{ return m_scaleY; }

◆ GetYScreen()

int mpWindow::GetYScreen ( void  ) const
inline

Definition at line 1148 of file mathplot.h.

1148{ return m_scrY; }

◆ IsAspectLocked()

bool mpWindow::IsAspectLocked ( ) const
inline

Checks whether the X/Y scale aspect is locked.

Return values
trueLocked
falseUnlocked

Definition at line 1233 of file mathplot.h.

1233{ return m_lockaspect; }

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

2726{
2727 for( mpLayer* layer : m_layers )
2728 {
2729 if( layer->IsInfo() )
2730 {
2731 mpInfoLayer* tmpLyr = static_cast<mpInfoLayer*>( layer );
2732
2733 if( tmpLyr->Inside( point ) )
2734 return tmpLyr;
2735 }
2736 }
2737
2738 return NULL;
2739}
Base class to create small rectangular info boxes mpInfoLayer is the base class to create a small rec...
Definition: mathplot.h:336
virtual bool Inside(wxPoint &point)
Checks whether a point is inside the info box rectangle.
Definition: mathplot.cpp:127

References mpInfoLayer::Inside(), and m_layers.

Referenced by OnMouseLeftDown().

◆ IsLayerVisible() [1/2]

bool mpWindow::IsLayerVisible ( const wxString &  name) const

Check whether a layer with given name is visible.

Parameters
nameThe layer name
Returns
layer visibility status

Definition at line 2754 of file mathplot.cpp.

2755{
2756 const mpLayer* lx = GetLayerByName( name );
2757
2758 return lx ? lx->IsVisible() : false;
2759}
bool IsVisible() const
Checks whether the layer is visible or not.
Definition: mathplot.h:298

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

◆ IsLayerVisible() [2/2]

bool mpWindow::IsLayerVisible ( unsigned int  position) const

Check whether the layer at given position is visible.

Parameters
positionThe layer position in layer list
Returns
layer visibility status

Definition at line 2774 of file mathplot.cpp.

2775{
2776 mpLayer* lx = GetLayer( position );
2777
2778 return (lx) ? lx->IsVisible() : false;
2779}
mpLayer * GetLayer(int position) const
Definition: mathplot.cpp:2634

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

1430 {
1431 m_enableLimitedView = aEnable;
1432 }

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

2220{
2221 m_lockaspect = enable;
2222 m_popmenu.Check( mpID_LOCKASPECT, enable );
2223
2224 // Try to fit again with the new config:
2226}
@ mpID_LOCKASPECT
Definition: mathplot.h:119

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

2250{
2251 GetClientSize( &m_scrX, &m_scrY );
2252 int centerX = (m_scrX - m_marginLeft - m_marginRight) / 2; // + m_marginLeft; // c.x = m_scrX/2;
2253 int centerY = (m_scrY - m_marginTop - m_marginBottom) / 2; // - m_marginTop; // c.y = m_scrY/2;
2254 SetPos( p2x( m_clickedX - centerX ), p2y( m_clickedY - centerY ) );
2255 // 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);
2256}
double p2y(wxCoord pixelCoordY)
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates,...
Definition: mathplot.h:1197
int m_clickedY
Definition: mathplot.h:1519
int m_clickedX
Definition: mathplot.h:1518
void SetPos(double posX, double posY)
Set current view's X and Y position and refresh display.
Definition: mathplot.h:1180

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

2244{
2245 Fit();
2246}

References Fit().

◆ OnLockAspect()

void mpWindow::OnLockAspect ( wxCommandEvent &  event)
protected

Definition at line 2237 of file mathplot.cpp.

2238{
2240}
void LockAspect(bool enable=true)
Enable or disable X/Y scale aspect locking for the view.
Definition: mathplot.cpp:2219

References LockAspect(), and m_lockaspect.

◆ OnMagnify()

void mpWindow::OnMagnify ( wxMouseEvent &  event)
protected

◆ OnMouseLeftDown()

void mpWindow::OnMouseLeftDown ( wxMouseEvent &  event)
protected

Definition at line 1898 of file mathplot.cpp.

1899{
1900 m_mouseLClick.x = event.GetX();
1901 m_mouseLClick.y = event.GetY();
1902 m_zooming = true;
1903 wxPoint pointClicked = event.GetPosition();
1904 m_movingInfoLayer = IsInsideInfoLayer( pointClicked );
1905
1906 event.Skip();
1907}
wxPoint m_mouseLClick
Definition: mathplot.h:1536
mpInfoLayer * IsInsideInfoLayer(wxPoint &point)
Check if a given point is inside the area of a mpInfoLayer and eventually returns its pointer.
Definition: mathplot.cpp:2725

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

◆ OnMouseLeftRelease()

void mpWindow::OnMouseLeftRelease ( wxMouseEvent &  event)
protected

Definition at line 1910 of file mathplot.cpp.

1911{
1912 wxPoint release( event.GetX(), event.GetY() );
1913 wxPoint press( m_mouseLClick.x, m_mouseLClick.y );
1914
1915 m_zooming = false;
1916
1917 if( m_movingInfoLayer != NULL )
1918 {
1920 m_movingInfoLayer = NULL;
1921 }
1922 else
1923 {
1924 if( release != press )
1925 ZoomRect( press, release );
1926 }
1927
1928 event.Skip();
1929}
virtual void UpdateReference()
Updates the rectangle reference point.
Definition: mathplot.cpp:140
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:2200

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

◆ OnMouseMiddleDown()

void mpWindow::OnMouseMiddleDown ( wxMouseEvent &  event)
protected

Definition at line 1724 of file mathplot.cpp.

1725{
1726 m_mouseMClick.x = event.GetX();
1727 m_mouseMClick.y = event.GetY();
1728}
wxPoint m_mouseMClick
Definition: mathplot.h:1535

References m_mouseMClick.

◆ OnMouseMove()

void mpWindow::OnMouseMove ( wxMouseEvent &  event)
protected

Definition at line 1807 of file mathplot.cpp.

1808{
1810 {
1811 event.Skip();
1812 return;
1813 }
1814
1815 if( event.m_middleDown )
1816 {
1817 // The change:
1818 int Ax = m_mouseMClick.x - event.GetX();
1819 int Ay = m_mouseMClick.y - event.GetY();
1820
1821 // For the next event, use relative to this coordinates.
1822 m_mouseMClick.x = event.GetX();
1823 m_mouseMClick.y = event.GetY();
1824
1825 double Ax_units = Ax / m_scaleX;
1826 double Ay_units = -Ay / m_scaleY;
1827
1828 bool updateRequired = false;
1829 updateRequired |= SetXView( m_posX + Ax_units,
1830 m_desiredXmax + Ax_units,
1831 m_desiredXmin + Ax_units );
1832 updateRequired |= SetYView( m_posY + Ay_units,
1833 m_desiredYmax + Ay_units,
1834 m_desiredYmin + Ay_units );
1835
1836 if( updateRequired )
1837 UpdateAll();
1838 }
1839 else
1840 {
1841 if( event.m_leftDown )
1842 {
1843 if( m_movingInfoLayer == NULL )
1844 {
1845 wxClientDC dc( this );
1846 wxPen pen( m_fgColour, 1, wxPENSTYLE_DOT );
1847 dc.SetPen( pen );
1848 dc.SetBrush( *wxTRANSPARENT_BRUSH );
1849 dc.DrawRectangle( m_mouseLClick.x, m_mouseLClick.y,
1850 event.GetX() - m_mouseLClick.x, event.GetY() - m_mouseLClick.y );
1851 m_zooming = true;
1854 m_zoomRect.width = event.GetX() - m_mouseLClick.x;
1855 m_zoomRect.height = event.GetY() - m_mouseLClick.y;
1856 }
1857 else
1858 {
1859 wxPoint moveVector( event.GetX() - m_mouseLClick.x, event.GetY() - m_mouseLClick.y );
1860 m_movingInfoLayer->Move( moveVector );
1861 m_zooming = false;
1862 }
1863
1864 UpdateAll();
1865 }
1866 else
1867 {
1868#if 0
1869 wxLayerList::iterator li;
1870
1871 for( li = m_layers.begin(); li != m_layers.end(); li++ )
1872 {
1873 if( (*li)->IsInfo() && (*li)->IsVisible() )
1874 {
1875 mpInfoLayer* tmpLyr = (mpInfoLayer*) (*li);
1876 tmpLyr->UpdateInfo( *this, event );
1877 // UpdateAll();
1878 RefreshRect( tmpLyr->GetRectangle() );
1879 }
1880 }
1881
1882#endif
1883 /* if (m_coordTooltip) {
1884 * wxString toolTipContent;
1885 * toolTipContent.Printf( "X = %f\nY = %f", p2x(event.GetX()), p2y(event.GetY()));
1886 * wxTipWindow** ptr = NULL;
1887 * wxRect rectBounds(event.GetX(), event.GetY(), 5, 5);
1888 * wxTipWindow* tip = new wxTipWindow(this, toolTipContent, 100, ptr, &rectBounds);
1889 *
1890 * } */
1891 }
1892 }
1893
1894 event.Skip();
1895}
const wxRect & GetRectangle() const
Returns the current rectangle coordinates.
Definition: mathplot.h:392
virtual void UpdateInfo(mpWindow &w, wxEvent &event)
Updates the content of the info box.
Definition: mathplot.cpp:122
virtual void Move(wxPoint delta)
Moves the layer rectangle of given pixel deltas.
Definition: mathplot.cpp:133
virtual bool SetYView(double pos, double desiredMax, double desiredMin)
Applies new Y view coordinates depending on the settings.
Definition: mathplot.cpp:2078
wxRect m_zoomRect
Definition: mathplot.h:1541
virtual bool SetXView(double pos, double desiredMax, double desiredMin)
Applies new X view coordinates depending on the settings.
Definition: mathplot.cpp:2064

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

◆ OnMouseWheel()

void mpWindow::OnMouseWheel ( wxMouseEvent &  event)
protected

Definition at line 1752 of file mathplot.cpp.

1753{
1755 {
1756 event.Skip();
1757 return;
1758 }
1759
1760 int change = event.GetWheelRotation();
1761 const int axis = event.GetWheelAxis();
1762 double changeUnitsX = change / m_scaleX;
1763 double changeUnitsY = change / m_scaleY;
1764
1765 if( ( !m_enableMouseWheelPan && ( event.ControlDown() || event.ShiftDown() ) )
1766 || ( m_enableMouseWheelPan && !event.ControlDown() ) )
1767 {
1768 // Scrolling
1770 {
1771 if( axis == wxMOUSE_WHEEL_HORIZONTAL || event.ShiftDown() )
1772 SetXView( m_posX + changeUnitsX, m_desiredXmax + changeUnitsX,
1773 m_desiredXmin + changeUnitsX );
1774 else
1775 SetYView( m_posY + changeUnitsY, m_desiredYmax + changeUnitsY,
1776 m_desiredYmin + changeUnitsY );
1777 }
1778 else
1779 {
1780 if( event.ControlDown() )
1781 SetXView( m_posX + changeUnitsX, m_desiredXmax + changeUnitsX,
1782 m_desiredXmin + changeUnitsX );
1783 else
1784 SetYView( m_posY + changeUnitsY, m_desiredYmax + changeUnitsY,
1785 m_desiredYmin + changeUnitsY );
1786 }
1787
1788 UpdateAll();
1789 }
1790 else
1791 {
1792 // zoom in/out
1793 wxPoint clickPt( event.GetX(), event.GetY() );
1794
1795 if( event.GetWheelRotation() > 0 )
1796 ZoomIn( clickPt );
1797 else
1798 ZoomOut( clickPt );
1799
1800 return;
1801 }
1802}
void ZoomIn(const wxPoint &centerPoint=wxDefaultPosition)
Zoom into current view and refresh display.
Definition: mathplot.cpp:2092
void ZoomOut(const wxPoint &centerPoint=wxDefaultPosition)
Zoom out current view and refresh display.
Definition: mathplot.cpp:2149

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

2339{
2340 wxPaintDC dc( this );
2341
2342 dc.GetSize( &m_scrX, &m_scrY ); // This is the size of the visible area only!
2343
2344 // Selects direct or buffered draw:
2345 wxDC* trgDc;
2346
2347 // J.L.Blanco @ Aug 2007: Added double buffer support
2349 {
2350 if( m_last_lx != m_scrX || m_last_ly != m_scrY )
2351 {
2352 if( m_buff_bmp )
2353 delete m_buff_bmp;
2354
2355 m_buff_bmp = new wxBitmap( m_scrX, m_scrY );
2356 m_buff_dc.SelectObject( *m_buff_bmp );
2357 m_last_lx = m_scrX;
2358 m_last_ly = m_scrY;
2359 }
2360
2361 trgDc = &m_buff_dc;
2362 }
2363 else
2364 {
2365 trgDc = &dc;
2366 }
2367
2368 // Draw background:
2369 // trgDc->SetDeviceOrigin(0,0);
2370
2371 if( wxGraphicsContext* ctx = trgDc->GetGraphicsContext() )
2372 {
2373 if( !ctx->SetInterpolationQuality( wxINTERPOLATION_BEST )
2374 || !ctx->SetInterpolationQuality( wxINTERPOLATION_GOOD ) )
2375 {
2376 ctx->SetInterpolationQuality( wxINTERPOLATION_FAST );
2377 }
2378
2379 ctx->SetAntialiasMode( wxANTIALIAS_DEFAULT );
2380 }
2381
2382 trgDc->SetPen( *wxTRANSPARENT_PEN );
2383 wxBrush brush( GetBackgroundColour() );
2384 trgDc->SetBrush( brush );
2385 trgDc->SetTextForeground( m_fgColour );
2386 trgDc->DrawRectangle( 0, 0, m_scrX, m_scrY );
2387
2388 // Draw all the layers:
2389 // trgDc->SetDeviceOrigin( m_scrX>>1, m_scrY>>1); // Origin at the center
2390 wxLayerList::iterator li;
2391
2392 for( li = m_layers.begin(); li != m_layers.end(); li++ )
2393 (*li)->Plot( *trgDc, *this );
2394
2395 if( m_zooming )
2396 {
2397 wxPen pen( m_fgColour, 1, wxPENSTYLE_DOT );
2398 trgDc->SetPen( pen );
2399 trgDc->SetBrush( *wxTRANSPARENT_BRUSH );
2400 trgDc->DrawRectangle( m_zoomRect );
2401 }
2402
2403 // If doublebuffer, draw now to the window:
2405 {
2406 // trgDc->SetDeviceOrigin(0,0);
2407 // dc.SetDeviceOrigin(0,0); // Origin at the center
2408 dc.Blit( 0, 0, m_scrX, m_scrY, trgDc, 0, 0 );
2409 }
2410
2411 // If scrollbars are enabled, refresh them
2412 if( m_enableScrollBars )
2413 {
2414 /* m_scroll.x = (int) floor((m_posX - m_minX)*m_scaleX);
2415 * m_scroll.y = (int) floor((m_maxY - m_posY )*m_scaleY);
2416 * Scroll(m_scroll.x, m_scroll.y);*/
2417 // Scroll(x2p(m_posX), y2p(m_posY));
2418 // SetVirtualSize((int) ((m_maxX - m_minX)*m_scaleX), (int) ((m_maxY - m_minY)*m_scaleY));
2419 // int centerX = (m_scrX - m_marginLeft - m_marginRight)/2; // + m_marginLeft; // c.x = m_scrX/2;
2420 // int centerY = (m_scrY - m_marginTop - m_marginBottom)/2; // - m_marginTop; // c.y = m_scrY/2;
2421 /*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);
2422 }
2423}

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

2596{
2597 int scrollOrientation = event.GetOrientation();
2598 // Get thumb size
2599 int thumbSize = GetScrollThumb( scrollOrientation );
2600 // Get scroll range
2601 int scrollRange = GetScrollRange( scrollOrientation );
2602
2603 DoScrollCalc( scrollRange - thumbSize, scrollOrientation );
2604}
void DoScrollCalc(const int position, const int orientation)
Definition: mathplot.cpp:2484

References DoScrollCalc().

◆ OnScrollLineDown()

void mpWindow::OnScrollLineDown ( wxScrollWinEvent &  event)
protected

Definition at line 2569 of file mathplot.cpp.

2570{
2571 int scrollOrientation = event.GetOrientation();
2572 // Get position before page up
2573 int position = GetScrollPos( scrollOrientation );
2574 // Get thumb size
2575 int thumbSize = GetScrollThumb( scrollOrientation );
2576 // Get scroll range
2577 int scrollRange = GetScrollRange( scrollOrientation );
2578
2579 // Need to adjust position by a page
2580 position += mpSCROLL_NUM_PIXELS_PER_LINE;
2581
2582 if( position > (scrollRange - thumbSize) )
2583 position = scrollRange - thumbSize;
2584
2585 DoScrollCalc( position, scrollOrientation );
2586}
#define mpSCROLL_NUM_PIXELS_PER_LINE
Definition: mathplot.cpp:53

References DoScrollCalc(), and mpSCROLL_NUM_PIXELS_PER_LINE.

◆ OnScrollLineUp()

void mpWindow::OnScrollLineUp ( wxScrollWinEvent &  event)
protected

Definition at line 2553 of file mathplot.cpp.

2554{
2555 int scrollOrientation = event.GetOrientation();
2556 // Get position before page up
2557 int position = GetScrollPos( scrollOrientation );
2558
2559 // Need to adjust position by a line
2560 position -= mpSCROLL_NUM_PIXELS_PER_LINE;
2561
2562 if( position < 0 )
2563 position = 0;
2564
2565 DoScrollCalc( position, scrollOrientation );
2566}

References DoScrollCalc(), and mpSCROLL_NUM_PIXELS_PER_LINE.

◆ OnScrollPageDown()

void mpWindow::OnScrollPageDown ( wxScrollWinEvent &  event)
protected

Definition at line 2533 of file mathplot.cpp.

2534{
2535 int scrollOrientation = event.GetOrientation();
2536 // Get position before page up
2537 int position = GetScrollPos( scrollOrientation );
2538 // Get thumb size
2539 int thumbSize = GetScrollThumb( scrollOrientation );
2540 // Get scroll range
2541 int scrollRange = GetScrollRange( scrollOrientation );
2542
2543 // Need to adjust position by a page
2544 position += thumbSize;
2545
2546 if( position > (scrollRange - thumbSize) )
2547 position = scrollRange - thumbSize;
2548
2549 DoScrollCalc( position, scrollOrientation );
2550}

References DoScrollCalc().

◆ OnScrollPageUp()

void mpWindow::OnScrollPageUp ( wxScrollWinEvent &  event)
protected

Definition at line 2515 of file mathplot.cpp.

2516{
2517 int scrollOrientation = event.GetOrientation();
2518 // Get position before page up
2519 int position = GetScrollPos( scrollOrientation );
2520 // Get thumb size
2521 int thumbSize = GetScrollThumb( scrollOrientation );
2522
2523 // Need to adjust position by a page
2524 position -= thumbSize;
2525
2526 if( position < 0 )
2527 position = 0;
2528
2529 DoScrollCalc( position, scrollOrientation );
2530}

References DoScrollCalc().

◆ OnScrollThumbTrack()

void mpWindow::OnScrollThumbTrack ( wxScrollWinEvent &  event)
protected

Definition at line 2509 of file mathplot.cpp.

2510{
2511 DoScrollCalc( event.GetPosition(), event.GetOrientation() );
2512}

References DoScrollCalc().

◆ OnScrollTop()

void mpWindow::OnScrollTop ( wxScrollWinEvent &  event)
protected

Definition at line 2589 of file mathplot.cpp.

2590{
2591 DoScrollCalc( 0, event.GetOrientation() );
2592}

References DoScrollCalc().

◆ OnShowPopupMenu()

void mpWindow::OnShowPopupMenu ( wxMouseEvent &  event)
protected

Definition at line 2229 of file mathplot.cpp.

2230{
2231 m_clickedX = event.GetX();
2232 m_clickedY = event.GetY();
2233 PopupMenu( &m_popmenu, event.GetX(), event.GetY() );
2234}

References m_clickedX, m_clickedY, and m_popmenu.

◆ OnSize()

void mpWindow::OnSize ( wxSizeEvent &  event)
protected

Definition at line 2271 of file mathplot.cpp.

2272{
2273 // Try to fit again with the new window size:
2275}

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

◆ OnZoomIn()

void mpWindow::OnZoomIn ( wxCommandEvent &  event)
protected

Definition at line 2259 of file mathplot.cpp.

2260{
2261 ZoomIn( wxPoint( m_mouseMClick.x, m_mouseMClick.y ) );
2262}

References m_mouseMClick, and ZoomIn().

◆ OnZoomOut()

void mpWindow::OnZoomOut ( wxCommandEvent &  event)
protected

Definition at line 2265 of file mathplot.cpp.

2266{
2267 ZoomOut();
2268}

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

1192{ return m_posX + pixelCoordX / m_scaleX; }

Referenced by DoZoomInXCalc(), 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 1197 of file mathplot.h.

1197{ return m_posY - pixelCoordY / m_scaleY; }

Referenced by 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 2664 of file mathplot.cpp.

2666{
2667 int sizeX, sizeY;
2668 int bk_scrX, bk_scrY;
2669
2670 if( imageSize == wxDefaultSize )
2671 {
2672 sizeX = m_scrX;
2673 sizeY = m_scrY;
2674 }
2675 else
2676 {
2677 sizeX = imageSize.x;
2678 sizeY = imageSize.y;
2679 bk_scrX = m_scrX;
2680 bk_scrY = m_scrY;
2681 SetScr( sizeX, sizeY );
2682 }
2683
2684 wxBitmap screenBuffer( sizeX, sizeY );
2685 wxMemoryDC screenDC;
2686 screenDC.SelectObject( screenBuffer );
2687 screenDC.SetPen( *wxWHITE_PEN );
2688 screenDC.SetTextForeground( m_fgColour );
2689 wxBrush brush( GetBackgroundColour() );
2690 screenDC.SetBrush( brush );
2691 screenDC.DrawRectangle( 0, 0, sizeX, sizeY );
2692
2693 if( fit )
2694 Fit( m_minX, m_maxX, m_minY, m_maxY, &sizeX, &sizeY );
2695 else
2697
2698 // Draw all the layers:
2699 for( mpLayer* layer : m_layers )
2700 layer->Plot( screenDC, *this );
2701
2702 if( imageSize != wxDefaultSize )
2703 {
2704 // Restore dimensions
2705 SetScr( bk_scrX, bk_scrY );
2706 Fit( m_desiredXmin, m_desiredXmax, m_desiredYmin, m_desiredYmax, &bk_scrX, &bk_scrY );
2707 UpdateAll();
2708 }
2709
2710 // Once drawing is complete, actually save screen shot
2711 wxImage screenImage = screenBuffer.ConvertToImage();
2712 return screenImage.SaveFile( filename, type );
2713}
void SetScr(int scrX, int scrY)
Set current view's dimensions in device context units.
Definition: mathplot.h:1187

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

2784{
2785 SetBackgroundColour( bgColour );
2786 SetForegroundColour( drawColour );
2787 m_bgColour = bgColour;
2788 m_fgColour = drawColour;
2789 m_axColour = axesColour;
2790
2791 // Cycle between layers to set colours and properties to them
2792 for( mpLayer* layer : m_layers )
2793 {
2794 if( layer->GetLayerType() == mpLAYER_AXIS )
2795 {
2796 wxPen axisPen = layer->GetPen(); // Get the old pen to modify only colour, not style or width
2797 axisPen.SetColour( axesColour );
2798 layer->SetPen( axisPen );
2799 }
2800
2801 if( layer->GetLayerType() == mpLAYER_INFO )
2802 {
2803 wxPen infoPen = layer->GetPen(); // Get the old pen to modify only colour, not style or width
2804 infoPen.SetColour( drawColour );
2805 layer->SetPen( infoPen );
2806 }
2807 }
2808}
@ mpLAYER_INFO
Definition: mathplot.h:131
@ mpLAYER_AXIS
Definition: mathplot.h:129

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

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

◆ SetLayerVisible() [1/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 2762 of file mathplot.cpp.

2763{
2764 mpLayer* lx = GetLayer( position );
2765
2766 if( lx )
2767 {
2768 lx->SetVisible( viewable );
2769 UpdateAll();
2770 }
2771}
void SetVisible(bool show)
Sets layer visibility.
Definition: mathplot.h:302

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

◆ SetLayerVisible() [2/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 2742 of file mathplot.cpp.

2743{
2744 mpLayer* lx = GetLayerByName( name );
2745
2746 if( lx )
2747 {
2748 lx->SetVisible( viewable );
2749 UpdateAll();
2750 }
2751}

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

◆ SetMarginBottom()

void mpWindow::SetMarginBottom ( int  bottom)
inline

Set the bottom margin.

Parameters
bottomBottom Margin

Definition at line 1366 of file mathplot.h.

1366{ m_marginBottom = bottom; };

◆ SetMarginLeft()

void mpWindow::SetMarginLeft ( int  left)
inline

Set the left margin.

Parameters
leftLeft Margin

Definition at line 1368 of file mathplot.h.

1368{ m_marginLeft = left; };

References left.

◆ SetMarginRight()

void mpWindow::SetMarginRight ( int  right)
inline

Set the right margin.

Parameters
rightRight Margin

Definition at line 1364 of file mathplot.h.

1364{ m_marginRight = right; };

References right.

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

2717{
2718 m_marginTop = top;
2720 m_marginBottom = bottom;
2722}

References left, m_marginBottom, m_marginLeft, m_marginRight, m_marginTop, and right.

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

1362{ m_marginTop = top; };

◆ SetMPScrollbars()

void mpWindow::SetMPScrollbars ( bool  status)

Enable/disable scrollbars.

Parameters
statusSet to true to show scrollbars

◆ SetPos()

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

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

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

Definition at line 1180 of file mathplot.h.

1180{ m_posX = posX; m_posY = posY; UpdateAll(); }

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

1169{ m_posX = posX; UpdateAll(); }

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

1174{ m_posY = posY; UpdateAll(); }

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

2610{
2611 if( scaleX != 0 )
2612 m_scaleX = scaleX;
2613
2614 UpdateAll();
2615}

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

1159 {
1160 if( scaleY != 0 )
1161 m_scaleY = scaleY;
1162
1163 UpdateAll();
1164 }

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

1187{ m_scrX = scrX; m_scrY = scrY; }

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

2065{
2066 // if(!CheckXLimits(desiredMax, desiredMin))
2067 // return false;
2068
2069 m_posX = pos;
2070 m_desiredXmax = desiredMax;
2071 m_desiredXmin = desiredMin;
2073
2074 return true;
2075}
void AdjustLimitedView()
Definition: mathplot.cpp:2018

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

2079{
2080 // if(!CheckYLimits(desiredMax, desiredMin))
2081 // return false;
2082
2083 m_posY = pos;
2084 m_desiredYmax = desiredMax;
2085 m_desiredYmin = desiredMin;
2087
2088 return true;
2089}

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

Referenced by OnMouseMove(), and OnMouseWheel().

◆ UpdateAll()

void mpWindow::UpdateAll ( )

Refresh display.

Definition at line 2437 of file mathplot.cpp.

2438{
2439 if( UpdateBBox() )
2440 {
2441 if( m_enableScrollBars )
2442 {
2443 int cx, cy;
2444 GetClientSize( &cx, &cy );
2445 // Do x scroll bar
2446 {
2447 // Convert margin sizes from pixels to coordinates
2448 double leftMargin = m_marginLeft / m_scaleX;
2449 // Calculate the range in coords that we want to scroll over
2450 double maxX = (m_desiredXmax > m_maxX) ? m_desiredXmax : m_maxX;
2451 double minX = (m_desiredXmin < m_minX) ? m_desiredXmin : m_minX;
2452
2453 if( (m_posX + leftMargin) < minX )
2454 minX = m_posX + leftMargin;
2455
2456 // Calculate scroll bar size and thumb position
2457 int sizeX = (int) ( (maxX - minX) * m_scaleX );
2458 int thumbX = (int) ( ( (m_posX + leftMargin) - minX ) * m_scaleX );
2459 SetScrollbar( wxHORIZONTAL, thumbX, cx - (m_marginRight + m_marginLeft), sizeX );
2460 }
2461 // Do y scroll bar
2462 {
2463 // Convert margin sizes from pixels to coordinates
2464 double topMargin = m_marginTop / m_scaleY;
2465 // Calculate the range in coords that we want to scroll over
2466 double maxY = (m_desiredYmax > m_maxY) ? m_desiredYmax : m_maxY;
2467
2468 if( (m_posY - topMargin) > maxY )
2469 maxY = m_posY - topMargin;
2470
2471 double minY = (m_desiredYmin < m_minY) ? m_desiredYmin : m_minY;
2472 // Calculate scroll bar size and thumb position
2473 int sizeY = (int) ( (maxY - minY) * m_scaleY );
2474 int thumbY = (int) ( ( maxY - (m_posY - topMargin) ) * m_scaleY );
2475 SetScrollbar( wxVERTICAL, thumbY, cy - (m_marginTop + m_marginBottom), sizeY );
2476 }
2477 }
2478 }
2479
2480 Refresh( false );
2481}
void Refresh()
Update the board display after modifying it by a python script (note: it is automatically called by a...

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(), SetScaleX(), SIM_PLOT_PANEL::ShowGrid(), SIM_PLOT_PANEL::ShowLegend(), SIM_PLOT_PANEL::SIM_PLOT_PANEL(), SIM_PLOT_PANEL::UpdatePlotColors(), ZoomIn(), ZoomInX(), and ZoomOut().

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

2427{
2428 m_minX = 0.0;
2429 m_maxX = 1.0;
2430 m_minY = 0.0;
2431 m_maxY = 1.0;
2432
2433 return true;
2434}

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

1202{ return (wxCoord) ( (x - m_posX) * m_scaleX ); }

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

1207{ return (wxCoord) ( (m_posY - y) * m_scaleY ); }

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,
double  zoomFactor 
)

Definition at line 2098 of file mathplot.cpp.

2099{
2100 wxPoint c( centerPoint );
2101
2102 if( c == wxDefaultPosition )
2103 {
2104 GetClientSize( &m_scrX, &m_scrY );
2105 c.x = (m_scrX - m_marginLeft - m_marginRight) / 2 + m_marginLeft; // c.x = m_scrX/2;
2106 c.y = (m_scrY - m_marginTop - m_marginBottom) / 2 - m_marginTop; // c.y = m_scrY/2;
2107 }
2108 else
2109 {
2110 c.x = std::max( c.x, m_marginLeft );
2111 c.x = std::min( c.x, m_scrX - m_marginRight );
2112 c.y = std::max( c.y, m_marginTop );
2113 c.y = std::min( c.y, m_scrY - m_marginBottom );
2114 }
2115
2116 // Preserve the position of the clicked point:
2117 double prior_layer_x = p2x( c.x );
2118 double prior_layer_y = p2y( c.y );
2119
2120 // Zoom in:
2121 const double MAX_SCALE = 1e6;
2122 double newScaleX = m_scaleX * zoomFactor;
2123 double newScaleY = m_scaleY * zoomFactor;
2124
2125 // Baaaaad things happen when you zoom in too much..
2126 if( newScaleX <= MAX_SCALE && newScaleY <= MAX_SCALE )
2127 {
2128 m_scaleX = newScaleX;
2129 m_scaleY = newScaleY;
2130 }
2131 else
2132 {
2133 return;
2134 }
2135
2136 // Adjust the new m_posx/y:
2137 m_posX = prior_layer_x - c.x / m_scaleX;
2138 m_posY = prior_layer_y + c.y / m_scaleY;
2139
2141 m_desiredXmax = m_posX + (m_scrX - m_marginLeft - m_marginRight) / m_scaleX; // m_desiredXmax = m_posX + m_scrX / m_scaleX;
2143 m_desiredYmin = m_posY - (m_scrY - m_marginTop - m_marginBottom) / m_scaleY; // m_desiredYmin = m_posY - m_scrY / m_scaleY;
2145 UpdateAll();
2146}
#define MAX_SCALE

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

◆ ZoomIn() [2/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 2092 of file mathplot.cpp.

2093{
2094 ZoomIn( centerPoint, zoomIncrementalFactor );
2095}

References ZoomIn(), and zoomIncrementalFactor.

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

◆ ZoomInX()

void mpWindow::ZoomInX ( )

Zoom in current view along X and refresh display.

Definition at line 2193 of file mathplot.cpp.

2194{
2196 UpdateAll();
2197}

References m_scaleX, UpdateAll(), and zoomIncrementalFactor.

◆ ZoomInY()

void mpWindow::ZoomInY ( )

Zoom in current view along Y and refresh display.

◆ ZoomOut() [1/2]

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

Definition at line 2155 of file mathplot.cpp.

2156{
2157 wxPoint c( centerPoint );
2158
2159 if( c == wxDefaultPosition )
2160 {
2161 GetClientSize( &m_scrX, &m_scrY );
2162 c.x = (m_scrX - m_marginLeft - m_marginRight) / 2 + m_marginLeft; // c.x = m_scrX/2;
2163 c.y = (m_scrY - m_marginTop - m_marginBottom) / 2 - m_marginTop; // c.y = m_scrY/2;
2164 }
2165
2166 // Preserve the position of the clicked point:
2167 double prior_layer_x = p2x( c.x );
2168 double prior_layer_y = p2y( c.y );
2169
2170 // Zoom out:
2171 m_scaleX = m_scaleX / zoomFactor;
2172 m_scaleY = m_scaleY / zoomFactor;
2173
2174 // Adjust the new m_posx/y:
2175 m_posX = prior_layer_x - c.x / m_scaleX;
2176 m_posY = prior_layer_y + c.y / m_scaleY;
2177
2179 m_desiredXmax = m_posX + (m_scrX - m_marginLeft - m_marginRight) / m_scaleX; // m_desiredXmax = m_posX + m_scrX / m_scaleX;
2181 m_desiredYmin = m_posY - (m_scrY - m_marginTop - m_marginBottom) / m_scaleY; // m_desiredYmin = m_posY - m_scrY / m_scaleY;
2182
2185 {
2186 Fit();
2187 }
2188
2189 UpdateAll();
2190}
bool CheckYLimits(double &desiredMax, double &desiredMin) const
Definition: mathplot.h:1475
bool CheckXLimits(double &desiredMax, double &desiredMin) const
Definition: mathplot.h:1468

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

◆ ZoomOut() [2/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 2149 of file mathplot.cpp.

2150{
2151 ZoomOut( centerPoint, zoomIncrementalFactor );
2152}

References zoomIncrementalFactor, and ZoomOut().

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

◆ ZoomOutX()

void mpWindow::ZoomOutX ( )

Zoom out current view along X and refresh display.

◆ ZoomOutY()

void mpWindow::ZoomOutY ( )

Zoom out current view along Y and refresh display.

◆ ZoomRect()

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

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

Definition at line 2200 of file mathplot.cpp.

2201{
2202 // Compute the 2 corners in graph coordinates:
2203 double p0x = p2x( p0.x );
2204 double p0y = p2y( p0.y );
2205 double p1x = p2x( p1.x );
2206 double p1y = p2y( p1.y );
2207
2208 // Order them:
2209 double zoom_x_min = p0x<p1x ? p0x : p1x;
2210 double zoom_x_max = p0x>p1x ? p0x : p1x;
2211 double zoom_y_min = p0y<p1y ? p0y : p1y;
2212 double zoom_y_max = p0y>p1y ? p0y : p1y;
2213
2214 Fit( zoom_x_min, zoom_x_max, zoom_y_min, zoom_y_max );
2216}

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

Referenced by OnMouseLeftRelease().

Member Data Documentation

◆ m_axColour

wxColour mpWindow::m_axColour
protected

Definition at line 1506 of file mathplot.h.

Referenced by SetColourTheme().

◆ m_bgColour

wxColour mpWindow::m_bgColour
protected

Definition at line 1504 of file mathplot.h.

Referenced by mpWindow(), and SetColourTheme().

◆ m_buff_bmp

wxBitmap* mpWindow::m_buff_bmp
protected

Definition at line 1530 of file mathplot.h.

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

◆ m_buff_dc

wxMemoryDC mpWindow::m_buff_dc
protected

Definition at line 1529 of file mathplot.h.

Referenced by mpWindow(), and OnPaint().

◆ m_clickedX

int mpWindow::m_clickedX
protected

Definition at line 1518 of file mathplot.h.

Referenced by OnCenter(), and OnShowPopupMenu().

◆ m_clickedY

int mpWindow::m_clickedY
protected

Definition at line 1519 of file mathplot.h.

Referenced by OnCenter(), and OnShowPopupMenu().

◆ m_desiredXmax

double mpWindow::m_desiredXmax
protected

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

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

◆ m_desiredYmax

double mpWindow::m_desiredYmax
protected

◆ m_desiredYmin

double mpWindow::m_desiredYmin
protected

◆ m_enableDoubleBuffer

bool mpWindow::m_enableDoubleBuffer
protected

Definition at line 1531 of file mathplot.h.

Referenced by mpWindow(), and OnPaint().

◆ m_enableLimitedView

bool mpWindow::m_enableLimitedView
protected

Definition at line 1534 of file mathplot.h.

Referenced by AdjustLimitedView(), and mpWindow().

◆ m_enableMouseNavigation

bool mpWindow::m_enableMouseNavigation
protected

Definition at line 1532 of file mathplot.h.

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

◆ m_enableMouseWheelPan

bool mpWindow::m_enableMouseWheelPan
protected

Definition at line 1533 of file mathplot.h.

Referenced by OnMouseWheel().

◆ m_enableScrollBars

bool mpWindow::m_enableScrollBars
protected

Definition at line 1537 of file mathplot.h.

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

◆ m_fgColour

wxColour mpWindow::m_fgColour
protected

Definition at line 1505 of file mathplot.h.

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

◆ m_last_lx

int mpWindow::m_last_lx
protected

Definition at line 1528 of file mathplot.h.

Referenced by mpWindow(), and OnPaint().

◆ m_last_ly

int mpWindow::m_last_ly
protected

Definition at line 1528 of file mathplot.h.

Referenced by mpWindow(), and OnPaint().

◆ m_layers

◆ m_lockaspect

bool mpWindow::m_lockaspect
protected

Definition at line 1502 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 1536 of file mathplot.h.

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

◆ m_mouseMClick

wxPoint mpWindow::m_mouseMClick
protected

Definition at line 1535 of file mathplot.h.

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

◆ m_movingInfoLayer

mpInfoLayer* mpWindow::m_movingInfoLayer
protected

Definition at line 1539 of file mathplot.h.

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

◆ m_popmenu

wxMenu mpWindow::m_popmenu
protected

Definition at line 1501 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

double mpWindow::m_scaleX
protected

◆ m_scaleY

double mpWindow::m_scaleY
protected

◆ m_scroll

wxPoint mpWindow::m_scroll
protected

Definition at line 1538 of file mathplot.h.

◆ m_scrX

int mpWindow::m_scrX
protected

Definition at line 1516 of file mathplot.h.

Referenced by DoZoomInXCalc(), Fit(), mpWindow(), OnCenter(), OnPaint(), SaveScreenshot(), ZoomIn(), and ZoomOut().

◆ m_scrY

int mpWindow::m_scrY
protected

Definition at line 1517 of file mathplot.h.

Referenced by Fit(), mpWindow(), OnCenter(), OnPaint(), SaveScreenshot(), ZoomIn(), and ZoomOut().

◆ m_zooming

bool mpWindow::m_zooming
protected

Definition at line 1540 of file mathplot.h.

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

◆ m_zoomRect

wxRect mpWindow::m_zoomRect
protected

Definition at line 1541 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 1351 of file mathplot.h.

Referenced by DoZoomInXCalc(), ZoomIn(), ZoomInX(), and ZoomOut().


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