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 1046 of file mathplot.h.
mpWindow::mpWindow | ( | ) |
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.
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 | ( | ) |
Definition at line 1709 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 2278 of file mathplot.cpp.
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().
|
protected |
Definition at line 2018 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 |
|
inlineprotected |
|
inline |
Counts the number of plot layers, whether or not they have a bounding box.
Definition at line 1293 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 2620 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 2322 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 2295 of file mathplot.cpp.
References m_layers, and UpdateAll().
Referenced by SIM_PLOT_PANEL::addTrace(), SIM_PLOT_PANEL::deleteTrace(), and SIM_PLOT_PANEL::EnableCursor().
|
protected |
Definition at line 2484 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 2003 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 1212 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 1216 of file mathplot.h.
|
inline |
Enable/disable trackpad friendly panning (2-axis scroll wheel)
Definition at line 1220 of file mathplot.h.
Referenced by SIM_PLOT_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 1932 of file mathplot.cpp.
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().
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.
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 1426 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 1312 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 1306 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 1324 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 1318 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 2634 of file mathplot.cpp.
References m_layers.
Referenced by IsLayerVisible(), mpPrintout::OnPrintPage(), mpInfoLegend::Plot(), and SetLayerVisible().
|
inline |
Definition at line 1099 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 2643 of file mathplot.cpp.
References m_layers, and name.
Referenced by IsLayerVisible(), and SetLayerVisible().
|
inline |
Definition at line 1375 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 1377 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 1373 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 1371 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 1337 of file mathplot.h.
|
inline |
Get reference to context menu of the plot canvas.
Definition at line 1059 of file mathplot.h.
|
inline |
Definition at line 1123 of file mathplot.h.
Referenced by mpScaleXBase::Plot(), mpMovableObject::Plot(), and mpBitmapLayer::Plot().
|
inline |
Definition at line 1130 of file mathplot.h.
Referenced by mpScaleY::Plot(), mpMovableObject::Plot(), and mpBitmapLayer::Plot().
|
inline |
Definition at line 1109 of file mathplot.h.
Referenced by mpScaleXBase::Plot(), mpMovableObject::Plot(), and mpBitmapLayer::Plot().
|
inline |
Definition at line 1116 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 1138 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 1147 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 1122 of file mathplot.h.
|
inline |
Get current view's X scale.
See rules for coordinate transformation
Definition at line 1108 of file mathplot.h.
|
inline |
|
inline |
Get current view's Y position.
See rules for coordinate transformation
Definition at line 1129 of file mathplot.h.
|
inline |
Get current view's Y scale.
See rules for coordinate transformation
Definition at line 1115 of file mathplot.h.
|
inline |
Definition at line 1148 of file mathplot.h.
|
inline |
Checks whether the X/Y scale aspect is locked.
true | Locked |
false | Unlocked |
Definition at line 1233 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 2725 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 2754 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 2774 of file mathplot.cpp.
References GetLayer(), and mpLayer::IsVisible().
|
inline |
Limit zooming & panning to the area used by the plots.
Definition at line 1429 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 2219 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 2249 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 |
|
protected |
Definition at line 2237 of file mathplot.cpp.
References LockAspect(), and m_lockaspect.
|
protected |
|
protected |
Definition at line 1898 of file mathplot.cpp.
References IsInsideInfoLayer(), m_mouseLClick, m_movingInfoLayer, and m_zooming.
|
protected |
Definition at line 1910 of file mathplot.cpp.
References m_mouseLClick, m_movingInfoLayer, m_zooming, mpInfoLayer::UpdateReference(), and ZoomRect().
|
protected |
|
protected |
Definition at line 1807 of file mathplot.cpp.
References mpInfoLayer::GetRectangle(), m_desiredXmax, m_desiredXmin, m_desiredYmax, m_desiredYmin, m_enableMouseNavigation, m_fgColour, m_layers, m_mouseLClick, m_mouseMClick, m_movingInfoLayer, m_posX, m_posY, m_scaleX, m_scaleY, m_zooming, m_zoomRect, mpInfoLayer::Move(), SetXView(), SetYView(), UpdateAll(), and mpInfoLayer::UpdateInfo().
|
protected |
Definition at line 1752 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 2338 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 2595 of file mathplot.cpp.
References DoScrollCalc().
|
protected |
Definition at line 2569 of file mathplot.cpp.
References DoScrollCalc(), and mpSCROLL_NUM_PIXELS_PER_LINE.
|
protected |
Definition at line 2553 of file mathplot.cpp.
References DoScrollCalc(), and mpSCROLL_NUM_PIXELS_PER_LINE.
|
protected |
Definition at line 2533 of file mathplot.cpp.
References DoScrollCalc().
|
protected |
Definition at line 2515 of file mathplot.cpp.
References DoScrollCalc().
|
protected |
Definition at line 2509 of file mathplot.cpp.
References DoScrollCalc().
|
protected |
Definition at line 2589 of file mathplot.cpp.
References DoScrollCalc().
|
protected |
Definition at line 2229 of file mathplot.cpp.
References m_clickedX, m_clickedY, and m_popmenu.
|
protected |
Definition at line 2271 of file mathplot.cpp.
References Fit(), m_desiredXmax, m_desiredXmin, m_desiredYmax, and m_desiredYmin.
|
protected |
Definition at line 2259 of file mathplot.cpp.
References m_mouseMClick, and ZoomIn().
|
protected |
|
inline |
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates, using current mpWindow position and scale.
Definition at line 1192 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 1197 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 2664 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 SIM_PLOT_FRAME::menuSaveImage().
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 2782 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 2762 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 2742 of file mathplot.cpp.
References GetLayerByName(), name, mpLayer::SetVisible(), and UpdateAll().
|
inline |
Set the bottom margin.
bottom | Bottom Margin |
Definition at line 1366 of file mathplot.h.
|
inline |
Set the left margin.
left | Left Margin |
Definition at line 1368 of file mathplot.h.
References left.
|
inline |
Set the right margin.
right | Right Margin |
Definition at line 1364 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 2716 of file mathplot.cpp.
References left, m_marginBottom, m_marginLeft, m_marginRight, m_marginTop, and right.
Referenced by SIM_PLOT_PANEL::SIM_PLOT_PANEL().
|
inline |
Set the top margin.
top | Top Margin |
Definition at line 1362 of file mathplot.h.
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 1180 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 1169 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 1174 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 2609 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 1158 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 1187 of file mathplot.h.
Referenced by SaveScreenshot().
|
protectedvirtual |
Applies new X view coordinates depending on the settings.
Definition at line 2064 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 2078 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 2437 of file mathplot.cpp.
References m_desiredXmax, m_desiredXmin, m_desiredYmax, m_desiredYmin, m_enableScrollBars, m_marginBottom, m_marginLeft, m_marginRight, m_marginTop, m_maxX, m_maxY, m_minX, m_minY, m_posX, m_posY, m_scaleX, m_scaleY, Refresh(), and UpdateBBox().
Referenced by AddLayer(), SIM_PLOT_PANEL::addTrace(), DelAllLayers(), DelLayer(), Fit(), 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().
|
protectedvirtual |
Recalculate global layer bounding box, and save it in m_minX,...
Definition at line 2426 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 1202 of file mathplot.h.
Referenced by CURSOR::Inside(), CURSOR::Plot(), mpFY::Plot(), mpFXY::Plot(), mpScaleY::Plot(), mpMovableObject::Plot(), mpBitmapLayer::Plot(), and CURSOR::UpdateReference().
|
inline |
Converts graph (floating point) coordinates into mpWindow (screen) pixel coordinates, using current mpWindow position and scale.
Definition at line 1207 of file mathplot.h.
Referenced by CURSOR::Inside(), CURSOR::Plot(), mpFX::Plot(), mpFXY::Plot(), mpProfile::Plot(), mpScaleXBase::Plot(), mpMovableObject::Plot(), mpBitmapLayer::Plot(), and CURSOR::UpdateReference().
void mpWindow::ZoomIn | ( | const wxPoint & | centerPoint, |
double | zoomFactor | ||
) |
Definition at line 2098 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 2092 of file mathplot.cpp.
References ZoomIn(), and zoomIncrementalFactor.
Referenced by SIM_PLOT_FRAME::menuZoomIn(), OnMouseWheel(), OnZoomIn(), and ZoomIn().
void mpWindow::ZoomInX | ( | ) |
Zoom in current view along X and refresh display.
Definition at line 2193 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 2155 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 2149 of file mathplot.cpp.
References zoomIncrementalFactor, and ZoomOut().
Referenced by SIM_PLOT_FRAME::menuZoomOut(), OnMouseWheel(), OnZoomOut(), 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 2200 of file mathplot.cpp.
References AdjustLimitedView(), Fit(), p2x(), and p2y().
Referenced by OnMouseLeftRelease().
|
protected |
Definition at line 1506 of file mathplot.h.
Referenced by SetColourTheme().
|
protected |
Definition at line 1504 of file mathplot.h.
Referenced by mpWindow(), and SetColourTheme().
|
protected |
Definition at line 1530 of file mathplot.h.
Referenced by mpWindow(), OnPaint(), and ~mpWindow().
|
protected |
Definition at line 1529 of file mathplot.h.
Referenced by mpWindow(), and OnPaint().
|
protected |
Definition at line 1518 of file mathplot.h.
Referenced by OnCenter(), and OnShowPopupMenu().
|
protected |
Definition at line 1519 of file mathplot.h.
Referenced by OnCenter(), and OnShowPopupMenu().
|
protected |
Definition at line 1524 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 1524 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 1524 of file mathplot.h.
Referenced by AdjustLimitedView(), DoScrollCalc(), Fit(), LockAspect(), mpWindow(), OnMouseMove(), OnMouseWheel(), OnSize(), SaveScreenshot(), SetYView(), UpdateAll(), ZoomIn(), and ZoomOut().
|
protected |
Definition at line 1524 of file mathplot.h.
Referenced by AdjustLimitedView(), Fit(), LockAspect(), mpWindow(), OnMouseMove(), OnMouseWheel(), OnSize(), SaveScreenshot(), SetYView(), UpdateAll(), ZoomIn(), and ZoomOut().
|
protected |
Definition at line 1531 of file mathplot.h.
Referenced by mpWindow(), and OnPaint().
|
protected |
Definition at line 1534 of file mathplot.h.
Referenced by AdjustLimitedView(), and mpWindow().
|
protected |
Definition at line 1532 of file mathplot.h.
Referenced by mpWindow(), OnMouseMove(), and OnMouseWheel().
|
protected |
Definition at line 1533 of file mathplot.h.
Referenced by OnMouseWheel().
|
protected |
Definition at line 1537 of file mathplot.h.
Referenced by mpWindow(), OnPaint(), and UpdateAll().
|
protected |
Definition at line 1505 of file mathplot.h.
Referenced by mpWindow(), OnMouseMove(), OnPaint(), SaveScreenshot(), and SetColourTheme().
|
protected |
Definition at line 1528 of file mathplot.h.
Referenced by mpWindow(), and OnPaint().
|
protected |
Definition at line 1528 of file mathplot.h.
Referenced by mpWindow(), and OnPaint().
|
protected |
Definition at line 1500 of file mathplot.h.
Referenced by AddLayer(), CountLayers(), DelAllLayers(), DelLayer(), GetLayer(), GetLayerByName(), IsInsideInfoLayer(), mpWindow(), OnMouseMove(), OnPaint(), SaveScreenshot(), and SetColourTheme().
|
protected |
Definition at line 1502 of file mathplot.h.
Referenced by Fit(), LockAspect(), mpWindow(), and OnLockAspect().
|
protected |
Definition at line 1526 of file mathplot.h.
Referenced by AdjustLimitedView(), Fit(), mpWindow(), OnCenter(), SetMargins(), UpdateAll(), ZoomIn(), and ZoomOut().
|
protected |
Definition at line 1526 of file mathplot.h.
Referenced by AdjustLimitedView(), DoScrollCalc(), DoZoomInXCalc(), Fit(), mpWindow(), OnCenter(), SetMargins(), UpdateAll(), ZoomIn(), and ZoomOut().
|
protected |
Definition at line 1526 of file mathplot.h.
Referenced by AdjustLimitedView(), DoZoomInXCalc(), Fit(), mpWindow(), OnCenter(), SetMargins(), UpdateAll(), ZoomIn(), and ZoomOut().
|
protected |
Definition at line 1526 of file mathplot.h.
Referenced by AdjustLimitedView(), DoScrollCalc(), Fit(), mpWindow(), OnCenter(), SetMargins(), UpdateAll(), ZoomIn(), and ZoomOut().
|
protected |
Definition at line 1509 of file mathplot.h.
Referenced by AdjustLimitedView(), Fit(), GetBoundingBox(), mpWindow(), SaveScreenshot(), UpdateAll(), and UpdateBBox().
|
protected |
Definition at line 1511 of file mathplot.h.
Referenced by AdjustLimitedView(), DoScrollCalc(), Fit(), GetBoundingBox(), mpWindow(), SaveScreenshot(), UpdateAll(), and UpdateBBox().
|
protected |
Definition at line 1508 of file mathplot.h.
Referenced by AdjustLimitedView(), DoScrollCalc(), Fit(), GetBoundingBox(), mpWindow(), SaveScreenshot(), UpdateAll(), and UpdateBBox().
|
protected |
Definition at line 1510 of file mathplot.h.
Referenced by AdjustLimitedView(), Fit(), GetBoundingBox(), mpWindow(), SaveScreenshot(), UpdateAll(), and UpdateBBox().
|
protected |
Definition at line 1536 of file mathplot.h.
Referenced by OnMouseLeftDown(), OnMouseLeftRelease(), and OnMouseMove().
|
protected |
Definition at line 1535 of file mathplot.h.
Referenced by OnMouseMiddleDown(), OnMouseMove(), and OnZoomIn().
|
protected |
Definition at line 1539 of file mathplot.h.
Referenced by mpWindow(), OnMouseLeftDown(), OnMouseLeftRelease(), and OnMouseMove().
|
protected |
Definition at line 1501 of file mathplot.h.
Referenced by LockAspect(), mpWindow(), and OnShowPopupMenu().
|
protected |
Definition at line 1514 of file mathplot.h.
Referenced by AdjustLimitedView(), DoZoomInXCalc(), Fit(), mpWindow(), OnMouseMove(), OnMouseWheel(), SetXView(), UpdateAll(), ZoomIn(), and ZoomOut().
|
protected |
Definition at line 1515 of file mathplot.h.
Referenced by AdjustLimitedView(), Fit(), mpWindow(), OnMouseMove(), OnMouseWheel(), SetYView(), UpdateAll(), ZoomIn(), and ZoomOut().
|
protected |
Definition at line 1512 of file mathplot.h.
Referenced by AdjustLimitedView(), DoScrollCalc(), DoZoomInXCalc(), Fit(), mpWindow(), OnMouseMove(), OnMouseWheel(), SetScaleX(), UpdateAll(), ZoomIn(), ZoomInX(), and ZoomOut().
|
protected |
Definition at line 1513 of file mathplot.h.
Referenced by AdjustLimitedView(), DoScrollCalc(), Fit(), mpWindow(), OnMouseMove(), OnMouseWheel(), UpdateAll(), ZoomIn(), and ZoomOut().
|
protected |
Definition at line 1538 of file mathplot.h.
|
protected |
Definition at line 1516 of file mathplot.h.
Referenced by DoZoomInXCalc(), Fit(), mpWindow(), OnCenter(), OnPaint(), SaveScreenshot(), ZoomIn(), and ZoomOut().
|
protected |
Definition at line 1517 of file mathplot.h.
Referenced by Fit(), mpWindow(), OnCenter(), OnPaint(), SaveScreenshot(), ZoomIn(), and ZoomOut().
|
protected |
Definition at line 1540 of file mathplot.h.
Referenced by mpWindow(), OnMouseLeftDown(), OnMouseLeftRelease(), OnMouseMove(), and OnPaint().
|
protected |
Definition at line 1541 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 1351 of file mathplot.h.
Referenced by DoZoomInXCalc(), ZoomIn(), ZoomInX(), and ZoomOut().