MathPlot
|
Canvas for plotting mpLayer implementations. More...
#include <mathplot.h>
Public Member Functions | |
mpWindow (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long flags=0) | |
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, 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... | |
void | DelAllPlot (bool alsoDeleteObject, mpFunctionType func=mpfAllType, bool refreshDisplay=true) |
Remove all plot layers. More... | |
mpLayer * | GetLayer (int position) |
mpLayer * | GetLayersType (int position, mpLayerType type) |
mpLayer * | GetLayerPlot (int position, mpFunctionType func=mpfAllType) |
mpLayer * | GetLayerAxis (int position, mpScaleType scale=mpsAllType) |
mpFXYVector * | GetXYSeries (unsigned int n, const wxString &name=_T("Serie "), bool create=true) |
mpLayer * | GetClosestPlot (wxCoord ix, wxCoord iy, double *xnear, double *ynear, bool *isY2Axis) |
mpLayer * | GetLayerByName (const wxString &name) |
mpLayer * | GetLayerByClassName (const wxString &name) |
void | RefreshLegend (void) |
mpScaleX * | GetLayerXAxis () |
Get the first scale X layer (X axis) or NULL if not found. More... | |
mpScaleY * | GetLayerYAxis () |
Get the first scale Y layer (Y axis) or NULL if not found. More... | |
mpScaleY * | GetLayerY2Axis () |
Get the first scale Y2 layer (Y2 axis) or NULL if not found. More... | |
void | SetScaleX (const double scaleX) |
Set current view's X scale and refresh display. More... | |
double | GetScaleX (void) const |
Get current view's X scale. More... | |
void | SetScaleY (const double scaleY) |
Set current view's Y scale and refresh display. More... | |
double | GetScaleY (bool Y2=false) const |
Get current view's Y scale. More... | |
void | SetBound () |
Update bound for mpFX and mpFY when axis is scaled. More... | |
mpFloatRect | Get_Bound (void) const |
Get bounding box encompassing all visible plots on this mpWindow. More... | |
void | SetPosX (const double posX) |
Set current view's X position and refresh display. More... | |
double | GetPosX (void) const |
Get current view's X position. More... | |
void | SetPosY (const double posY, const double posY2) |
Set current view's Y position and refresh display. More... | |
double | GetPosY (bool Y2=false) const |
Get current view's Y position. More... | |
void | SetScreen (const int scrX, const int scrY) |
Set current view's dimensions in device context units. More... | |
int | GetScreenX (void) const |
Get current view's X dimension in device context units. More... | |
int | GetScreenY (void) const |
Get current view's Y dimension in device context units. More... | |
void | SetPos (const double posX, const double posY, const double posY2) |
Set current view's X and Y position and refresh display. More... | |
double | p2x (const wxCoord pixelCoordX) const |
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates, using current mpWindow position and scale. More... | |
double | p2y (const wxCoord pixelCoordY, bool Y2=false) const |
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates, using current mpWindow position and scale. More... | |
wxCoord | x2p (const double x) const |
Converts graph (floating point) coordinates into mpWindow (screen) pixel coordinates, using current mpWindow position and scale. More... | |
wxCoord | y2p (const double y, bool Y2=false) const |
Converts graph (floating point) coordinates into mpWindow (screen) pixel coordinates, using current mpWindow position and scale. More... | |
void | EnableDoubleBuffer (const bool enabled) |
Enable/disable the double-buffering of the window, eliminating the flicker (default=enabled). | |
void | EnableMousePanZoom (const bool enabled) |
Enable/disable the feature of pan/zoom with the mouse (default=enabled) | |
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... | |
bool | IsRepainting () const |
Checks if we are repainting. More... | |
void | Fit () |
Set view to fit global bounding box of all plot layers and refresh display with UpdateAll(). More... | |
void | Fit (const mpFloatRect &rect, wxCoord *printSizeX=NULL, wxCoord *printSizeY=NULL) |
Set view to fit a given bounding box and refresh display with UpdateAll(). More... | |
void | ZoomIn (const wxPoint ¢erPoint=wxDefaultPosition) |
Zoom into current view and refresh display. More... | |
void | ZoomOut (const wxPoint ¢erPoint=wxDefaultPosition) |
Zoom out current view and refresh display. More... | |
void | ZoomInX () |
Zoom in current view along X and refresh display. | |
void | ZoomOutX () |
Zoom out current view along X and refresh display. | |
void | ZoomInY () |
Zoom in current view along Y and refresh display. | |
void | ZoomOutY () |
Zoom out current view along Y and refresh display. | |
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) | |
void | UpdateAll () |
Refresh display. | |
unsigned int | CountLayers () |
Counts the number of plot layers, including axes: this is to count only the layers which have a bounding box. More... | |
unsigned int | CountAllLayers () |
Counts the number of plot layers, whether or not they have a bounding box. More... | |
unsigned int | CountLayersType (mpLayerType type) |
Counts the number of plot layers: this is to count only the layers which have a plot. More... | |
unsigned int | CountLayersFXYPlot () |
mpFloatRect | GetDesiredBoundingBox () const |
Draws the mpWindow on a page for printing. 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... | |
mpFloatRect * | GetBoundingBox (void) |
void | SetMPScrollbars (bool status) |
Enable/disable scrollbars. More... | |
bool | GetMPScrollbars () const |
Get scrollbars status. More... | |
bool | 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. More... | |
wxBitmap * | BitmapScreenshot (wxSize imageSize=wxDefaultSize, bool fit=false) |
Get a screen shot of the window plot. | |
void | ClipboardScreenshot (wxSize imageSize=wxDefaultSize, bool fit=false) |
Send the screen shot to the Clipboard. | |
bool | LoadFile (const wxString &filename) |
Load a data file like a csv file Data must be formatted in 2 columns X value and Y value separated by space or ; or tab character. | |
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... | |
int | GetMarginTop () const |
Get the top margin. More... | |
void | SetMarginRight (int right) |
Set the right margin. More... | |
int | GetMarginRight () const |
Get the right margin. More... | |
void | SetMarginBottom (int bottom) |
Set the bottom margin. More... | |
int | GetMarginBottom () const |
Get the bottom margin. More... | |
void | SetMarginLeft (int left) |
Set the left margin. More... | |
int | GetMarginLeft () const |
Get the left margin. More... | |
int | GetPlotWidth () const |
Get the width of the plot. More... | |
int | GetPlotHeight () const |
Get the height of the plot. More... | |
mpRect | GetPlotBoundaries (bool with_margin) const |
Get the boundaries of the plot. More... | |
void | SetDrawBox (bool drawbox) |
Set the draw of the box around the plot. More... | |
bool | GetDrawBox () const |
Get the draw of the box around the plot. More... | |
mpInfoLayer * | IsInsideInfoLayer (const wxPoint &point) |
Check if a given point is inside the area of a mpInfoLayer and eventually returns its pointer. More... | |
void | SetLayerVisible (const wxString &name, bool viewable) |
Sets the visibility of a layer by its name. More... | |
bool | IsLayerVisible (const wxString &name) |
Check whether a layer with given name is visible. More... | |
bool | IsLayerVisible (const unsigned int position) |
Check whether the layer at given position is visible. More... | |
void | SetLayerVisible (const unsigned int position, bool viewable) |
Sets the visibility of a layer by its position in layer list. More... | |
void | SetColourTheme (const wxColour &bgColour, const wxColour &drawColour, const wxColour &axesColour) |
Set Color theme. More... | |
const wxColour & | GetAxesColour () const |
Get axes draw colour. More... | |
const wxColour & | GetbgColour () const |
void | SetbgColour (const wxColour &colour) |
void | SetOnDeleteLayer (const mpOnDeleteLayer &event) |
On delete layer event Allows the user to perform certain actions before deleting the layer. More... | |
void | UnSetOnDeleteLayer () |
Remove the 'delete layer event' callback. | |
void | SetOnUserMouseAction (const mpOnUserMouseAction &userMouseEventHandler) |
On user mouse action event Allows the user to perform certain actions before normal event processing. More... | |
void | UnSetOnUserMouseAction () |
Remove the 'user mouse action event' callback. | |
bool | IsLogXaxis () const |
Log axis control. More... | |
bool | IsLogYaxis () const |
void | SetLogXaxis (bool log) |
void | SetLogYaxis (bool log) |
bool | GetMagnetize () const |
void | SetMagnetize (bool mag) |
void | RefreshConfigWindow () |
MathPlotConfigDialog * | GetConfigWindow (bool Create=false) |
Give access to the config dialog window. More... | |
void | Update_CountY2Axis (bool Y2Axis) |
bool | Y2AxisExist (void) const |
Static Public Attributes | |
static double | m_zoomIncrementalFactor = 1.5 |
This value sets the zoom steps whenever the user clicks "Zoom in/out" or performs zoom with the mouse wheel. More... | |
Protected Member Functions | |
virtual void | OnPaint (wxPaintEvent &event) |
Paint handler, will plot all attached layers. | |
virtual void | OnSize (wxSizeEvent &event) |
Size handler, will update scroll bar sizes. | |
virtual void | OnShowPopupMenu (wxMouseEvent &event) |
Mouse handler, will show context menu. | |
virtual void | OnCenter (wxCommandEvent &event) |
Context menu handler. | |
virtual void | OnFit (wxCommandEvent &event) |
Context menu handler. | |
virtual void | OnToggleGrids (wxCommandEvent &event) |
Context menu handler. | |
virtual void | OnToggleCoords (wxCommandEvent &event) |
Context menu handler. | |
virtual void | OnScreenShot (wxCommandEvent &event) |
Context menu handler. | |
virtual void | OnFullScreen (wxCommandEvent &event) |
Context menu handler. | |
virtual void | OnConfiguration (wxCommandEvent &event) |
Context menu handler. | |
virtual void | OnLoadFile (wxCommandEvent &event) |
Context menu handler. More... | |
virtual void | OnZoomIn (wxCommandEvent &event) |
Context menu handler. | |
virtual void | OnZoomOut (wxCommandEvent &event) |
Context menu handler. | |
virtual void | OnLockAspect (wxCommandEvent &event) |
Context menu handler. | |
virtual void | OnMouseHelp (wxCommandEvent &event) |
Context menu handler. | |
virtual void | OnMouseLeftDown (wxMouseEvent &event) |
Mouse left click (for rect zoom) | |
virtual void | OnMouseRightDown (wxMouseEvent &event) |
Mouse handler, for detecting when the user drags with the right button or just "clicks" for the menu. | |
virtual void | OnMouseMove (wxMouseEvent &event) |
Mouse handler for mouse motion (for pan) | |
virtual void | OnMouseLeftRelease (wxMouseEvent &event) |
Mouse left click (for rect zoom) | |
virtual void | OnMouseWheel (wxMouseEvent &event) |
Mouse handler for the wheel. | |
virtual void | OnMouseLeave (wxMouseEvent &event) |
Mouse handler for mouse motion (for pan) More... | |
bool | CheckUserMouseAction (wxMouseEvent &event) |
Check if a user mouse action is required. | |
virtual void | OnScrollThumbTrack (wxScrollWinEvent &event) |
Scroll thumb on scroll bar moving. | |
virtual void | OnScrollPageUp (wxScrollWinEvent &event) |
Scroll page up. | |
virtual void | OnScrollPageDown (wxScrollWinEvent &event) |
Scroll page down. | |
virtual void | OnScrollLineUp (wxScrollWinEvent &event) |
Scroll line up. | |
virtual void | OnScrollLineDown (wxScrollWinEvent &event) |
Scroll line down. | |
virtual void | OnScrollTop (wxScrollWinEvent &event) |
Scroll to top. | |
virtual 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) |
void | Zoom (bool zoomIn, const wxPoint ¢erPoint) |
virtual bool | UpdateBBox () |
Set bounding box 'm_bound' to contain all visible plots of this mpWindow. More... | |
void | InitParameters () |
virtual void | DesiredBoundsHaveChanged () |
To be notified of displayed bounds changes (after user zoom etc), override this callback in your derived class and look at the new value of m_desired. More... | |
Protected Attributes | |
wxTopLevelWindow * | m_parent |
bool | m_fullscreen |
mpLayerList | m_layers |
List of attached plot layers. | |
mpScaleX * | m_XAxis |
Pointer to the optional X axis layer of this mpWindow. | |
mpScaleY * | m_YAxis |
Pointer to the optional Y axis layer of this mpWindow. | |
mpScaleY * | m_Y2Axis |
Pointer to the optional Y2 axis layer of this mpWindow. | |
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. | |
bool | m_drawBox |
Draw box of the plot bound. Default true. | |
mpFloatRect | m_bound |
Global layer bounding box in user coordinates. Does NOT include borders. | |
double | m_scaleX |
Current view's X scale. | |
double | m_scaleY |
Current view's Y scale. | |
double | m_scaleY2 |
Current view's Y2 scale. | |
double | m_posX |
Current view's X position. | |
double | m_posY |
Current view's Y position. | |
double | m_posY2 |
Current view's Y2 position. | |
int | m_scrX |
Current view's X dimension in DC units, including all scales, margins. | |
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. | |
mpFloatRect | m_desired |
These are updated in Fit() only (also Zoom) May be different from the real borders (layer coordinates) only if lock aspect ratio is true. More... | |
mpRect | m_margin |
Margin around the plot. Default 50. | |
wxCoord | m_plotWidth |
Width of the plot = m_scrX - (m_margin.left + m_margin.right) | |
wxCoord | m_plotHeight |
Height of the plot = m_scrY - (m_margin.top + m_margin.bottom) | |
mpRect | m_plotBoundaries |
The full size of the plot. Calculated. | |
mpRect | m_plotBoundariesMargin |
The size of the plot with the margins. Calculated. | |
wxRect | m_PlotArea |
The full size of the plot with EXTRA_MARGIN. | |
bool | m_repainting |
int | m_last_lx |
int | m_last_ly |
For double buffering. | |
wxBitmap * | m_buff_bmp |
For double buffering. | |
bool | m_enableDoubleBuffer |
For double buffering. Default enabled. | |
bool | m_enableMouseNavigation |
For pan/zoom with the mouse. | |
bool | m_mouseMovedAfterRightClick |
wxPoint | m_mouseRClick |
For the right button "drag" feature. | |
wxPoint | m_mouseLClick |
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. | |
mpInfoCoords * | m_InfoCoords |
pointer to the optional info coords layer | |
mpInfoLegend * | m_InfoLegend |
pointer to the optional info legend layer | |
bool | m_InInfoLegend |
wxBitmap * | m_zoom_bmp |
For zoom selection. | |
wxRect | m_zoom_dim |
wxRect | m_zoom_oldDim |
bool | m_magnetize |
For mouse magnetization. | |
mpMagnet | m_magnet |
For mouse magnetization. | |
bool | m_LogXaxis = false |
For logarithmic X axis. | |
bool | m_LogYaxis = false |
For logarithmic X axis. | |
wxBitmap * | m_Screenshot_bmp |
For clipboard, save and print. | |
MathPlotConfigDialog * | m_configWindow = NULL |
For the config dialog. | |
mpOnDeleteLayer | m_OnDeleteLayer = NULL |
Event when we delete a layer. | |
mpOnUserMouseAction | m_OnUserMouseAction = NULL |
Event when we have a mouse click. | |
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:
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. |
|
inline |
Counts the number of plot layers, whether or not they have a bounding box.
unsigned int mpWindow::CountLayers | ( | ) |
Counts the number of plot layers, including axes: this is to count only the layers which have a bounding box.
Several layer operations.
unsigned int mpWindow::CountLayersType | ( | mpLayerType | type | ) |
Counts the number of plot layers: this is to count only the layers which have a plot.
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. |
void mpWindow::DelAllPlot | ( | bool | alsoDeleteObject, |
mpFunctionType | func = mpfAllType , |
||
bool | refreshDisplay = true |
||
) |
Remove all plot layers.
alsoDeleteObject | If set to true, the mpLayer objects will be also "deleted", not just removed from the internal list. |
func | Select type of plot |
refreshDisplay | States whether to refresh the display (UpdateAll) after removing the layers. |
bool mpWindow::DelLayer | ( | mpLayer * | layer, |
bool | alsoDeleteObject, | ||
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. If alsoDeleteObject is false, only the layer pointer in the mpWindow is removed, the layer object still exists. WARNING: Invalidates any extant m_layers iterators!
|
inlineprotectedvirtual |
To be notified of displayed bounds changes (after user zoom etc), override this callback in your derived class and look at the new value of m_desired.
Useful for keeping multiple plots in sync when user zooms.
void mpWindow::Fit | ( | ) |
Set view to fit global bounding box of all plot layers and refresh display with UpdateAll().
General fit Use global layer bounding box.
Scale and position will be set to show all attached mpLayers. The X/Y scale aspect lock is taken into account.
void mpWindow::Fit | ( | const mpFloatRect & | rect, |
wxCoord * | printSizeX = NULL , |
||
wxCoord * | printSizeY = NULL |
||
) |
Set view to fit a given bounding box and refresh display with UpdateAll().
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.
|
inline |
Get bounding box encompassing all visible plots on this mpWindow.
|
inline |
Get axes draw colour.
void mpWindow::GetBoundingBox | ( | double * | bbox | ) | const |
Returns the bounding box coordinates.
bbox | Pointer to a 6-element double array where to store bounding box coordinates. |
mpLayer * mpWindow::GetClosestPlot | ( | wxCoord | ix, |
wxCoord | iy, | ||
double * | xnear, | ||
double * | ynear, | ||
bool * | isY2Axis | ||
) |
Search the point of the layer plot nearest a point
MathPlotConfigDialog * mpWindow::GetConfigWindow | ( | bool | Create = false | ) |
Give access to the config dialog window.
Create. Create the dialog if not exist (default false) |
|
inline |
Draws the mpWindow on a page for printing.
the mpPrintout where to print the graph Get the 'desired' user-coordinate bounding box for the currently displayed view (set by Fit or Zoom operations). |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Get the draw of the box around the 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 |
mpLayer * mpWindow::GetLayerAxis | ( | int | position, |
mpScaleType | scale = mpsAllType |
||
) |
Get the layer axis in list position indicated.
mpLayer * mpWindow::GetLayerByClassName | ( | const wxString & | name | ) |
Get the first layer by its class name (case sensitive).
name | The class name of the layer to retrieve |
mpLayer * mpWindow::GetLayerByName | ( | const wxString & | name | ) |
Get the layer by its name (case sensitive).
name | The name of the layer to retrieve |
mpLayer * mpWindow::GetLayerPlot | ( | int | position, |
mpFunctionType | func = mpfAllType |
||
) |
Get the layer plot in list position indicated. N.B. You must know the index of the layer plot inside the list of plot!
position | position of the layer plot in the layers plot list |
mpLayer * mpWindow::GetLayersType | ( | int | position, |
mpLayerType | type | ||
) |
Get the layer of a certain type 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 |
type | of the layer |
mpScaleX * mpWindow::GetLayerXAxis | ( | ) |
Get the first scale X layer (X axis) or NULL if not found.
Get the first scale X layer (X axis).
mpScaleY * mpWindow::GetLayerY2Axis | ( | ) |
Get the first scale Y2 layer (Y2 axis) or NULL if not found.
Get the first scale Y2 layer (Y2 axis).
mpScaleY * mpWindow::GetLayerYAxis | ( | ) |
Get the first scale Y layer (Y axis) or NULL if not found.
Get the first scale Y layer (Y axis).
|
inline |
Get the bottom margin.
bottom | Bottom Margin |
|
inline |
Get the left margin.
left | Left Margin |
|
inline |
Get the right margin.
right | Right Margin |
|
inline |
Get the top margin.
top | Top Margin |
|
inline |
Get scrollbars status.
|
inline |
Get the boundaries of the plot.
|
inline |
Get the height of the plot.
|
inline |
Get the width of the plot.
|
inline |
Get reference to context menu of the plot canvas.
|
inline |
Get current view's X position.
See rules for coordinate transformation
|
inline |
Get current view's Y position.
See rules for coordinate transformation
|
inline |
|
inline |
|
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
|
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
mpFXYVector * mpWindow::GetXYSeries | ( | unsigned int | n, |
const wxString & | name = _T("Serie ") , |
||
bool | create = true |
||
) |
Return the serie n If the serie not exist then create it
|
inline |
Checks whether the X/Y scale aspect is locked.
TRUE | Locked |
FALSE | Unlocked |
mpInfoLayer * mpWindow::IsInsideInfoLayer | ( | const 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 |
bool mpWindow::IsLayerVisible | ( | const wxString & | name | ) |
Check whether a layer with given name is visible.
name | The layer name |
bool mpWindow::IsLayerVisible | ( | const unsigned int | position | ) |
Check whether the layer at given position is visible.
position | The layer position in layer list |
|
inline |
Log axis control.
It is an axis property but as we need to control the bound and the scale, it is easiest to declare this property here
|
inline |
Checks if we are repainting.
TRUE | |
FALSE |
void mpWindow::LockAspect | ( | bool | enable = true | ) |
Enable or disable X/Y scale aspect locking for the view.
|
protectedvirtual |
Context menu handler.
Create series from a data file.
The file is not formatted. For example a simple txt file or csv file First data is x abscissa and next is up to 9 ordinates Separator is : space or ; or tab
|
protectedvirtual |
Mouse handler for mouse motion (for pan)
Mouse leave the plot area.
|
inline |
|
inline |
void mpWindow::RefreshLegend | ( | void | ) |
Flag for refresh legend
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 |
void mpWindow::SetBound | ( | ) |
Update bound for mpFX and mpFY when axis is scaled.
Deprecated: Incomplete! Use UpdateBBox!
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) |
|
inline |
Set the draw of the box around the plot.
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 |
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 |
|
inline |
Set the bottom margin.
bottom | Bottom Margin |
|
inline |
Set the left margin.
left | Left Margin |
|
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 |
|
inline |
Set the top margin.
top | Top Margin |
void mpWindow::SetMPScrollbars | ( | bool | status | ) |
Enable/disable scrollbars.
status | Set to true to show scrollbars |
|
inline |
On delete layer event Allows the user to perform certain actions before deleting the layer.
The user can abort the deletion.
|
inline |
On user mouse action event Allows the user to perform certain actions before normal event processing.
The user has the possibility to interrupt or continue the normal processing of the event.
|
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. |
|
inline |
Set current view's X position and refresh display.
posX | New position that corresponds to the center point of the view. |
|
inline |
Set current view's Y position and refresh display.
posY | New position that corresponds to the center point of the view. |
|
inline |
Set current view's X scale and refresh display.
scaleX | New scale, must not be 0. |
|
inline |
Set current view's Y scale and refresh display.
scaleY | New scale, must not be 0. |
|
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. |
|
protectedvirtual |
Set bounding box 'm_bound' to contain all visible plots of this mpWindow.
|
inline |
|
inline |
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). |
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). |
|
protected |
These are updated in Fit() only (also Zoom) May be different from the real borders (layer coordinates) only if lock aspect ratio is true.
ToDo: Set in Zoom, Fit(mpFloatRect), used in scrolling and?
|
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.