KiCad PCB EDA Suite
|
Canvas for plotting mpLayer implementations. More...
#include <mathplot.h>
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... | |
mpLayer * | GetLayer (int position) const |
const mpLayer * | GetLayerByName (const wxString &name) const |
mpLayer * | GetLayerByName (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 ¢erPoint=wxDefaultPosition) |
Zoom into current view and refresh display. More... | |
void | ZoomIn (const wxPoint ¢erPoint, double zoomFactor) |
void | ZoomOut (const wxPoint ¢erPoint=wxDefaultPosition) |
Zoom out current view and refresh display. More... | |
void | ZoomOut (const wxPoint ¢erPoint, 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 |
mpInfoLayer * | IsInsideInfoLayer (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 |
mpInfoLayer * | m_movingInfoLayer |
bool | m_zooming |
wxRect | m_zoomRect |
Canvas for plotting mpLayer implementations.
This class defines a zoomable and moveable 2D plot canvas. Any number of mpLayer implementations (scale rulers, function plots, ...) can be attached using mpWindow::AddLayer.
The canvas window provides a context menu with actions for navigating the view. The context menu can be retrieved with mpWindow::GetPopupMenu, e.g. for extending it externally.
Since wxMathPlot version 0.03, the mpWindow incorporates the following features:
The mouse commands can be visualized by the user through the popup menu, and are:
Definition at line 1059 of file mathplot.h.
mpWindow::mpWindow | ( | ) |
Definition at line 1631 of file mathplot.cpp.
mpWindow::mpWindow | ( | wxWindow * | parent, |
wxWindowID | id, | ||
const wxPoint & | pos = wxDefaultPosition , |
||
const wxSize & | size = wxDefaultSize , |
||
long | flags = 0 |
||
) |
Definition at line 1677 of file mathplot.cpp.
References _, 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 | ( | ) |
Definition at line 1737 of file mathplot.cpp.
References DelAllLayers(), and m_buff_bmp.
bool mpWindow::AddLayer | ( | mpLayer * | layer, |
bool | refreshDisplay = true |
||
) |
Add a plot layer to the canvas.
layer | Pointer to layer. The mpLayer object will get under control of mpWindow, i.e. it will be delete'd on mpWindow destruction |
refreshDisplay | States whether to refresh the display (UpdateAll) after adding the layer. |
true | Success |
false | Failure due to out of memory. |
Definition at line 2314 of file mathplot.cpp.
References m_layers, and UpdateAll().
Referenced by SIM_PLOT_PANEL::AddTrace(), SIM_PLOT_PANEL::EnableCursor(), SIMULATOR_FRAME::parseTraceParams(), SIM_PLOT_PANEL::prepareDCAxes(), SIM_PLOT_PANEL::SIM_PLOT_PANEL(), and SIM_PLOT_PANEL::updateAxes().
|
protected |
Definition at line 2054 of file mathplot.cpp.
References m_desiredXmax, m_desiredXmin, m_desiredYmax, m_desiredYmin, m_enableLimitedView, m_marginBottom, m_marginLeft, m_marginRight, m_marginTop, m_maxX, m_maxY, m_minX, m_minY, m_posX, m_posY, m_scaleX, and m_scaleY.
Referenced by SetXView(), SetYView(), ZoomIn(), and ZoomRect().
|
inlineprotected |
Definition at line 1481 of file mathplot.h.
Referenced by ZoomOut().
|
inlineprotected |
Definition at line 1488 of file mathplot.h.
Referenced by ZoomOut().
|
inline |
Counts the number of plot layers, whether or not they have a bounding box.
Definition at line 1306 of file mathplot.h.
Referenced by mpPrintout::OnPrintPage(), and mpInfoLegend::Plot().
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.
Definition at line 2651 of file mathplot.cpp.
References m_layers.
void mpWindow::DelAllLayers | ( | bool | alsoDeleteObject, |
bool | refreshDisplay = true |
||
) |
Remove all layers from the plot.
alsoDeleteObject | If set to true, the mpLayer objects will be also "deleted", not just removed from the internal list. |
refreshDisplay | States whether to refresh the display (UpdateAll) after removing the layers. |
Definition at line 2355 of file mathplot.cpp.
References m_layers, and UpdateAll().
Referenced by ~mpWindow().
bool mpWindow::DelLayer | ( | mpLayer * | layer, |
bool | alsoDeleteObject = false , |
||
bool | refreshDisplay = true |
||
) |
Remove a plot layer from the canvas.
layer | Pointer to layer. The mpLayer object will be destructed using delete. |
alsoDeleteObject | If set to true, the mpLayer object will be also "deleted", not just removed from the internal list. |
refreshDisplay | States whether to refresh the display (UpdateAll) after removing the layer. |
N.B. Only the layer reference in the mpWindow is deleted, the layer object still exists!
Definition at line 2330 of file mathplot.cpp.
References m_layers, and UpdateAll().
Referenced by SIM_PLOT_PANEL::DeleteTrace(), and SIM_PLOT_PANEL::EnableCursor().
|
protected |
Definition at line 2515 of file mathplot.cpp.
References m_desiredXmin, m_desiredYmax, m_marginLeft, m_marginTop, m_maxY, m_minX, m_scaleX, m_scaleY, SetPosX(), and SetPosY().
Referenced by OnScrollBottom(), OnScrollLineDown(), OnScrollLineUp(), OnScrollPageDown(), OnScrollPageUp(), OnScrollThumbTrack(), and OnScrollTop().
|
protected |
Definition at line 2039 of file mathplot.cpp.
References m_desiredXmax, m_desiredXmin, m_marginLeft, m_marginRight, m_posX, m_scaleX, m_scrX, p2x(), and zoomIncrementalFactor.
|
protected |
|
protected |
|
protected |
|
inline |
Enable/disable the double-buffering of the window, eliminating the flicker (default=disabled).
Definition at line 1225 of file mathplot.h.
Referenced by SIM_PLOT_PANEL::SIM_PLOT_PANEL().
|
inline |
Enable/disable the feature of pan/zoom with the mouse (default=enabled)
Definition at line 1229 of file mathplot.h.
|
inline |
Enable/disable trackpad friendly panning (2-axis scroll wheel)
Definition at line 1233 of file mathplot.h.
Referenced by SIMULATOR_FRAME::NewPlotPanel().
|
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 1968 of file mathplot.cpp.
References Fit(), m_maxX, m_maxY, m_minX, m_minY, and UpdateBBox().
Referenced by Fit(), LockAspect(), OnFit(), mpPrintout::OnPrintPage(), SIMULATOR_FRAME::onSimFinished(), OnSize(), SaveScreenshot(), SIMULATOR_CONTROL::Zoom(), ZoomOut(), and ZoomRect().
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 1976 of file mathplot.cpp.
References m_desiredXmax, m_desiredXmin, m_desiredYmax, m_desiredYmin, m_lockaspect, m_marginBottom, m_marginLeft, m_marginRight, m_marginTop, m_posX, m_posY, m_scaleX, m_scaleY, m_scrX, m_scrY, and UpdateAll().
|
inline |
Get axes draw colour.
Definition at line 1439 of file mathplot.h.
Referenced by mpPrintout::OnPrintPage().
void mpWindow::GetBoundingBox | ( | double * | bbox | ) | 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).
Definition at line 1325 of file mathplot.h.
Referenced by mpPrintout::OnPrintPage().
|
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).
Definition at line 1319 of file mathplot.h.
Referenced by mpPrintout::OnPrintPage().
|
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).
Definition at line 1337 of file mathplot.h.
Referenced by mpPrintout::OnPrintPage().
|
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).
Definition at line 1331 of file mathplot.h.
Referenced by mpPrintout::OnPrintPage().
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!
position | position of the layer in the layers list |
Definition at line 2665 of file mathplot.cpp.
References m_layers.
Referenced by IsLayerVisible(), mpPrintout::OnPrintPage(), mpInfoLegend::Plot(), and SetLayerVisible().
|
inline |
Definition at line 1112 of file mathplot.h.
References name.
const mpLayer * mpWindow::GetLayerByName | ( | const wxString & | name | ) | const |
Get the layer by its name (case sensitive).
name | The name of the layer to retrieve |
Definition at line 2674 of file mathplot.cpp.
References m_layers, and name.
Referenced by IsLayerVisible(), and SetLayerVisible().
|
inline |
Definition at line 1388 of file mathplot.h.
Referenced by mpScaleY::getVisibleDataRange(), CURSOR::Plot(), mpFX::Plot(), mpFY::Plot(), mpFXY::Plot(), mpProfile::Plot(), mpScaleXBase::Plot(), mpScaleY::Plot(), and mpText::Plot().
|
inline |
Definition at line 1390 of file mathplot.h.
Referenced by SIM_PLOT_PANEL::EnableCursor(), mpScaleXBase::getVisibleDataRange(), CURSOR::Plot(), mpFX::Plot(), mpFY::Plot(), mpFXY::Plot(), mpProfile::Plot(), mpScaleXBase::Plot(), mpScaleY::Plot(), and mpText::Plot().
|
inline |
Definition at line 1386 of file mathplot.h.
Referenced by SIM_PLOT_PANEL::EnableCursor(), mpScaleXBase::getVisibleDataRange(), CURSOR::Plot(), mpFX::Plot(), mpFY::Plot(), mpFXY::Plot(), mpProfile::Plot(), mpScaleXBase::Plot(), mpScaleY::Plot(), and mpText::Plot().
|
inline |
Definition at line 1384 of file mathplot.h.
Referenced by mpScaleY::getVisibleDataRange(), CURSOR::Plot(), mpFX::Plot(), mpFY::Plot(), mpFXY::Plot(), mpProfile::Plot(), mpScaleXBase::Plot(), mpScaleY::Plot(), and mpText::Plot().
|
inline |
Get scrollbars status.
Definition at line 1350 of file mathplot.h.
|
inline |
Get reference to context menu of the plot canvas.
Definition at line 1072 of file mathplot.h.
|
inline |
Definition at line 1136 of file mathplot.h.
Referenced by mpScaleXBase::Plot(), mpMovableObject::Plot(), and mpBitmapLayer::Plot().
|
inline |
Definition at line 1143 of file mathplot.h.
Referenced by mpScaleY::Plot(), mpMovableObject::Plot(), and mpBitmapLayer::Plot().
|
inline |
Definition at line 1122 of file mathplot.h.
Referenced by mpScaleXBase::Plot(), mpMovableObject::Plot(), and mpBitmapLayer::Plot().
|
inline |
Definition at line 1129 of file mathplot.h.
Referenced by mpScaleY::Plot(), mpMovableObject::Plot(), and mpBitmapLayer::Plot().
|
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
Definition at line 1151 of file mathplot.h.
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().
|
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
Definition at line 1160 of file mathplot.h.
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().
|
inline |
Get current view's X position.
See rules for coordinate transformation
Definition at line 1135 of file mathplot.h.
|
inline |
Get current view's X scale.
See rules for coordinate transformation
Definition at line 1121 of file mathplot.h.
|
inline |
Definition at line 1152 of file mathplot.h.
Referenced by SIM_PLOT_PANEL::EnableCursor().
|
inline |
Get current view's Y position.
See rules for coordinate transformation
Definition at line 1142 of file mathplot.h.
|
inline |
Get current view's Y scale.
See rules for coordinate transformation
Definition at line 1128 of file mathplot.h.
|
inline |
Definition at line 1161 of file mathplot.h.
|
inline |
Checks whether the X/Y scale aspect is locked.
true | Locked |
false | Unlocked |
Definition at line 1246 of file mathplot.h.
mpInfoLayer * mpWindow::IsInsideInfoLayer | ( | wxPoint & | point | ) |
Check if a given point is inside the area of a mpInfoLayer and eventually returns its pointer.
point | The position to be checked |
Definition at line 2755 of file mathplot.cpp.
References mpInfoLayer::Inside(), and m_layers.
Referenced by OnMouseLeftDown().
bool mpWindow::IsLayerVisible | ( | const wxString & | name | ) | const |
Check whether a layer with given name is visible.
name | The layer name |
Definition at line 2784 of file mathplot.cpp.
References GetLayerByName(), mpLayer::IsVisible(), and name.
bool mpWindow::IsLayerVisible | ( | unsigned int | position | ) | const |
Check whether the layer at given position is visible.
position | The layer position in layer list |
Definition at line 2804 of file mathplot.cpp.
References GetLayer(), and mpLayer::IsVisible().
|
inline |
Limit zooming & panning to the area used by the plots.
Definition at line 1442 of file mathplot.h.
Referenced by SIM_PLOT_PANEL::SIM_PLOT_PANEL().
void mpWindow::LockAspect | ( | bool | enable = true | ) |
Enable or disable X/Y scale aspect locking for the view.
Definition at line 2255 of file mathplot.cpp.
References Fit(), m_desiredXmax, m_desiredXmin, m_desiredYmax, m_desiredYmin, m_lockaspect, m_popmenu, and mpID_LOCKASPECT.
Referenced by OnLockAspect().
|
protected |
Definition at line 2285 of file mathplot.cpp.
References m_clickedX, m_clickedY, m_marginBottom, m_marginLeft, m_marginRight, m_marginTop, m_scrX, m_scrY, p2x(), p2y(), and SetPos().
|
protected |
Definition at line 2279 of file mathplot.cpp.
References Fit().
|
protected |
Definition at line 2273 of file mathplot.cpp.
References LockAspect(), and m_lockaspect.
|
protected |
|
protected |
Definition at line 1934 of file mathplot.cpp.
References IsInsideInfoLayer(), m_mouseLClick, m_movingInfoLayer, and m_zooming.
|
protected |
Definition at line 1946 of file mathplot.cpp.
References m_mouseLClick, m_movingInfoLayer, m_zooming, mpInfoLayer::UpdateReference(), and ZoomRect().
|
protected |
Definition at line 1749 of file mathplot.cpp.
References m_mouseMClick.
|
protected |
Definition at line 1832 of file mathplot.cpp.
References cursor, mpInfoLayer::Inside(), 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(), and UpdateAll().
|
protected |
Definition at line 1777 of file mathplot.cpp.
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().
|
protected |
Definition at line 2371 of file mathplot.cpp.
References m_buff_bmp, m_buff_dc, m_enableDoubleBuffer, m_enableScrollBars, m_fgColour, m_last_lx, m_last_ly, m_layers, m_scrX, m_scrY, m_zooming, and m_zoomRect.
|
protected |
Definition at line 2626 of file mathplot.cpp.
References DoScrollCalc().
|
protected |
Definition at line 2600 of file mathplot.cpp.
References DoScrollCalc(), and mpSCROLL_NUM_PIXELS_PER_LINE.
|
protected |
Definition at line 2584 of file mathplot.cpp.
References DoScrollCalc(), and mpSCROLL_NUM_PIXELS_PER_LINE.
|
protected |
Definition at line 2564 of file mathplot.cpp.
References DoScrollCalc().
|
protected |
Definition at line 2546 of file mathplot.cpp.
References DoScrollCalc().
|
protected |
Definition at line 2540 of file mathplot.cpp.
References DoScrollCalc().
|
protected |
Definition at line 2620 of file mathplot.cpp.
References DoScrollCalc().
|
protected |
Definition at line 2265 of file mathplot.cpp.
References m_clickedX, m_clickedY, and m_popmenu.
|
protected |
Definition at line 2307 of file mathplot.cpp.
References Fit(), m_desiredXmax, m_desiredXmin, m_desiredYmax, and m_desiredYmin.
|
protected |
Definition at line 2295 of file mathplot.cpp.
References m_mouseMClick, and ZoomIn().
|
protected |
Definition at line 2301 of file mathplot.cpp.
References ZoomOut().
|
inline |
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates, using current mpWindow position and scale.
Definition at line 1205 of file mathplot.h.
Referenced by DoZoomInXCalc(), mpScaleXBase::getVisibleDataRange(), OnCenter(), CURSOR::Plot(), mpFX::Plot(), mpProfile::Plot(), ZoomIn(), ZoomOut(), and ZoomRect().
|
inline |
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates, using current mpWindow position and scale.
Definition at line 1210 of file mathplot.h.
Referenced by mpScaleY::getVisibleDataRange(), OnCenter(), mpFY::Plot(), ZoomIn(), ZoomOut(), and ZoomRect().
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.
filename | File name where to save the screenshot |
type | image type to be saved: see wxImage output file types for flags |
imageSize | Set a size for the output image. Default is the same as the screen size |
fit | Decide whether to fit the plot into the size |
Definition at line 2695 of file mathplot.cpp.
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 SIMULATOR_CONTROL::ExportPlotAsPNG().
void mpWindow::SetColourTheme | ( | const wxColour & | bgColour, |
const wxColour & | drawColour, | ||
const wxColour & | axesColour | ||
) |
Set Color theme.
Provide colours to set a new colour theme.
bgColour | Background colour |
drawColour | The colour used to draw all elements in foreground, axes excluded |
axesColour | The colour used to draw axes (but not their labels) |
Definition at line 2812 of file mathplot.cpp.
References m_axColour, m_bgColour, m_fgColour, m_layers, mpLAYER_AXIS, and mpLAYER_INFO.
Referenced by mpPrintout::OnPrintPage(), and SIM_PLOT_PANEL::UpdatePlotColors().
void mpWindow::SetLayerVisible | ( | const unsigned int | position, |
bool | viewable | ||
) |
Sets the visibility of a layer by its position in layer list.
position | The layer position in layer list |
viewable | the view status to be set |
Definition at line 2792 of file mathplot.cpp.
References GetLayer(), mpLayer::SetVisible(), and UpdateAll().
void mpWindow::SetLayerVisible | ( | const wxString & | name, |
bool | viewable | ||
) |
Sets the visibility of a layer by its name.
name | The layer name to set visibility |
viewable | the view status to be set |
Definition at line 2772 of file mathplot.cpp.
References GetLayerByName(), name, mpLayer::SetVisible(), and UpdateAll().
|
inline |
|
inline |
Set the left margin.
left | Left Margin |
Definition at line 1381 of file mathplot.h.
References left.
|
inline |
Set the right margin.
right | Right Margin |
Definition at line 1377 of file mathplot.h.
References right.
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.
top | Top border |
right | Right border |
bottom | Bottom border |
left | Left border |
Definition at line 2746 of file mathplot.cpp.
References left, m_marginBottom, m_marginLeft, m_marginRight, m_marginTop, and right.
Referenced by SIM_PLOT_PANEL::prepareDCAxes(), SIM_PLOT_PANEL::SIM_PLOT_PANEL(), and SIM_PLOT_PANEL::updateAxes().
|
inline |
void mpWindow::SetMPScrollbars | ( | bool | status | ) |
Enable/disable scrollbars.
status | Set to true to show scrollbars |
|
inline |
Set current view's X and Y position and refresh display.
posX | New position that corresponds to the center point of the view. |
posY | New position that corresponds to the center point of the view. |
Definition at line 1193 of file mathplot.h.
Referenced by OnCenter().
|
inline |
Set current view's X position and refresh display.
posX | New position that corresponds to the center point of the view. |
Definition at line 1182 of file mathplot.h.
Referenced by DoScrollCalc().
|
inline |
Set current view's Y position and refresh display.
posY | New position that corresponds to the center point of the view. |
Definition at line 1187 of file mathplot.h.
Referenced by DoScrollCalc().
void mpWindow::SetScaleX | ( | double | scaleX | ) |
Set current view's X scale and refresh display.
scaleX | New scale, must not be 0. |
Definition at line 2640 of file mathplot.cpp.
References m_scaleX, and UpdateAll().
|
inline |
Set current view's Y scale and refresh display.
scaleY | New scale, must not be 0. |
Definition at line 1171 of file mathplot.h.
|
inline |
Set current view's dimensions in device context units.
Needed by plotting functions. It doesn't refresh display.
scrX | New position that corresponds to the center point of the view. |
scrY | New position that corresponds to the center point of the view. |
Definition at line 1200 of file mathplot.h.
Referenced by SaveScreenshot().
|
protectedvirtual |
Applies new X view coordinates depending on the settings.
Definition at line 2100 of file mathplot.cpp.
References AdjustLimitedView(), m_desiredXmax, m_desiredXmin, and m_posX.
Referenced by OnMouseMove(), and OnMouseWheel().
|
protectedvirtual |
Applies new Y view coordinates depending on the settings.
Definition at line 2114 of file mathplot.cpp.
References AdjustLimitedView(), m_desiredYmax, m_desiredYmin, and m_posY.
Referenced by OnMouseMove(), and OnMouseWheel().
void mpWindow::UpdateAll | ( | ) |
Refresh display.
Definition at line 2468 of file mathplot.cpp.
References m_desiredXmax, m_desiredXmin, m_desiredYmax, m_desiredYmin, m_enableScrollBars, m_marginBottom, m_marginLeft, m_marginRight, m_marginTop, m_maxX, m_maxY, m_minX, m_minY, m_posX, m_posY, m_scaleX, m_scaleY, Refresh(), and UpdateBBox().
Referenced by AddLayer(), DelAllLayers(), DelLayer(), Fit(), mpWindow(), SIM_PLOT_PANEL::OnLanguageChanged(), OnMouseMove(), OnMouseWheel(), mpPrintout::OnPrintPage(), SIMULATOR_FRAME::onSimFinished(), SaveScreenshot(), SIM_PLOT_PANEL::SetDottedSecondary(), SetLayerVisible(), SetScaleX(), SIM_PLOT_PANEL::SetTraceData(), SIM_PLOT_PANEL::ShowGrid(), SIM_PLOT_PANEL::ShowLegend(), SIM_PLOT_PANEL::SIM_PLOT_PANEL(), SIM_PLOT_PANEL::UpdatePlotColors(), ZoomIn(), ZoomInX(), and ZoomOut().
|
protectedvirtual |
Recalculate global layer bounding box, and save it in m_minX,...
Definition at line 2457 of file mathplot.cpp.
References m_maxX, m_maxY, m_minX, and m_minY.
Referenced by Fit(), and UpdateAll().
|
inline |
Converts graph (floating point) coordinates into mpWindow (screen) pixel coordinates, using current mpWindow position and scale.
Definition at line 1215 of file mathplot.h.
Referenced by CURSOR::Inside(), CURSOR::Plot(), mpFY::Plot(), mpFXY::Plot(), mpScaleY::Plot(), mpMovableObject::Plot(), mpBitmapLayer::Plot(), CURSOR::SetCoordX(), and CURSOR::UpdateReference().
|
inline |
Converts graph (floating point) coordinates into mpWindow (screen) pixel coordinates, using current mpWindow position and scale.
Definition at line 1220 of file mathplot.h.
Referenced by CURSOR::Inside(), CURSOR::Plot(), mpFX::Plot(), mpFXY::Plot(), mpProfile::Plot(), mpScaleXBase::Plot(), mpMovableObject::Plot(), mpBitmapLayer::Plot(), CURSOR::SetCoordX(), and CURSOR::UpdateReference().
void mpWindow::ZoomIn | ( | const wxPoint & | centerPoint, |
double | zoomFactor | ||
) |
Definition at line 2134 of file mathplot.cpp.
References AdjustLimitedView(), m_desiredXmax, m_desiredXmin, m_desiredYmax, m_desiredYmin, m_marginBottom, m_marginLeft, m_marginRight, m_marginTop, m_posX, m_posY, m_scaleX, m_scaleY, m_scrX, m_scrY, MAX_SCALE, p2x(), p2y(), and UpdateAll().
void mpWindow::ZoomIn | ( | const wxPoint & | centerPoint = wxDefaultPosition | ) |
Zoom into current view and refresh display.
centerPoint | The 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 2128 of file mathplot.cpp.
References ZoomIn(), and zoomIncrementalFactor.
Referenced by OnMouseWheel(), OnZoomIn(), SIMULATOR_CONTROL::Zoom(), and ZoomIn().
void mpWindow::ZoomInX | ( | ) |
Zoom in current view along X and refresh display.
Definition at line 2229 of file mathplot.cpp.
References m_scaleX, UpdateAll(), and zoomIncrementalFactor.
void mpWindow::ZoomInY | ( | ) |
Zoom in current view along Y and refresh display.
void mpWindow::ZoomOut | ( | const wxPoint & | centerPoint, |
double | zoomFactor | ||
) |
Definition at line 2191 of file mathplot.cpp.
References CheckXLimits(), CheckYLimits(), Fit(), m_desiredXmax, m_desiredXmin, m_desiredYmax, m_desiredYmin, m_marginBottom, m_marginLeft, m_marginRight, m_marginTop, m_posX, m_posY, m_scaleX, m_scaleY, m_scrX, m_scrY, p2x(), p2y(), and UpdateAll().
void mpWindow::ZoomOut | ( | const wxPoint & | centerPoint = wxDefaultPosition | ) |
Zoom out current view and refresh display.
centerPoint | The 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 2185 of file mathplot.cpp.
References zoomIncrementalFactor, and ZoomOut().
Referenced by OnMouseWheel(), OnZoomOut(), SIMULATOR_CONTROL::Zoom(), and ZoomOut().
void mpWindow::ZoomOutX | ( | ) |
Zoom out current view along X and refresh display.
void mpWindow::ZoomOutY | ( | ) |
Zoom out current view along Y and refresh display.
void mpWindow::ZoomRect | ( | wxPoint | p0, |
wxPoint | p1 | ||
) |
Zoom view fitting given coordinates to the window (p0 and p1 do not need to be in any specific order)
Definition at line 2236 of file mathplot.cpp.
References AdjustLimitedView(), Fit(), p2x(), and p2y().
Referenced by OnMouseLeftRelease().
|
protected |
Definition at line 1519 of file mathplot.h.
Referenced by SetColourTheme().
|
protected |
Definition at line 1517 of file mathplot.h.
Referenced by mpWindow(), and SetColourTheme().
|
protected |
Definition at line 1543 of file mathplot.h.
Referenced by mpWindow(), OnPaint(), and ~mpWindow().
|
protected |
Definition at line 1542 of file mathplot.h.
Referenced by mpWindow(), and OnPaint().
|
protected |
Definition at line 1531 of file mathplot.h.
Referenced by OnCenter(), and OnShowPopupMenu().
|
protected |
Definition at line 1532 of file mathplot.h.
Referenced by OnCenter(), and OnShowPopupMenu().
|
protected |
Definition at line 1537 of file mathplot.h.
Referenced by AdjustLimitedView(), DoZoomInXCalc(), Fit(), LockAspect(), mpWindow(), OnMouseMove(), OnMouseWheel(), OnSize(), SaveScreenshot(), SetXView(), UpdateAll(), ZoomIn(), and ZoomOut().
|
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 1537 of file mathplot.h.
Referenced by AdjustLimitedView(), DoScrollCalc(), DoZoomInXCalc(), Fit(), LockAspect(), mpWindow(), OnMouseMove(), OnMouseWheel(), OnSize(), SaveScreenshot(), SetXView(), UpdateAll(), ZoomIn(), and ZoomOut().
|
protected |
Definition at line 1537 of file mathplot.h.
Referenced by AdjustLimitedView(), DoScrollCalc(), Fit(), LockAspect(), mpWindow(), OnMouseMove(), OnMouseWheel(), OnSize(), SaveScreenshot(), SetYView(), UpdateAll(), ZoomIn(), and ZoomOut().
|
protected |
Definition at line 1537 of file mathplot.h.
Referenced by AdjustLimitedView(), Fit(), LockAspect(), mpWindow(), OnMouseMove(), OnMouseWheel(), OnSize(), SaveScreenshot(), SetYView(), UpdateAll(), ZoomIn(), and ZoomOut().
|
protected |
Definition at line 1544 of file mathplot.h.
Referenced by mpWindow(), and OnPaint().
|
protected |
Definition at line 1547 of file mathplot.h.
Referenced by AdjustLimitedView(), and mpWindow().
|
protected |
Definition at line 1545 of file mathplot.h.
Referenced by mpWindow(), OnMouseMove(), and OnMouseWheel().
|
protected |
Definition at line 1546 of file mathplot.h.
Referenced by OnMouseWheel().
|
protected |
Definition at line 1550 of file mathplot.h.
Referenced by mpWindow(), OnPaint(), and UpdateAll().
|
protected |
Definition at line 1518 of file mathplot.h.
Referenced by mpWindow(), OnMouseMove(), OnPaint(), SaveScreenshot(), and SetColourTheme().
|
protected |
Definition at line 1541 of file mathplot.h.
Referenced by mpWindow(), and OnPaint().
|
protected |
Definition at line 1541 of file mathplot.h.
Referenced by mpWindow(), and OnPaint().
|
protected |
Definition at line 1513 of file mathplot.h.
Referenced by AddLayer(), CountLayers(), DelAllLayers(), DelLayer(), GetLayer(), GetLayerByName(), IsInsideInfoLayer(), mpWindow(), OnMouseMove(), OnPaint(), SaveScreenshot(), and SetColourTheme().
|
protected |
Definition at line 1515 of file mathplot.h.
Referenced by Fit(), LockAspect(), mpWindow(), and OnLockAspect().
|
protected |
Definition at line 1539 of file mathplot.h.
Referenced by AdjustLimitedView(), Fit(), mpWindow(), OnCenter(), SetMargins(), UpdateAll(), ZoomIn(), and ZoomOut().
|
protected |
Definition at line 1539 of file mathplot.h.
Referenced by AdjustLimitedView(), DoScrollCalc(), DoZoomInXCalc(), Fit(), mpWindow(), OnCenter(), SetMargins(), UpdateAll(), ZoomIn(), and ZoomOut().
|
protected |
Definition at line 1539 of file mathplot.h.
Referenced by AdjustLimitedView(), DoZoomInXCalc(), Fit(), mpWindow(), OnCenter(), SetMargins(), UpdateAll(), ZoomIn(), and ZoomOut().
|
protected |
Definition at line 1539 of file mathplot.h.
Referenced by AdjustLimitedView(), DoScrollCalc(), Fit(), mpWindow(), OnCenter(), SetMargins(), UpdateAll(), ZoomIn(), and ZoomOut().
|
protected |
Definition at line 1522 of file mathplot.h.
Referenced by AdjustLimitedView(), Fit(), GetBoundingBox(), mpWindow(), SaveScreenshot(), UpdateAll(), and UpdateBBox().
|
protected |
Definition at line 1524 of file mathplot.h.
Referenced by AdjustLimitedView(), DoScrollCalc(), Fit(), GetBoundingBox(), mpWindow(), SaveScreenshot(), UpdateAll(), and UpdateBBox().
|
protected |
Definition at line 1521 of file mathplot.h.
Referenced by AdjustLimitedView(), DoScrollCalc(), Fit(), GetBoundingBox(), mpWindow(), SaveScreenshot(), UpdateAll(), and UpdateBBox().
|
protected |
Definition at line 1523 of file mathplot.h.
Referenced by AdjustLimitedView(), Fit(), GetBoundingBox(), mpWindow(), SaveScreenshot(), UpdateAll(), and UpdateBBox().
|
protected |
Definition at line 1549 of file mathplot.h.
Referenced by OnMouseLeftDown(), OnMouseLeftRelease(), and OnMouseMove().
|
protected |
Definition at line 1548 of file mathplot.h.
Referenced by OnMouseMiddleDown(), OnMouseMove(), and OnZoomIn().
|
protected |
Definition at line 1552 of file mathplot.h.
Referenced by mpWindow(), OnMouseLeftDown(), OnMouseLeftRelease(), and OnMouseMove().
|
protected |
Definition at line 1514 of file mathplot.h.
Referenced by LockAspect(), mpWindow(), and OnShowPopupMenu().
|
protected |
Definition at line 1527 of file mathplot.h.
Referenced by AdjustLimitedView(), DoZoomInXCalc(), Fit(), mpWindow(), OnMouseMove(), OnMouseWheel(), SetXView(), UpdateAll(), ZoomIn(), and ZoomOut().
|
protected |
Definition at line 1528 of file mathplot.h.
Referenced by AdjustLimitedView(), Fit(), mpWindow(), OnMouseMove(), OnMouseWheel(), SetYView(), UpdateAll(), ZoomIn(), and ZoomOut().
|
protected |
Definition at line 1525 of file mathplot.h.
Referenced by AdjustLimitedView(), DoScrollCalc(), DoZoomInXCalc(), Fit(), mpWindow(), OnMouseMove(), OnMouseWheel(), SetScaleX(), UpdateAll(), ZoomIn(), ZoomInX(), and ZoomOut().
|
protected |
Definition at line 1526 of file mathplot.h.
Referenced by AdjustLimitedView(), DoScrollCalc(), Fit(), mpWindow(), OnMouseMove(), OnMouseWheel(), UpdateAll(), ZoomIn(), and ZoomOut().
|
protected |
Definition at line 1551 of file mathplot.h.
|
protected |
Definition at line 1529 of file mathplot.h.
Referenced by DoZoomInXCalc(), Fit(), mpWindow(), OnCenter(), OnPaint(), SaveScreenshot(), ZoomIn(), and ZoomOut().
|
protected |
Definition at line 1530 of file mathplot.h.
Referenced by Fit(), mpWindow(), OnCenter(), OnPaint(), SaveScreenshot(), ZoomIn(), and ZoomOut().
|
protected |
Definition at line 1553 of file mathplot.h.
Referenced by mpWindow(), OnMouseLeftDown(), OnMouseLeftRelease(), OnMouseMove(), and OnPaint().
|
protected |
Definition at line 1554 of file mathplot.h.
Referenced by OnMouseMove(), and OnPaint().
|
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 1364 of file mathplot.h.
Referenced by DoZoomInXCalc(), ZoomIn(), ZoomInX(), and ZoomOut().