21#ifndef _MP_MATHPLOT_H_
22#define _MP_MATHPLOT_H_
27 #pragma warning(disable:4251)
77#define WXDLLIMPEXP_MATHPLOT GUI_IMPEXP
80#if defined(__GNUG__) && !defined(__clang__)
81#pragma interface "mathplot.h"
89#include <wx/scrolwin.h>
91#include <wx/dynarray.h>
93#include <wx/dcmemory.h>
105#define DEBUG_NEW new(_NORMAL_BLOCK ,__FILE__, __LINE__)
112#define X_BORDER_SEPARATION 40
113#define Y_BORDER_SEPARATION 60
259 const wxFont&
GetFont()
const {
return m_font; }
264 const wxPen&
GetPen()
const {
return m_pen; }
283 void SetName(wxString name) { m_name = name; }
322 const wxBrush&
GetBrush()
const {
return m_brush; };
359 mpInfoLayer(wxRect rect,
const wxBrush* brush = wxTRANSPARENT_BRUSH);
392 virtual void Move(wxPoint delta);
491#define mpALIGNMASK 0x03
493#define mpALIGN_RIGHT 0x00
495#define mpALIGN_CENTER 0x01
497#define mpALIGN_LEFT 0x02
499#define mpALIGN_TOP mpALIGN_RIGHT
501#define mpALIGN_BOTTOM mpALIGN_LEFT
503#define mpALIGN_BORDER_BOTTOM 0x04
505#define mpALIGN_BORDER_TOP 0x05
507#define mpX_NORMAL 0x00
511#define mpX_HOURS 0x02
515#define mpX_DATETIME 0x04
517#define mpALIGN_BORDER_LEFT mpALIGN_BORDER_BOTTOM
519#define mpALIGN_BORDER_RIGHT mpALIGN_BORDER_TOP
521#define mpALIGN_NE 0x00
523#define mpALIGN_NW 0x01
525#define mpALIGN_SW 0x02
527#define mpALIGN_SE 0x03
552 virtual double GetY(
double x ) = 0;
563 DECLARE_DYNAMIC_CLASS(
mpFX)
584 virtual double GetX(
double y ) = 0;
595 DECLARE_DYNAMIC_CLASS(
mpFY)
644 DECLARE_DYNAMIC_CLASS(
mpFXY)
666 virtual double GetY(
double x ) = 0;
810#define mpMOUSEMODE_DRAG 0
812#define mpMOUSEMODE_ZOOMBOX 1
846 const wxPoint &pos = wxDefaultPosition,
847 const wxSize &size = wxDefaultSize,
873 bool DelLayer(
mpLayer* layer,
bool alsoDeleteObject =
false,
bool refreshDisplay =
true);
949 void SetScaleY(
double scaleY) {
if (scaleY!=0) m_scaleY=scaleY; UpdateAll(); }
954 void SetPosX(
double posX) { m_posX=posX; UpdateAll(); }
959 void SetPosY(
double posY) { m_posY=posY; UpdateAll(); }
965 void SetPos(
double posX,
double posY) { m_posX=posX; m_posY=posY; UpdateAll(); }
972 void SetScr(
int scrX,
int scrY) { m_scrX=scrX; m_scrY=scrY; }
977 inline double p2x(wxCoord pixelCoordX ) {
return m_posX + pixelCoordX/m_scaleX; }
982 inline double p2y(wxCoord pixelCoordY ) {
return m_posY - pixelCoordY/m_scaleY; }
987 inline wxCoord
x2p(
double x) {
return (wxCoord) ( (x-m_posX) * m_scaleX); }
992 inline wxCoord
y2p(
double y) {
return (wxCoord) ( (m_posY-y) * m_scaleY); }
1028 void Fit(
double xMin,
double xMax,
double yMin,
double yMax,wxCoord *printSizeX=NULL,wxCoord *printSizeY=NULL);
1033 void ZoomIn(
const wxPoint& centerPoint = wxDefaultPosition );
1038 void ZoomOut(
const wxPoint& centerPoint = wxDefaultPosition );
1114 bool SaveScreenshot(
const wxString& filename,
int type = wxBITMAP_TYPE_BMP, wxSize imageSize = wxDefaultSize,
bool fit =
false);
1179 void SetColourTheme(
const wxColour& bgColour,
const wxColour& drawColour,
const wxColour& axesColour);
1263 DECLARE_EVENT_TABLE()
1301 void SetData(
const std::vector<double> &xs,
const std::vector<double> &ys);
1307 void SetData(
const std::vector<float> &xs,
const std::vector<float> &ys);
1391 mpText(wxString name = wxT(
"Title"),
int offsetx = 5,
int offsety = 50);
1404 DECLARE_DYNAMIC_CLASS(
mpText)
1464 phi = m_reference_phi;
1473 m_reference_phi = phi;
1478 virtual bool HasBBox() {
return m_trans_shape_xs.size()!=0; }
1559 double quantiles = 2,
1561 const wxString & layerName = wxT(
"") ) :
1565 m_quantiles(quantiles),
1566 m_segments(segments)
1568 m_continuous =
true;
1637 m_continuous =
true;
1649 const std::vector<double>& points_xs,
1650 const std::vector<double>& points_ys,
1651 bool closedShape=
true );
1659 const std::vector<float>& points_xs,
1660 const std::vector<float>& points_ys,
1661 bool closedShape=
true );
1684 m_min_y = m_max_y = 0;
1702 void SetBitmap(
const wxImage &inBmp,
double x,
double y,
double lx,
double ly );
1753#if defined(_MSC_VER)
1754 #pragma warning(pop)
This virtual class represents objects that can be moved to an arbitrary 2D location+rotation.
virtual double GetMinY()
Get inclusive bottom border of bounding box.
void SetBitmap(const wxImage &inBmp, double x, double y, double lx, double ly)
Change the bitmap associated with the layer (to update the screen, refresh the mpWindow).
void GetBitmapCopy(wxImage &outBmp) const
Returns a copy of the current bitmap assigned to the layer.
int m_flags
Holds label alignment.
virtual double GetMaxX()
Get inclusive right border of bounding box.
wxImage m_bitmap
The internal copy of the Bitmap:
void SetAlign(int align)
Set label axis alignment.
mpBitmapLayer()
Default constructor.
virtual double GetMinX()
Get inclusive left border of bounding box.
virtual bool HasBBox()
Check whether this layer has a bounding box.
wxCoord m_scaledBitmap_offset_x
virtual void Plot(wxDC &dc, mpWindow &w)
Plot given view of layer to the given device context.
virtual double GetMaxY()
Get inclusive top border of bounding box.
A 2D ellipse, described by a 2x2 covariance matrix.
void SetSegments(int segments)
double m_cov_00
The elements of the matrix (only 3 since cov(0,1)=cov(1,0) in any positive definite matrix).
void SetQuantiles(double q)
Set how many "quantiles" to draw, that is, the confidence interval of the ellipse (see above).
void SetCovarianceMatrix(double cov_00, double cov_01, double cov_11)
Changes the covariance matrix:
void RecalculateShape()
Called to update the m_shape_xs, m_shape_ys vectors, whenever a parameter changes.
double GetQuantiles() const
int m_segments
The number of line segments that build up the ellipse.
void GetCovarianceMatrix(double &cov_00, double &cov_01, double &cov_11) const
Returns the elements of the current covariance matrix:
mpCovarianceEllipse(double cov_00=1, double cov_11=1, double cov_01=0, double quantiles=2, int segments=32, const wxString &layerName=wxT(""))
Default constructor.
virtual ~mpCovarianceEllipse()
Abstract base class providing plot and labeling functionality for functions F:X->Y.
virtual double GetY(double x)=0
Get function value for argument.
mpFX(wxString name=wxEmptyString, int flags=mpALIGN_RIGHT)
virtual void Plot(wxDC &dc, mpWindow &w)
Layer plot handler.
int m_flags
Holds label alignment.
Abstract base class providing plot and labeling functionality for a locus plot F:N->X,...
virtual void Rewind()=0
Rewind value enumeration with mpFXY::GetNextXY.
int m_flags
Holds label alignment.
mpFXY(wxString name=wxEmptyString, int flags=mpALIGN_NE)
void UpdateViewBoundary(wxCoord xnew, wxCoord ynew)
Update label positioning data.
virtual void Plot(wxDC &dc, mpWindow &w)
Layer plot handler.
virtual bool GetNextXY(double &x, double &y)=0
Get locus value for next N.
A class providing graphs functionality for a 2D plot (either continuous or a set of points),...
double GetMinX()
Returns the actual minimum X data (loaded in SetData).
double GetMinY()
Returns the actual minimum Y data (loaded in SetData).
double GetMaxX()
Returns the actual maximum X data (loaded in SetData).
size_t GetDataLength() const
Returns the number of data points currently hold in X & Y.
std::vector< double > m_xs
The internal copy of the set of data to draw.
void SetData(const std::vector< double > &xs, const std::vector< double > &ys)
Changes the internal data: the set of points to draw.
void Clear()
Clears all the data, leaving the layer empty.
void SetData(const std::vector< float > &xs, const std::vector< float > &ys)
Changes the internal data: the set of points to draw.
bool GetNextXY(double &x, double &y)
Get locus value for next N.
int m_flags
Holds label alignment.
void Rewind()
Rewind value enumeration with mpFXY::GetNextXY.
mpFXYVector(wxString name=wxEmptyString, int flags=mpALIGN_NE)
double GetMaxY()
Returns the actual maximum Y data (loaded in SetData).
size_t m_index
The internal counter for the "GetNextXY" interface.
void AppendDataPoint(float x, float y)
Append a new data point (x,y)
Abstract base class providing plot and labeling functionality for functions F:Y->X.
mpFY(wxString name=wxEmptyString, int flags=mpALIGN_TOP)
int m_flags
Holds label alignment.
virtual double GetX(double y)=0
Get function value for argument.
virtual void Plot(wxDC &dc, mpWindow &w)
Layer plot handler.
Implements an overlay box which shows the mouse coordinates in plot units.
mpInfoCoords(wxRect rect, const wxBrush *brush=wxTRANSPARENT_BRUSH)
Complete constructor, setting initial rectangle and background brush.
~mpInfoCoords()
Default destructor.
virtual void Plot(wxDC &dc, mpWindow &w)
Plot method.
wxString m_content
string holding the coordinates to be drawn.
virtual void UpdateInfo(mpWindow &w, wxEvent &event)
Updates the content of the info box.
mpInfoCoords()
Default constructor.
Base class to create small rectangular info boxes mpInfoLayer is the base class to create a small rec...
const wxRect & GetRectangle()
Returns the current rectangle coordinates.
wxPoint m_reference
Holds the reference point for movements.
virtual void UpdateInfo(mpWindow &w, wxEvent &event)
Updates the content of the info box.
virtual bool HasBBox()
mpInfoLayer has not bounding box.
virtual bool IsInfo()
Specifies that this is an Info box layer.
virtual bool Inside(wxPoint &point)
Checks whether a point is inside the info box rectangle.
wxRect m_dim
The bounding rectangle of the box. It may be resized dynamically by the Plot method.
mpInfoLayer()
Default constructor.
wxSize GetSize()
Returns the size of the box (in pixels)
wxPoint GetPosition()
Returns the position of the upper left corner of the box (in pixels)
virtual void Plot(wxDC &dc, mpWindow &w)
Plot method.
virtual void UpdateReference()
Updates the rectangle reference point.
mpInfoLayer(wxRect rect, const wxBrush *brush=wxTRANSPARENT_BRUSH)
Complete constructor.
virtual void Move(wxPoint delta)
Moves the layer rectangle of given pixel deltas.
virtual ~mpInfoLayer()
Destructor.
wxBrush m_brush
The brush to be used for the background.
Implements the legend to be added to the plot This layer allows you to add a legend to describe the p...
mpInfoLegend()
Default constructor.
virtual void Plot(wxDC &dc, mpWindow &w)
Plot method.
virtual void UpdateInfo(mpWindow &w, wxEvent &event)
Updates the content of the info box.
mpInfoLegend(wxRect rect, const wxBrush *brush=wxTRANSPARENT_BRUSH)
Complete constructor, setting initial rectangle and background brush.
~mpInfoLegend()
Default destructor.
Plot layer, abstract base class.
virtual void Plot(wxDC &dc, mpWindow &w)=0
Plot given view of layer to the given device context.
virtual bool IsInfo()
Check whether the layer is an info box.
wxFont m_font
Layer's font.
bool m_drawOutsideMargins
select if the layer should draw only inside margins or over all DC
bool IsVisible()
Checks whether the layer is visible or not.
wxBitmap GetColourSquare(int side=16)
Get a small square bitmap filled with the colour of the pen used in the layer.
bool GetContinuity() const
Gets the 'continuity' property of the layer.
bool m_continuous
Specify if the layer will be plotted as a continuous line or a set of points.
void SetPen(wxPen pen)
Set layer pen.
bool m_showName
States whether the name of the layer must be shown (default is true).
bool m_visible
Toggles layer visibility.
bool GetDrawOutsideMargins()
Get Draw mode: inside or outside margins.
void SetContinuity(bool continuity)
Set the 'continuity' property of the layer (true:draws a continuous line, false:draws separate points...
void ShowName(bool show)
Shows or hides the text label with the name of the layer (default is visible).
void SetFont(wxFont &font)
Set layer font.
wxString GetName() const
Get layer name.
const wxFont & GetFont() const
Get font set for this layer.
const wxPen & GetPen() const
Get pen set for this layer.
mpLayerType m_type
Define layer type, which is assigned by constructor.
void SetVisible(bool show)
Sets layer visibility.
void SetBrush(wxBrush brush)
Set layer brush.
wxString m_name
Layer's name.
wxBrush m_brush
Layer's brush.
virtual bool HasBBox()
Check whether this layer has a bounding box.
virtual double GetMaxX()
Get inclusive right border of bounding box.
virtual double GetMinX()
Get inclusive left border of bounding box.
void SetName(wxString name)
Set layer name.
virtual double GetMaxY()
Get inclusive top border of bounding box.
virtual double GetMinY()
Get inclusive bottom border of bounding box.
mpLayerType GetLayerType()
Get layer type: a Layer can be of different types: plot lines, axis, info boxes, etc,...
const wxBrush & GetBrush() const
Get brush set for this layer.
void SetDrawOutsideMargins(bool drawModeOutside)
Set Draw mode: inside or outside margins.
This virtual class represents objects that can be moved to an arbitrary 2D location+rotation.
void SetAlign(int align)
Set label axis alignment.
void GetCoordinateBase(double &x, double &y, double &phi) const
Get the current coordinate transformation.
void TranslatePoint(double x, double y, double &out_x, double &out_y)
A method for 2D translation and rotation, using the current transformation stored in m_reference_x,...
virtual double GetMinX()
Get inclusive left border of bounding box.
std::vector< double > m_trans_shape_xs
The buffer for the translated & rotated points (to avoid recomputing them with each mpWindow refresh)...
virtual ~mpMovableObject()
mpMovableObject()
Default constructor (sets location and rotation to (0,0,0))
int m_flags
Holds label alignment.
virtual double GetMaxY()
Get inclusive top border of bounding box.
void SetCoordinateBase(double x, double y, double phi=0)
Set the coordinate transformation (phi in radians, 0 means no rotation).
virtual double GetMinY()
Get inclusive bottom border of bounding box.
std::vector< double > m_shape_xs
This contains the object points, in local coordinates (to be transformed by the current transformatio...
virtual bool HasBBox()
Check whether this layer has a bounding box.
void ShapeUpdated()
Must be called by the descendent class after updating the shape (m_shape_xs/ys), or when the transfor...
virtual double GetMaxX()
Get inclusive right border of bounding box.
virtual void Plot(wxDC &dc, mpWindow &w)
Plot given view of layer to the given device context.
An arbitrary polygon, descendant of mpMovableObject.
void setPoints(const std::vector< double > &points_xs, const std::vector< double > &points_ys, bool closedShape=true)
Set the points in the polygon.
mpPolygon(const wxString &layerName=wxT(""))
Default constructor.
void setPoints(const std::vector< float > &points_xs, const std::vector< float > &points_ys, bool closedShape=true)
Set the points in the polygon.
Printout class used by mpWindow to draw in the objects to be printed.
mpPrintout(mpWindow *drawWindow, const wxChar *title=_T("wxMathPlot print output"))
void SetDrawState(bool drawState)
bool OnPrintPage(int page)
Abstract base class providing plot and labeling functionality for functions F:Y->X.
mpProfile(wxString name=wxEmptyString, int flags=mpALIGN_TOP)
int m_flags
Holds label alignment.
virtual double GetY(double x)=0
Get function value for argument.
virtual void Plot(wxDC &dc, mpWindow &w)
Layer plot handler.
Plot layer implementing a x-scale ruler.
unsigned int m_labelType
Select labels mode: mpX_NORMAL for normal labels, mpX_TIME for time axis in hours,...
void SetLabelMode(unsigned int mode)
Set X axis label view mode.
unsigned int GetLabelMode()
Get X axis label view mode.
wxString m_labelFormat
Format string used to print labels.
virtual void Plot(wxDC &dc, mpWindow &w)
Layer plot handler.
const wxString & SetLabelFormat()
Get X axis Label format (used for mpX_NORMAL draw mode).
mpScaleX(wxString name=wxT("X"), int flags=mpALIGN_CENTER, bool ticks=true, unsigned int type=mpX_NORMAL)
Full constructor.
void SetAlign(int align)
Set X axis alignment.
bool m_ticks
Flag to toggle between ticks or grid.
int m_flags
Flag for axis alignment.
void SetLabelFormat(const wxString &format)
Set X axis Label format (used for mpX_NORMAL draw mode).
bool GetTicks()
Get X axis ticks or grid.
void SetTicks(bool ticks)
Set X axis ticks or grid.
virtual bool HasBBox()
Check whether this layer has a bounding box.
Plot layer implementing a y-scale ruler.
int m_flags
Flag for axis alignment.
virtual void Plot(wxDC &dc, mpWindow &w)
Layer plot handler.
void SetTicks(bool ticks)
Set Y axis ticks or grid.
mpScaleY(wxString name=wxT("Y"), int flags=mpALIGN_CENTER, bool ticks=true)
const wxString & SetLabelFormat()
Get Y axis Label format.
wxString m_labelFormat
Format string used to print labels.
virtual bool HasBBox()
Check whether this layer has a bounding box.
void SetLabelFormat(const wxString &format)
Set Y axis Label format.
bool GetTicks()
Get Y axis ticks or grid.
bool m_ticks
Flag to toggle between ticks or grid.
void SetAlign(int align)
Set Y axis alignment.
Plot layer implementing a text string.
virtual bool HasBBox()
mpText should not be used for scaling decisions.
int m_offsetx
Holds offset for X in percentage.
mpText(wxString name=wxT("Title"), int offsetx=5, int offsety=50)
virtual void Plot(wxDC &dc, mpWindow &w)
Text Layer plot handler.
int m_offsety
Holds offset for Y in percentage.
Canvas for plotting mpLayer implementations.
mpInfoLayer * m_movingInfoLayer
For moving info layers over the window area.
void DelAllLayers(bool alsoDeleteObject, bool refreshDisplay=true)
Remove all layers from the plot.
void SetColourTheme(const wxColour &bgColour, const wxColour &drawColour, const wxColour &axesColour)
Set Color theme.
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)
double m_maxY
Global layer bounding box, top border incl.
double m_posY
Current view's Y position.
void OnScrollLineUp(wxScrollWinEvent &event)
Scroll line up.
void OnPrintMenu(wxCommandEvent &event)
Context menu handler.
bool m_mouseMovedAfterRightClick
bool m_enableMouseNavigation
For pan/zoom with the mouse.
void DoZoomInYCalc(const int staticYpixel)
void OnScrollPageUp(wxScrollWinEvent &event)
Scroll page up.
void EnableMousePanZoom(bool enabled)
Enable/disable the feature of pan/zoom with the mouse (default=enabled)
bool IsLayerVisible(const wxString &name)
Check whether a layer with given name is visible.
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.
int GetScrX(void) const
Get current view's X dimension in device context units.
void SetMarginLeft(int left)
Set the left margin.
void ZoomInX()
Zoom in current view along X and refresh display.
double GetYscl() const
Get current view's Y scale.
void OnScrollTop(wxScrollWinEvent &event)
Scroll to top.
void OnPaint(wxPaintEvent &event)
Paint handler, will plot all attached layers.
void OnShowPopupMenu(wxMouseEvent &event)
Mouse handler, will show context menu.
const wxColour & GetAxesColour()
Get axes draw colour.
void OnLockAspect(wxCommandEvent &event)
Context menu handler.
void SetLayerVisible(const unsigned int position, bool viewable)
Sets the visibility of a layer by its position in layer list.
void OnMouseMove(wxMouseEvent &event)
Mouse handler for mouse motion (for pan)
void DoZoomInXCalc(const int staticXpixel)
int GetMarginTop()
Get the top margin.
double GetDesiredXmin()
Returns the left-border layer coordinate that the user wants the mpWindow to show (it may be not exac...
void SetMargins(int top, int right, int bottom, int left)
Set window margins, creating a blank area where some kinds of layers cannot draw.
double m_minY
Global layer bounding box, bottom border incl.
void Fit()
Set view to fit global bounding box of all plot layers and refresh display.
unsigned int CountLayers()
Counts the number of plot layers, excluding axes or text: this is to count only the layers which have...
void OnScrollBottom(wxScrollWinEvent &event)
Scroll to bottom.
void OnScrollThumbTrack(wxScrollWinEvent &event)
Scroll thumb on scroll bar moving.
double p2x(wxCoord pixelCoordX)
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates,...
int GetXScreen(void) const
double p2y(wxCoord pixelCoordY)
Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates,...
wxMemoryDC m_buff_dc
For double buffering.
double m_maxX
Global layer bounding box, right border incl.
void SetMarginRight(int right)
Set the right margin.
int m_clickedY
Last mouse click Y position, for centering and zooming the view.
wxCoord x2p(double x)
Converts graph (floating point) coordinates into mpWindow (screen) pixel coordinates,...
wxColour m_bgColour
Background Colour.
double GetYpos() const
Get current view's Y position.
double m_posX
Current view's X position.
void OnMouseLeftDown(wxMouseEvent &event)
Mouse left click (for rect zoom)
void SetMarginTop(int top)
Set the top margin.
mpInfoLayer * IsInsideInfoLayer(wxPoint &point)
Sets whether to show coordinate tooltip when mouse passes over the plot.
double GetPosY(void) const
bool IsAspectLocked()
Checks whether the X/Y scale aspect is locked.
bool m_lockaspect
Scale aspect is locked or not.
void SetPosX(double posX)
Set current view's X position and refresh display.
void ShowPrintDialog()
Draws the mpWindow on a page for printing.
int GetMarginLeft()
Get the left margin.
void SetLayerVisible(const wxString &name, bool viewable)
Sets the visibility of a layer by its name.
int GetMarginRight()
Get the right margin.
mpWindow(wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long flags=0)
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.
bool GetMPScrollbars()
Get scrollbars status.
double m_scaleY
Current view's Y scale.
int GetMarginBottom()
Get the bottom margin.
bool IsLayerVisible(const unsigned int position)
Check whether the layer at given position is visible.
void OnMouseHelp(wxCommandEvent &event)
Context menu handler.
void SetMarginBottom(int bottom)
Set the bottom margin.
double GetScaleX(void) const
void SetPosY(double posY)
Set current view's Y position and refresh display.
void SetScaleY(double scaleY)
Set current view's Y scale and refresh display.
void ZoomIn(const wxPoint ¢erPoint=wxDefaultPosition)
Zoom into current view and refresh display.
size_t CountAllLayers()
Counts the number of plot layers, whether or not they have a bounding box.
void ZoomInY()
Zoom in current view along Y and refresh display.
wxColour m_fgColour
Foreground Colour.
void ZoomOut(const wxPoint ¢erPoint=wxDefaultPosition)
Zoom out current view and refresh display.
void OnZoomOut(wxCommandEvent &event)
Context menu handler.
double m_minX
Global layer bounding box, left border incl.
double GetScaleY(void) const
void ZoomOutY()
Zoom out current view along Y and refresh display.
void GetBoundingBox(double *bbox)
Returns the bounding box coordinates.
bool DelLayer(mpLayer *layer, bool alsoDeleteObject=false, bool refreshDisplay=true)
Remove a plot layer from the canvas.
void OnZoomIn(wxCommandEvent &event)
Context menu handler.
void UpdateAll()
Refresh display.
void OnScrollPageDown(wxScrollWinEvent &event)
Scroll page down.
wxLayerList m_layers
List of attached plot layers.
wxCoord y2p(double y)
Converts graph (floating point) coordinates into mpWindow (screen) pixel coordinates,...
wxMenu m_popmenu
Canvas' context menu.
void OnCenter(wxCommandEvent &event)
Context menu handler.
double GetDesiredYmax()
Returns the top layer-border coordinate that the user wants the mpWindow to show (it may be not exact...
double GetXscl()
Get current view's X scale.
int m_clickedX
Last mouse click X position, for centering and zooming the view.
void SetScaleX(double scaleX)
Set current view's X scale and refresh display.
wxBitmap * m_buff_bmp
For double buffering.
wxMenu * GetPopupMenu()
Get reference to context menu of the plot canvas.
void LockAspect(bool enable=TRUE)
Enable or disable X/Y scale aspect locking for the view.
void DoZoomOutXCalc(const int staticXpixel)
double GetXpos() const
Get current view's X position.
void SetMPScrollbars(bool status)
Enable/disable scrollbars.
void OnMouseRightDown(wxMouseEvent &event)
Mouse handler, for detecting when the user drags with the right button or just "clicks" for the menu.
void SetScr(int scrX, int scrY)
Set current view's dimensions in device context units.
void EnableDoubleBuffer(bool enabled)
Enable/disable the double-buffering of the window, eliminating the flicker (default=disabled).
wxColour m_axColour
Axes Colour.
static double zoomIncrementalFactor
This value sets the zoom steps whenever the user clicks "Zoom in/out" or performs zoom with the mouse...
mpLayer * GetLayerByName(const wxString &name)
int GetScrY(void) const
Get current view's Y dimension in device context units.
mpLayer * GetLayer(int position)
void ZoomOutX()
Zoom out current view along X and refresh display.
void DoZoomOutYCalc(const int staticYpixel)
double m_scaleX
Current view's X scale.
bool m_enableDoubleBuffer
For double buffering.
void OnScrollLineDown(wxScrollWinEvent &event)
Scroll line down.
void OnFit(wxCommandEvent &event)
Context menu handler.
void OnSize(wxSizeEvent &event)
Size handler, will update scroll bar sizes.
double GetDesiredYmin()
Returns the bottom-border layer coordinate that the user wants the mpWindow to show (it may be not ex...
double GetPosX(void) const
void OnMouseWheel(wxMouseEvent &event)
Mouse handler for the wheel.
void SetPos(double posX, double posY)
Set current view's X and Y position and refresh display.
double GetDesiredXmax()
Returns the right-border layer coordinate that the user wants the mpWindow to show (it may be not exa...
int m_scrY
Current view's Y dimension.
int GetYScreen(void) const
void OnMouseLeftRelease(wxMouseEvent &event)
Mouse left click (for rect zoom)
bool AddLayer(mpLayer *layer, bool refreshDisplay=true)
Add a plot layer to the canvas.
void DoScrollCalc(const int position, const int orientation)
virtual bool UpdateBBox()
Recalculate global layer bounding box, and save it in m_minX,...
int m_scrX
Current view's X dimension.
@ mpLAYER_INFO
Info box type layer.
@ mpLAYER_BITMAP
Bitmap type layer.
@ mpLAYER_UNDEF
Layer type undefined.
@ mpLAYER_AXIS
Axis type layer.
@ mpLAYER_PLOT
Plot type layer.
#define mpALIGN_RIGHT
Aligns label to the right.
enum __mp_Layer_Type mpLayerType
std::deque< mpLayer * > wxLayerList
Define the type for the list of layers inside mpWindow.
#define mpALIGN_CENTER
Aligns label to the center.
#define mpALIGN_TOP
Aligns label to the top.
#define WXDLLIMPEXP_MATHPLOT
#define mpX_NORMAL
Set label for X axis in normal mode.
@ mpID_FIT
Fit view to match bounding box of all layers.
@ mpID_LOCKASPECT
Lock x/y scaling aspect.
@ mpID_ZOOM_IN
Zoom into view at clickposition / window center.
@ mpID_CENTER
Center view on click position.
@ mpID_HELP_MOUSE
Shows information about the mouse commands.
@ mpID_PRINT
JL: Prints the graph.
#define mpALIGN_NE
Aligns label to north-east.