#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 () |
bool | AddLayer (mpLayer *layer, bool refreshDisplay=true) |
bool | DelLayer (mpLayer *layer, bool alsoDeleteObject=false, bool refreshDisplay=true) |
void | DelAllLayers (bool alsoDeleteObject, bool refreshDisplay=true) |
mpLayer * | GetLayer (int position) |
mpLayer * | GetLayerByName (const wxString &name) |
double | GetXscl () |
double | GetScaleX (void) const |
double | GetYscl () const |
double | GetScaleY (void) const |
double | GetXpos () const |
double | GetPosX (void) const |
double | GetYpos () const |
double | GetPosY (void) const |
int | GetScrX (void) const |
int | GetXScreen (void) const |
int | GetScrY (void) const |
int | GetYScreen (void) const |
void | SetScaleX (double scaleX) |
void | SetScaleY (double scaleY) |
void | SetPosX (double posX) |
void | SetPosY (double posY) |
void | SetPos (double posX, double posY) |
void | SetScr (int scrX, int scrY) |
double | p2x (wxCoord pixelCoordX) |
double | p2y (wxCoord pixelCoordY) |
wxCoord | x2p (double x) |
wxCoord | y2p (double y) |
void | EnableDoubleBuffer (bool enabled) |
void | EnableMousePanZoom (bool enabled) |
void | LockAspect (bool enable=TRUE) |
bool | IsAspectLocked () |
void | Fit () |
void | Fit (double xMin, double xMax, double yMin, double yMax, wxCoord *printSizeX=NULL, wxCoord *printSizeY=NULL) |
void | ZoomIn (const wxPoint ¢erPoint=wxDefaultPosition) |
void | ZoomOut (const wxPoint ¢erPoint=wxDefaultPosition) |
void | ZoomInX () |
void | ZoomOutX () |
void | ZoomInY () |
void | ZoomOutY () |
void | ZoomRect (wxPoint p0, wxPoint p1) |
void | UpdateAll () |
unsigned int | CountLayers () |
unsigned int | CountAllLayers () |
double | GetDesiredXmin () |
double | GetDesiredXmax () |
double | GetDesiredYmin () |
double | GetDesiredYmax () |
void | GetBoundingBox (double *bbox) |
void | SetMPScrollbars (bool status) |
bool | GetMPScrollbars () |
bool | SaveScreenshot (const wxString &filename, int type=wxBITMAP_TYPE_BMP, wxSize imageSize=wxDefaultSize, bool fit=false) |
void | SetMargins (int top, int right, int bottom, int left) |
void | SetMarginTop (int top) |
void | SetMarginRight (int right) |
void | SetMarginBottom (int bottom) |
void | SetMarginLeft (int left) |
int | GetMarginTop () |
int | GetMarginRight () |
int | GetMarginBottom () |
int | GetMarginLeft () |
mpInfoLayer * | IsInsideInfoLayer (wxPoint &point) |
void | SetLayerVisible (const wxString &name, bool viewable) |
bool | IsLayerVisible (const wxString &name) |
void | SetLayerVisible (const unsigned int position, bool viewable) |
bool | IsLayerVisible (const unsigned int position) |
void | SetColourTheme (const wxColour &bgColour, const wxColour &drawColour, const wxColour &axesColour) |
const wxColour & | GetAxesColour () |
Static Public Attributes | |
static double | zoomIncrementalFactor = 1.5 |
Protected Member Functions | |
void | OnPaint (wxPaintEvent &event) |
Paint handler, will plot all attached layers. | |
void | OnSize (wxSizeEvent &event) |
Size handler, will update scroll bar sizes. | |
void | OnShowPopupMenu (wxMouseEvent &event) |
Mouse handler, will show context menu. | |
void | OnMouseRightDown (wxMouseEvent &event) |
Mouse handler, for detecting when the user drags with the right button or just "clicks" for the menu. | |
void | OnCenter (wxCommandEvent &event) |
Context menu handler. | |
void | OnFit (wxCommandEvent &event) |
Context menu handler. | |
void | OnZoomIn (wxCommandEvent &event) |
Context menu handler. | |
void | OnZoomOut (wxCommandEvent &event) |
Context menu handler. | |
void | OnLockAspect (wxCommandEvent &event) |
Context menu handler. | |
void | OnMouseHelp (wxCommandEvent &event) |
Context menu handler. | |
void | OnMouseWheel (wxMouseEvent &event) |
Mouse handler for the wheel. | |
void | OnMouseMove (wxMouseEvent &event) |
Mouse handler for mouse motion (for pan). | |
void | OnMouseLeftDown (wxMouseEvent &event) |
Mouse left click (for rect zoom). | |
void | OnMouseLeftRelease (wxMouseEvent &event) |
Mouse left click (for rect zoom). | |
void | OnScrollThumbTrack (wxScrollWinEvent &event) |
Scroll thumb on scroll bar moving. | |
void | OnScrollPageUp (wxScrollWinEvent &event) |
Scroll page up. | |
void | OnScrollPageDown (wxScrollWinEvent &event) |
Scroll page down. | |
void | OnScrollLineUp (wxScrollWinEvent &event) |
Scroll line up. | |
void | OnScrollLineDown (wxScrollWinEvent &event) |
Scroll line down. | |
void | OnScrollTop (wxScrollWinEvent &event) |
Scroll to top. | |
void | OnScrollBottom (wxScrollWinEvent &event) |
Scroll to bottom. | |
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) |
virtual bool | UpdateBBox () |
Protected Attributes | |
wxLayerList | m_layers |
List of attached plot layers. | |
wxMenu | m_popmenu |
Canvas' context menu. | |
bool | m_lockaspect |
Scale aspect is locked or not. | |
wxColour | m_bgColour |
Background Colour. | |
wxColour | m_fgColour |
Foreground Colour. | |
wxColour | m_axColour |
Axes Colour. | |
double | m_minX |
Global layer bounding box, left border incl. | |
double | m_maxX |
Global layer bounding box, right border incl. | |
double | m_minY |
Global layer bounding box, bottom border incl. | |
double | m_maxY |
Global layer bounding box, top border incl. | |
double | m_scaleX |
Current view's X scale. | |
double | m_scaleY |
Current view's Y scale. | |
double | m_posX |
Current view's X position. | |
double | m_posY |
Current view's Y position. | |
int | m_scrX |
Current view's X dimension. | |
int | m_scrY |
Current view's Y dimension. | |
int | m_clickedX |
Last mouse click X position, for centering and zooming the view. | |
int | m_clickedY |
Last mouse click Y position, for centering and zooming the view. | |
double | m_desiredXmin |
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 |
For double buffering. | |
wxMemoryDC | m_buff_dc |
For double buffering. | |
wxBitmap * | m_buff_bmp |
For double buffering. | |
bool | m_enableDoubleBuffer |
For double buffering. | |
bool | m_enableMouseNavigation |
For pan/zoom with the mouse. | |
bool | m_mouseMovedAfterRightClick |
long | m_mouseRClick_X |
long | m_mouseRClick_Y |
For the right button "drag" feature. | |
int | m_mouseLClick_X |
int | m_mouseLClick_Y |
Starting coords for rectangular zoom selection. | |
bool | m_enableScrollBars |
int | m_scrollX |
int | m_scrollY |
mpInfoLayer * | m_movingInfoLayer |
For moving info layers over the window area. |
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:
mpWindow::mpWindow | ( | ) | [inline] |
mpWindow::mpWindow | ( | wxWindow * | parent, | |
wxWindowID | id, | |||
const wxPoint & | pos = wxDefaultPosition , |
|||
const wxSize & | size = wxDefaultSize , |
|||
long | flags = 0 | |||
) |
mpWindow::~mpWindow | ( | ) |
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. |
References m_layers, and UpdateAll().
unsigned int mpWindow::CountAllLayers | ( | ) | [inline] |
Counts the number of plot layers, whether or not they have a bounding box.
Referenced by mpPrintout::OnPrintPage(), and mpInfoLegend::Plot().
unsigned int mpWindow::CountLayers | ( | ) |
Counts the number of plot layers, excluding axes or text: this is to count only the layers which have a bounding box.
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. |
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!
References m_layers, and UpdateAll().
void mpWindow::DoScrollCalc | ( | const int | position, | |
const int | orientation | |||
) | [protected] |
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().
void mpWindow::DoZoomInXCalc | ( | const int | staticXpixel | ) | [protected] |
References m_desiredXmax, m_desiredXmin, m_marginLeft, m_marginRight, m_posX, m_scaleX, m_scrX, p2x(), and zoomIncrementalFactor.
void mpWindow::DoZoomInYCalc | ( | const int | staticYpixel | ) | [protected] |
References m_desiredYmax, m_desiredYmin, m_marginBottom, m_marginTop, m_posY, m_scaleY, m_scrY, p2y(), and zoomIncrementalFactor.
void mpWindow::DoZoomOutXCalc | ( | const int | staticXpixel | ) | [protected] |
References m_desiredXmax, m_desiredXmin, m_marginLeft, m_marginRight, m_posX, m_scaleX, m_scrX, p2x(), and zoomIncrementalFactor.
void mpWindow::DoZoomOutYCalc | ( | const int | staticYpixel | ) | [protected] |
References m_desiredYmax, m_desiredYmin, m_marginBottom, m_marginTop, m_posY, m_scaleY, m_scrY, p2y(), and zoomIncrementalFactor.
void mpWindow::EnableDoubleBuffer | ( | bool | enabled | ) | [inline] |
Enable/disable the double-buffering of the window, eliminating the flicker (default=disabled).
void mpWindow::EnableMousePanZoom | ( | bool | enabled | ) | [inline] |
Enable/disable the feature of pan/zoom with the mouse (default=enabled)
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.
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().
void mpWindow::Fit | ( | ) |
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.
References m_maxX, m_maxY, m_minX, m_minY, and UpdateBBox().
Referenced by LockAspect(), mpPrintout::OnPrintPage(), SaveScreenshot(), and ZoomRect().
const wxColour& mpWindow::GetAxesColour | ( | ) | [inline] |
Get axes draw colour
Referenced by mpPrintout::OnPrintPage().
void mpWindow::GetBoundingBox | ( | double * | bbox | ) |
double mpWindow::GetDesiredXmax | ( | ) | [inline] |
Returns the right-border layer coordinate that the user wants the mpWindow to show (it may be not exactly the actual shown coordinate in the case of locked aspect ratio).
Referenced by mpPrintout::OnPrintPage().
double mpWindow::GetDesiredXmin | ( | ) | [inline] |
Draws the mpWindow on a page for printing
the mpPrintout where to print the graph 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). |
Referenced by mpPrintout::OnPrintPage().
double mpWindow::GetDesiredYmax | ( | ) | [inline] |
Returns the top layer-border coordinate that the user wants the mpWindow to show (it may be not exactly the actual shown coordinate in the case of locked aspect ratio).
Referenced by mpPrintout::OnPrintPage(), and mpScaleY::Plot().
double mpWindow::GetDesiredYmin | ( | ) | [inline] |
Returns the bottom-border layer coordinate that the user wants the mpWindow to show (it may be not exactly the actual shown coordinate in the case of locked aspect ratio).
Referenced by mpPrintout::OnPrintPage(), and mpScaleY::Plot().
mpLayer * mpWindow::GetLayer | ( | int | position | ) |
Get the layer in list position indicated. N.B. You must know the index of the layer inside the list!
position | position of the layer in the layers list |
References m_layers.
Referenced by IsLayerVisible(), mpPrintout::OnPrintPage(), mpInfoLegend::Plot(), and SetLayerVisible().
mpLayer * mpWindow::GetLayerByName | ( | const wxString & | name | ) |
Get the layer by its name (case sensitive).
name | The name of the layer to retrieve |
References m_layers.
Referenced by IsLayerVisible(), and SetLayerVisible().
int mpWindow::GetMarginBottom | ( | ) | [inline] |
Get the bottom margin.
bottom | Bottom Margin |
Referenced by mpText::Plot(), mpScaleY::Plot(), mpScaleX::Plot(), mpProfile::Plot(), mpFXY::Plot(), mpFY::Plot(), and mpFX::Plot().
int mpWindow::GetMarginLeft | ( | ) | [inline] |
Get the left margin.
left | Left Margin |
Referenced by mpText::Plot(), mpScaleY::Plot(), mpScaleX::Plot(), mpProfile::Plot(), mpFXY::Plot(), mpFY::Plot(), and mpFX::Plot().
int mpWindow::GetMarginRight | ( | ) | [inline] |
Get the right margin.
right | Right Margin |
Referenced by mpText::Plot(), mpScaleY::Plot(), mpScaleX::Plot(), mpProfile::Plot(), mpFXY::Plot(), mpFY::Plot(), and mpFX::Plot().
int mpWindow::GetMarginTop | ( | ) | [inline] |
Get the top margin.
top | Top Margin |
Referenced by mpText::Plot(), mpScaleY::Plot(), mpScaleX::Plot(), mpProfile::Plot(), mpFXY::Plot(), mpFY::Plot(), and mpFX::Plot().
bool mpWindow::GetMPScrollbars | ( | ) | [inline] |
Get scrollbars status.
wxMenu* mpWindow::GetPopupMenu | ( | ) | [inline] |
Get reference to context menu of the plot canvas.
double mpWindow::GetPosX | ( | void | ) | const [inline] |
Referenced by mpBitmapLayer::Plot(), mpMovableObject::Plot(), and mpScaleX::Plot().
double mpWindow::GetPosY | ( | void | ) | const [inline] |
Referenced by mpBitmapLayer::Plot(), mpMovableObject::Plot(), and mpScaleY::Plot().
double mpWindow::GetScaleX | ( | void | ) | const [inline] |
Referenced by mpBitmapLayer::Plot(), mpMovableObject::Plot(), and mpScaleX::Plot().
double mpWindow::GetScaleY | ( | void | ) | const [inline] |
Referenced by mpBitmapLayer::Plot(), mpMovableObject::Plot(), and mpScaleY::Plot().
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
Referenced by mpPrintout::OnPrintPage(), mpBitmapLayer::Plot(), mpMovableObject::Plot(), mpText::Plot(), mpScaleY::Plot(), mpScaleX::Plot(), mpProfile::Plot(), mpFXY::Plot(), mpFY::Plot(), mpFX::Plot(), mpInfoLegend::Plot(), mpInfoCoords::Plot(), and mpInfoLayer::Plot().
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
Referenced by mpPrintout::OnPrintPage(), mpBitmapLayer::Plot(), mpMovableObject::Plot(), mpText::Plot(), mpScaleY::Plot(), mpScaleX::Plot(), mpProfile::Plot(), mpFXY::Plot(), mpFY::Plot(), mpFX::Plot(), mpInfoLegend::Plot(), mpInfoCoords::Plot(), and mpInfoLayer::Plot().
double mpWindow::GetXpos | ( | ) | const [inline] |
Get current view's X position. See rules for coordinate transformation
double mpWindow::GetXscl | ( | ) | [inline] |
Get current view's X scale. See rules for coordinate transformation
int mpWindow::GetXScreen | ( | void | ) | const [inline] |
double mpWindow::GetYpos | ( | ) | const [inline] |
Get current view's Y position. See rules for coordinate transformation
double mpWindow::GetYscl | ( | ) | const [inline] |
Get current view's Y scale. See rules for coordinate transformation
int mpWindow::GetYScreen | ( | void | ) | const [inline] |
bool mpWindow::IsAspectLocked | ( | ) | [inline] |
Checks whether the X/Y scale aspect is locked.
TRUE | Locked | |
FALSE | Unlocked |
mpInfoLayer * mpWindow::IsInsideInfoLayer | ( | wxPoint & | point | ) |
Sets whether to show coordinate tooltip when mouse passes over the plot.
value | true for enable, false for disable Gets coordinate tooltip status. |
point | The position to be checked |
References mpInfoLayer::Inside(), and m_layers.
Referenced by OnMouseLeftDown().
bool mpWindow::IsLayerVisible | ( | const unsigned int | position | ) |
Check whether the layer at given position is visible
position | The layer position in layer list |
References GetLayer(), and mpLayer::IsVisible().
bool mpWindow::IsLayerVisible | ( | const wxString & | name | ) |
Check whether a layer with given name is visible
name | The layer name |
References GetLayerByName(), and mpLayer::IsVisible().
void mpWindow::LockAspect | ( | bool | enable = TRUE |
) |
Enable or disable X/Y scale aspect locking for the view.
References Fit(), m_desiredXmax, m_desiredXmin, m_desiredYmax, m_desiredYmin, m_lockaspect, m_popmenu, and mpID_LOCKASPECT.
void mpWindow::OnCenter | ( | wxCommandEvent & | event | ) | [protected] |
Context menu handler.
void mpWindow::OnFit | ( | wxCommandEvent & | event | ) | [protected] |
Context menu handler.
void mpWindow::OnLockAspect | ( | wxCommandEvent & | event | ) | [protected] |
Context menu handler.
void mpWindow::OnMouseHelp | ( | wxCommandEvent & | event | ) | [protected] |
Context menu handler.
void mpWindow::OnMouseLeftDown | ( | wxMouseEvent & | event | ) | [protected] |
Mouse left click (for rect zoom).
References IsInsideInfoLayer(), m_mouseLClick_X, m_mouseLClick_Y, and m_movingInfoLayer.
void mpWindow::OnMouseLeftRelease | ( | wxMouseEvent & | event | ) | [protected] |
Mouse left click (for rect zoom).
References m_mouseLClick_X, m_mouseLClick_Y, m_movingInfoLayer, mpInfoLayer::UpdateReference(), and ZoomRect().
void mpWindow::OnMouseMove | ( | wxMouseEvent & | event | ) | [protected] |
Mouse handler for mouse motion (for pan).
References mpInfoLayer::GetRectangle(), m_desiredXmax, m_desiredXmin, m_desiredYmax, m_desiredYmin, m_enableMouseNavigation, m_layers, m_mouseLClick_X, m_mouseLClick_Y, m_mouseMovedAfterRightClick, m_mouseRClick_X, m_mouseRClick_Y, m_movingInfoLayer, m_posX, m_posY, m_scaleX, m_scaleY, mpInfoLayer::Move(), UpdateAll(), and mpInfoLayer::UpdateInfo().
void mpWindow::OnMouseRightDown | ( | wxMouseEvent & | event | ) | [protected] |
Mouse handler, for detecting when the user drags with the right button or just "clicks" for the menu.
References m_enableMouseNavigation, m_mouseMovedAfterRightClick, m_mouseRClick_X, and m_mouseRClick_Y.
void mpWindow::OnMouseWheel | ( | wxMouseEvent & | event | ) | [protected] |
Mouse handler for the wheel.
References m_desiredXmax, m_desiredXmin, m_desiredYmax, m_enableMouseNavigation, m_posX, m_posY, m_scaleX, m_scaleY, UpdateAll(), ZoomIn(), and ZoomOut().
void mpWindow::OnPaint | ( | wxPaintEvent & | event | ) | [protected] |
Paint handler, will plot all attached layers.
void mpWindow::OnScrollBottom | ( | wxScrollWinEvent & | event | ) | [protected] |
Scroll to bottom.
References DoScrollCalc().
void mpWindow::OnScrollLineDown | ( | wxScrollWinEvent & | event | ) | [protected] |
Scroll line down.
References DoScrollCalc(), and mpSCROLL_NUM_PIXELS_PER_LINE.
void mpWindow::OnScrollLineUp | ( | wxScrollWinEvent & | event | ) | [protected] |
Scroll line up.
References DoScrollCalc(), and mpSCROLL_NUM_PIXELS_PER_LINE.
void mpWindow::OnScrollPageDown | ( | wxScrollWinEvent & | event | ) | [protected] |
Scroll page down.
References DoScrollCalc().
void mpWindow::OnScrollPageUp | ( | wxScrollWinEvent & | event | ) | [protected] |
Scroll page up.
References DoScrollCalc().
void mpWindow::OnScrollThumbTrack | ( | wxScrollWinEvent & | event | ) | [protected] |
Scroll thumb on scroll bar moving.
References DoScrollCalc().
void mpWindow::OnScrollTop | ( | wxScrollWinEvent & | event | ) | [protected] |
Scroll to top.
References DoScrollCalc().
void mpWindow::OnShowPopupMenu | ( | wxMouseEvent & | event | ) | [protected] |
Mouse handler, will show context menu.
References m_clickedX, m_clickedY, m_enableMouseNavigation, m_mouseMovedAfterRightClick, and m_popmenu.
void mpWindow::OnSize | ( | wxSizeEvent & | event | ) | [protected] |
Size handler, will update scroll bar sizes.
void mpWindow::OnZoomIn | ( | wxCommandEvent & | event | ) | [protected] |
Context menu handler.
void mpWindow::OnZoomOut | ( | wxCommandEvent & | event | ) | [protected] |
Context menu handler.
double mpWindow::p2x | ( | wxCoord | pixelCoordX | ) | [inline] |
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates, using current mpWindow position and scale.
Referenced by DoZoomInXCalc(), DoZoomOutXCalc(), mpProfile::Plot(), mpFX::Plot(), mpInfoCoords::UpdateInfo(), ZoomIn(), ZoomOut(), and ZoomRect().
double mpWindow::p2y | ( | wxCoord | pixelCoordY | ) | [inline] |
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates, using current mpWindow position and scale.
Referenced by DoZoomInYCalc(), DoZoomOutYCalc(), mpFY::Plot(), mpInfoCoords::UpdateInfo(), ZoomIn(), ZoomOut(), and ZoomRect().
bool mpWindow::SaveScreenshot | ( | const wxString & | filename, | |
int | 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 |
References Fit(), m_desiredXmax, m_desiredXmin, m_desiredYmax, m_desiredYmin, m_layers, m_maxX, m_maxY, m_minX, m_minY, m_scrX, m_scrY, SetScr(), and UpdateAll().
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) |
References m_axColour, m_bgColour, m_fgColour, m_layers, mpLAYER_AXIS, and mpLAYER_INFO.
Referenced by mpPrintout::OnPrintPage().
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 |
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 |
References GetLayerByName(), mpLayer::SetVisible(), and UpdateAll().
void mpWindow::SetMarginBottom | ( | int | bottom | ) | [inline] |
Set the bottom margin.
bottom | Bottom Margin |
void mpWindow::SetMarginLeft | ( | int | left | ) | [inline] |
Set the left margin.
left | Left Margin |
void mpWindow::SetMarginRight | ( | int | right | ) | [inline] |
Set the right margin.
right | Right Margin |
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 |
References m_marginBottom, m_marginLeft, m_marginRight, and m_marginTop.
void mpWindow::SetMarginTop | ( | int | top | ) | [inline] |
Set the top margin.
top | Top Margin |
void mpWindow::SetMPScrollbars | ( | bool | status | ) |
Enable/disable scrollbars
status | Set to true to show scrollbars |
References m_enableScrollBars, and UpdateAll().
void mpWindow::SetPos | ( | double | posX, | |
double | posY | |||
) | [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. |
void mpWindow::SetPosX | ( | double | posX | ) | [inline] |
Set current view's X position and refresh display.
posX | New position that corresponds to the center point of the view. |
Referenced by DoScrollCalc().
void mpWindow::SetPosY | ( | double | posY | ) | [inline] |
Set current view's Y position and refresh display.
posY | New position that corresponds to the center point of the view. |
Referenced by DoScrollCalc().
void mpWindow::SetScaleX | ( | double | scaleX | ) |
Set current view's X scale and refresh display.
scaleX | New scale, must not be 0. |
References m_scaleX, and UpdateAll().
void mpWindow::SetScaleY | ( | double | scaleY | ) | [inline] |
Set current view's Y scale and refresh display.
scaleY | New scale, must not be 0. |
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.
scrX | New position that corresponds to the center point of the view. | |
scrY | New position that corresponds to the center point of the view. |
Referenced by SaveScreenshot().
void mpWindow::UpdateAll | ( | ) |
Refresh display
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, and UpdateBBox().
Referenced by AddLayer(), DelAllLayers(), DelLayer(), Fit(), OnMouseMove(), OnMouseWheel(), mpPrintout::OnPrintPage(), SaveScreenshot(), SetLayerVisible(), SetMPScrollbars(), SetScaleX(), ZoomIn(), ZoomInX(), ZoomInY(), ZoomOut(), ZoomOutX(), and ZoomOutY().
bool mpWindow::UpdateBBox | ( | ) | [protected, virtual] |
Recalculate global layer bounding box, and save it in m_minX,...
References mpLayer::GetMaxX(), mpLayer::GetMaxY(), mpLayer::GetMinX(), mpLayer::GetMinY(), mpLayer::HasBBox(), m_layers, m_maxX, m_maxY, m_minX, and m_minY.
Referenced by Fit(), and UpdateAll().
wxCoord mpWindow::x2p | ( | double | x | ) | [inline] |
Converts graph (floating point) coordinates into mpWindow (screen) pixel coordinates, using current mpWindow position and scale.
Referenced by mpBitmapLayer::Plot(), mpMovableObject::Plot(), mpScaleY::Plot(), mpFXY::Plot(), and mpFY::Plot().
wxCoord mpWindow::y2p | ( | double | y | ) | [inline] |
Converts graph (floating point) coordinates into mpWindow (screen) pixel coordinates, using current mpWindow position and scale.
Referenced by mpBitmapLayer::Plot(), mpMovableObject::Plot(), mpScaleX::Plot(), mpProfile::Plot(), mpFXY::Plot(), and mpFX::Plot().
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). |
References m_desiredXmax, m_desiredXmin, m_desiredYmax, m_desiredYmin, m_marginBottom, m_marginLeft, m_marginRight, m_marginTop, m_posX, m_posY, m_scaleX, m_scaleY, m_scrX, m_scrY, p2x(), p2y(), UpdateAll(), and zoomIncrementalFactor.
Referenced by OnMouseWheel().
void mpWindow::ZoomInX | ( | ) |
Zoom in current view along X and refresh display
References m_scaleX, UpdateAll(), and zoomIncrementalFactor.
void mpWindow::ZoomInY | ( | ) |
Zoom in current view along Y and refresh display
References m_scaleY, UpdateAll(), and zoomIncrementalFactor.
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). |
References m_desiredXmax, m_desiredXmin, m_desiredYmax, m_desiredYmin, m_marginBottom, m_marginLeft, m_marginRight, m_marginTop, m_posX, m_posY, m_scaleX, m_scaleY, m_scrX, m_scrY, p2x(), p2y(), UpdateAll(), and zoomIncrementalFactor.
Referenced by OnMouseWheel().
void mpWindow::ZoomOutX | ( | ) |
Zoom out current view along X and refresh display
References m_scaleX, UpdateAll(), and zoomIncrementalFactor.
void mpWindow::ZoomOutY | ( | ) |
Zoom out current view along Y and refresh display
References m_scaleY, UpdateAll(), and zoomIncrementalFactor.
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)
References Fit(), p2x(), and p2y().
Referenced by OnMouseLeftRelease().
wxColour mpWindow::m_axColour [protected] |
Axes Colour.
Referenced by SetColourTheme().
wxColour mpWindow::m_bgColour [protected] |
Background Colour.
Referenced by SetColourTheme().
wxBitmap* mpWindow::m_buff_bmp [protected] |
For double buffering.
Referenced by ~mpWindow().
wxMemoryDC mpWindow::m_buff_dc [protected] |
For double buffering.
int mpWindow::m_clickedX [protected] |
Last mouse click X position, for centering and zooming the view.
Referenced by OnShowPopupMenu().
int mpWindow::m_clickedY [protected] |
Last mouse click Y position, for centering and zooming the view.
Referenced by OnShowPopupMenu().
double mpWindow::m_desiredXmax [protected] |
Referenced by DoZoomInXCalc(), DoZoomOutXCalc(), Fit(), LockAspect(), OnMouseMove(), OnMouseWheel(), SaveScreenshot(), UpdateAll(), ZoomIn(), and ZoomOut().
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.
Referenced by DoScrollCalc(), DoZoomInXCalc(), DoZoomOutXCalc(), Fit(), LockAspect(), OnMouseMove(), OnMouseWheel(), SaveScreenshot(), UpdateAll(), ZoomIn(), and ZoomOut().
double mpWindow::m_desiredYmax [protected] |
Referenced by DoScrollCalc(), DoZoomInYCalc(), DoZoomOutYCalc(), Fit(), LockAspect(), OnMouseMove(), OnMouseWheel(), SaveScreenshot(), UpdateAll(), ZoomIn(), and ZoomOut().
double mpWindow::m_desiredYmin [protected] |
Referenced by DoZoomInYCalc(), DoZoomOutYCalc(), Fit(), LockAspect(), OnMouseMove(), SaveScreenshot(), UpdateAll(), ZoomIn(), and ZoomOut().
bool mpWindow::m_enableDoubleBuffer [protected] |
For double buffering.
bool mpWindow::m_enableMouseNavigation [protected] |
For pan/zoom with the mouse.
Referenced by OnMouseMove(), OnMouseRightDown(), OnMouseWheel(), and OnShowPopupMenu().
bool mpWindow::m_enableScrollBars [protected] |
Referenced by SetMPScrollbars(), and UpdateAll().
wxColour mpWindow::m_fgColour [protected] |
Foreground Colour.
Referenced by SetColourTheme().
int mpWindow::m_last_lx [protected] |
int mpWindow::m_last_ly [protected] |
For double buffering.
wxLayerList mpWindow::m_layers [protected] |
List of attached plot layers.
Referenced by AddLayer(), CountLayers(), DelAllLayers(), DelLayer(), GetLayer(), GetLayerByName(), IsInsideInfoLayer(), OnMouseMove(), SaveScreenshot(), SetColourTheme(), and UpdateBBox().
bool mpWindow::m_lockaspect [protected] |
Scale aspect is locked or not.
Referenced by Fit(), and LockAspect().
int mpWindow::m_marginBottom [protected] |
Referenced by DoZoomInYCalc(), DoZoomOutYCalc(), Fit(), SetMargins(), UpdateAll(), ZoomIn(), and ZoomOut().
int mpWindow::m_marginLeft [protected] |
Referenced by DoScrollCalc(), DoZoomInXCalc(), DoZoomOutXCalc(), Fit(), SetMargins(), UpdateAll(), ZoomIn(), and ZoomOut().
int mpWindow::m_marginRight [protected] |
Referenced by DoZoomInXCalc(), DoZoomOutXCalc(), Fit(), SetMargins(), UpdateAll(), ZoomIn(), and ZoomOut().
int mpWindow::m_marginTop [protected] |
Referenced by DoScrollCalc(), DoZoomInYCalc(), DoZoomOutYCalc(), Fit(), SetMargins(), UpdateAll(), ZoomIn(), and ZoomOut().
double mpWindow::m_maxX [protected] |
Global layer bounding box, right border incl.
Referenced by Fit(), GetBoundingBox(), SaveScreenshot(), UpdateAll(), and UpdateBBox().
double mpWindow::m_maxY [protected] |
Global layer bounding box, top border incl.
Referenced by DoScrollCalc(), Fit(), GetBoundingBox(), SaveScreenshot(), UpdateAll(), and UpdateBBox().
double mpWindow::m_minX [protected] |
Global layer bounding box, left border incl.
Referenced by DoScrollCalc(), Fit(), GetBoundingBox(), SaveScreenshot(), UpdateAll(), and UpdateBBox().
double mpWindow::m_minY [protected] |
Global layer bounding box, bottom border incl.
Referenced by Fit(), GetBoundingBox(), SaveScreenshot(), UpdateAll(), and UpdateBBox().
int mpWindow::m_mouseLClick_X [protected] |
Referenced by OnMouseLeftDown(), OnMouseLeftRelease(), and OnMouseMove().
int mpWindow::m_mouseLClick_Y [protected] |
Starting coords for rectangular zoom selection.
Referenced by OnMouseLeftDown(), OnMouseLeftRelease(), and OnMouseMove().
bool mpWindow::m_mouseMovedAfterRightClick [protected] |
Referenced by OnMouseMove(), OnMouseRightDown(), and OnShowPopupMenu().
long mpWindow::m_mouseRClick_X [protected] |
Referenced by OnMouseMove(), and OnMouseRightDown().
long mpWindow::m_mouseRClick_Y [protected] |
For the right button "drag" feature.
Referenced by OnMouseMove(), and OnMouseRightDown().
mpInfoLayer* mpWindow::m_movingInfoLayer [protected] |
For moving info layers over the window area.
Referenced by OnMouseLeftDown(), OnMouseLeftRelease(), and OnMouseMove().
wxMenu mpWindow::m_popmenu [protected] |
Canvas' context menu.
Referenced by LockAspect(), and OnShowPopupMenu().
double mpWindow::m_posX [protected] |
Current view's X position.
Referenced by DoZoomInXCalc(), DoZoomOutXCalc(), Fit(), OnMouseMove(), OnMouseWheel(), UpdateAll(), ZoomIn(), and ZoomOut().
double mpWindow::m_posY [protected] |
Current view's Y position.
Referenced by DoZoomInYCalc(), DoZoomOutYCalc(), Fit(), OnMouseMove(), OnMouseWheel(), UpdateAll(), ZoomIn(), and ZoomOut().
double mpWindow::m_scaleX [protected] |
Current view's X scale.
Referenced by DoScrollCalc(), DoZoomInXCalc(), DoZoomOutXCalc(), Fit(), OnMouseMove(), OnMouseWheel(), SetScaleX(), UpdateAll(), ZoomIn(), ZoomInX(), ZoomOut(), and ZoomOutX().
double mpWindow::m_scaleY [protected] |
Current view's Y scale.
Referenced by DoScrollCalc(), DoZoomInYCalc(), DoZoomOutYCalc(), Fit(), OnMouseMove(), OnMouseWheel(), UpdateAll(), ZoomIn(), ZoomInY(), ZoomOut(), and ZoomOutY().
int mpWindow::m_scrollX [protected] |
int mpWindow::m_scrollY [protected] |
int mpWindow::m_scrX [protected] |
Current view's X dimension.
Referenced by DoZoomInXCalc(), DoZoomOutXCalc(), Fit(), SaveScreenshot(), ZoomIn(), and ZoomOut().
int mpWindow::m_scrY [protected] |
Current view's Y dimension.
Referenced by DoZoomInYCalc(), DoZoomOutYCalc(), Fit(), SaveScreenshot(), ZoomIn(), and ZoomOut().
double mpWindow::zoomIncrementalFactor = 1.5 [static] |
This value sets the zoom steps whenever the user clicks "Zoom in/out" or performs zoom with the mouse wheel. It must be a number above unity. This number is used for zoom in, and its inverse for zoom out. Set to 1.5 by default.
Referenced by DoZoomInXCalc(), DoZoomInYCalc(), DoZoomOutXCalc(), DoZoomOutYCalc(), ZoomIn(), ZoomInX(), ZoomInY(), ZoomOut(), ZoomOutX(), and ZoomOutY().