MathPlot
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
MathPlot::mpScaleX Class Reference

Plot layer implementing a x-scale ruler. More...

#include <mathplot.h>

Inheritance diagram for MathPlot::mpScaleX:
Inheritance graph
[legend]
Collaboration diagram for MathPlot::mpScaleX:
Collaboration graph
[legend]

Public Member Functions

 mpScaleX (const wxString &name=_T("X"), int flags=mpALIGN_CENTERX, bool grids=false, unsigned int type=0x00)
 Full constructor. More...
 
virtual void SetLabelFormat (const wxString &format)
 Set axis Label format (used for mpX_NORMAL draw mode). More...
 
unsigned int GetLabelMode () const
 Get X axis label view mode. More...
 
void SetLabelMode (unsigned int mode, unsigned int time_conv=0x20)
 Set X axis label view mode. More...
 
virtual bool IsLogAxis ()
 Logarithmic X axis.
 
virtual void SetLogAxis (bool log)
 
- Public Member Functions inherited from MathPlot::mpScale
 mpScale (const wxString &name, int flags, bool grids)
 Full constructor. More...
 
virtual bool HasBBox ()
 Check whether this layer has a bounding box. More...
 
void ShowTicks (bool ticks)
 Set axis ticks. More...
 
bool GetShowTicks () const
 Get axis ticks. More...
 
void ShowGrids (bool grids)
 Set axis grids. More...
 
bool GetShowGrids () const
 Get axis grids. More...
 
const wxString & GetLabelFormat () const
 Get axis Label format (used for mpX_NORMAL draw mode). More...
 
void SetGridPen (const wxPen &pen)
 Set grid pen. More...
 
const wxPen & GetGridPen () const
 Get pen set for this axis. More...
 
void SetAuto (bool automaticScalingIsEnabled)
 Enable/Disable automatic scaling for this axis. More...
 
bool GetAuto () const
 Is automatic scaling enabled for this axis? More...
 
void SetMinScale (double min)
 
double GetMinScale () const
 
void SetMaxScale (double max)
 
double GetMaxScale () const
 
- Public Member Functions inherited from MathPlot::mpLayer
 mpLayer (mpLayerType layerType)
 
void SetWindow (mpWindow &w)
 Set the wxWindow handle.
 
virtual void GetBBox (mpFloatRect *m_bound)
 Return the bounding box, ie GetMinX(), GetMaxX(), GetMinY() and GetMaxY() of this mpLayer Here we don't use extra Y2 values.
 
mpLayerType GetLayerType () const
 Get layer type: a Layer can be of different types: plot, lines, axis, info boxes, etc, this method returns the right value. More...
 
int GetLayerSubType () const
 Get layer subtype: each layer type can have several flavors. More...
 
virtual bool IsLayerType (mpLayerType type, int *sub_type)
 Specifies that if the layer is of type "type". More...
 
virtual double GetMinX ()
 Get inclusive left border of bounding box. More...
 
virtual double GetMaxX ()
 Get inclusive right border of bounding box. More...
 
virtual double GetMinY ()
 Get inclusive bottom border of bounding box. More...
 
virtual double GetMaxY ()
 Get inclusive top border of bounding box. More...
 
void Plot (wxDC &dc, mpWindow &w)
 Plot given view of layer to the given device context. More...
 
void SetName (const wxString &name)
 Set layer name. More...
 
const wxString & GetName () const
 Get layer name. More...
 
void SetFont (const wxFont &font)
 Set layer font. More...
 
const wxFont & GetFont () const
 Get font set for this layer. More...
 
void SetFontColour (const wxColour &colour)
 Set layer font foreground colour. More...
 
const wxColour & GetFontColour () const
 Get font foreground colour set for this layer. More...
 
void SetPen (const wxPen &pen)
 Set layer pen. More...
 
const wxPen & GetPen () const
 Get pen set for this layer. More...
 
void SetBrush (const wxBrush &brush)
 Set layer brush. More...
 
const wxBrush & GetBrush () const
 Get brush set for this layer. More...
 
void SetShowName (bool show)
 Set Name visibility. More...
 
bool GetShowName () const
 Get Name visibility. More...
 
void SetDrawOutsideMargins (bool drawModeOutside)
 Set Draw mode: inside or outside margins. More...
 
bool GetDrawOutsideMargins () const
 Get Draw mode: inside or outside margins. More...
 
wxBitmap GetColourSquare (int side=16)
 Get a small square bitmap filled with the colour of the pen used in the layer. More...
 
bool IsVisible () const
 Checks whether the layer is visible or not. More...
 
virtual void SetVisible (bool show)
 Sets layer visibility. More...
 
bool IsTractable () const
 Checks whether the layer is tractable or not. More...
 
virtual void SetTractable (bool track)
 Sets layer tractability. More...
 
void SetAlign (int align)
 Set X/Y alignment. More...
 
int GetAlign () const
 Get X/Y alignment. More...
 
void SetCanDelete (bool canDelete)
 Set CanDelete for plot. More...
 
bool GetCanDelete (void) const
 Get CanDelete for plot. More...
 
mpLayerZOrder GetZIndex (void) const
 Get the ZIndex of the plot. More...
 

Protected Member Functions

virtual void DoPlot (wxDC &dc, mpWindow &w)
 Layer plot handler. More...
 
virtual int GetOrigin (mpWindow &w)
 Get the origin of axis and initialize the plot boundaries.
 
virtual void DrawScaleName (wxDC &dc, mpWindow &w, int origin, int labelSize)
 
wxString FormatValue (const wxString &fmt, double n)
 
 wxDECLARE_DYNAMIC_CLASS (mpScaleX)
 
- Protected Member Functions inherited from MathPlot::mpScale
double GetStep (double scale)
 
wxString FormatLogValue (double n)
 
 wxDECLARE_DYNAMIC_CLASS (mpScale)
 
- Protected Member Functions inherited from MathPlot::mpLayer
void UpdateContext (wxDC &dc) const
 Initialize the context.
 
virtual void DoBeforePlot ()
 If we need to do something before plot like reinitialize some parameters ...
 
void CheckLog (double *x, double *y)
 Test if we are in log axis and if true return the log of the values.
 

Protected Attributes

unsigned int m_labelType
 Select labels mode: mpX_NORMAL for normal labels, mpX_TIME for time axis in hours, minutes, seconds.
 
unsigned int m_timeConv
 Selects if time has to be converted to local time or not.
 
- Protected Attributes inherited from MathPlot::mpScale
wxPen m_gridpen
 Grid's pen. Default Colour = LIGHT_GREY, width = 1, style = wxPENSTYLE_DOT.
 
bool m_ticks
 Flag to show ticks. Default true.
 
bool m_grids
 Flag to show grids. Default false.
 
bool m_auto
 Flag to autosize grids. Default true.
 
double m_min
 
double m_max
 Min and max axis values when autosize is false.
 
wxString m_labelFormat
 Format string used to print labels.
 
- Protected Attributes inherited from MathPlot::mpLayer
const mpLayerType m_type
 Layer type mpLAYER_*.
 
mpWindowm_win
 The wxWindow handle.
 
int m_subtype
 Layer sub type, set in constructors.
 
wxFont m_font
 Layer's font.
 
wxColour m_fontcolour
 Layer's font foreground colour.
 
wxPen m_pen
 Layer's pen. Default Colour = Black, width = 1, style = wxPENSTYLE_SOLID.
 
wxBrush m_brush
 Layer's brush. Default wxTRANSPARENT_BRUSH.
 
wxString m_name
 Layer's name.
 
bool m_showName
 States whether the name of the layer must be shown. Default : false.
 
bool m_drawOutsideMargins
 Select if the layer should draw only inside margins or over all DC. Default : false.
 
bool m_visible
 Toggles layer visibility. Default : true.
 
bool m_tractable
 Is the layer tractable.
 
int m_flags
 Holds label alignment. Default : mpALIGN_NE.
 
mpRect m_plotBoundaries
 The boundaries for plotting curve calculated by mpWindow.
 
bool m_CanDelete
 Is the layer can be deleted.
 
mpLayerZOrder m_ZIndex
 The index in Z-Order to draw the layer.
 

Detailed Description

Plot layer implementing a x-scale ruler.

The ruler is fixed at Y=0 in the coordinate system. A label is plotted at the bottom-right hand of the ruler. The scale numbering automatically adjusts to view and zoom factor.

Constructor & Destructor Documentation

◆ mpScaleX()

MathPlot::mpScaleX::mpScaleX ( const wxString &  name = _T("X"),
int  flags = mpALIGN_CENTERX,
bool  grids = false,
unsigned int  type = 0x00 
)
inline

Full constructor.

Parameters
nameLabel to plot by the ruler
flagsSet the position of the scale with respect to the window.
gridsShow grid or not. Give false (default) for not drawing the grid.
typempX_NORMAL for normal labels, mpX_TIME for time axis in hours, minutes, seconds.

Member Function Documentation

◆ DoPlot()

void mpScaleX::DoPlot ( wxDC &  dc,
mpWindow w 
)
protectedvirtual

Layer plot handler.

This implementation will plot the ruler adjusted to the visible area.

Implements MathPlot::mpLayer.

◆ GetLabelMode()

unsigned int MathPlot::mpScaleX::GetLabelMode ( ) const
inline

Get X axis label view mode.

Returns
mpX_NORMAL for normal labels, mpX_TIME for time axis in hours, minutes, seconds.

◆ SetLabelFormat()

virtual void MathPlot::mpScaleX::SetLabelFormat ( const wxString &  format)
inlinevirtual

Set axis Label format (used for mpX_NORMAL draw mode).

Parameters
formatThe format string

Reimplemented from MathPlot::mpScale.

◆ SetLabelMode()

void MathPlot::mpScaleX::SetLabelMode ( unsigned int  mode,
unsigned int  time_conv = 0x20 
)
inline

Set X axis label view mode.

Parameters
modempX_NORMAL for normal labels, mpX_TIME for time axis in hours, minutes, seconds.