MathPlot
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
mpFXY Class Referenceabstract

Abstract base class providing plot and labeling functionality for a locus plot F:N->X,Y. More...

#include <mathplot.h>

Inheritance diagram for mpFXY:
Inheritance graph
[legend]
Collaboration diagram for mpFXY:
Collaboration graph
[legend]

Public Member Functions

 mpFXY (const wxString &name=wxEmptyString, int flags=mpALIGN_SW, bool viewAsBar=false, unsigned int yAxisID=0)
 
virtual void Rewind ()=0
 Rewind value enumeration with mpFXY::GetNextXY. More...
 
virtual void Clear ()
 Clears all the data, leaving the layer empty. More...
 
virtual int GetSize ()
 Return the number of points in the series.
 
virtual bool GetNextXY (double *x, double *y)=0
 Get locus value for next N. More...
 
bool DoGetNextXY (double *x, double *y)
 Get function value with log test. More...
 
void SetViewMode (bool asBar)
 Switch series plot like a bar mode. More...
 
int GetBarWidth (void) const
 Get the width of the bar when we plot in bar mode. More...
 
bool ViewAsBar (void) const
 Get if we are in bar mode. More...
 
- Public Member Functions inherited from mpFunction
 mpFunction (mpLayerType layerType=mpLAYER_PLOT, const wxString &name=wxEmptyString, unsigned int yAxisID=0)
 Full constructor. More...
 
void SetContinuity (bool continuity)
 Set the 'continuity' property of the layer. More...
 
bool GetContinuity () const
 Gets the 'continuity' property of the layer. More...
 
void SetStep (unsigned int step)
 Set step for plot. More...
 
unsigned int GetStep () const
 Get step for plot. More...
 
void SetSymbol (mpSymbol symbol)
 Set symbol. More...
 
mpSymbol GetSymbol () const
 Get symbol. More...
 
void SetSymbolSize (int size)
 Set symbol size. More...
 
int GetSymbolSize () const
 Get symbol size. More...
 
virtual bool DrawSymbol (wxDC &dc, wxCoord x, wxCoord y)
 Draw a symbol in place of point. More...
 
int GetYAxisID () const
 Get the ID of the Y axis used by the function.
 
void SetYAxisID (unsigned int yAxisID)
 Set the ID of the Y axis used by the function.
 
- Public Member Functions inherited from mpLayer
 mpLayer (mpLayerType layerType)
 The base class of all layer objects. More...
 
void SetWindow (mpWindow &w)
 Set the wxWindow handle.
 
virtual bool HasBBox ()
 Check whether this layer has a bounding box. More...
 
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 typeOfInterest, int *subtype)
 Set the layer's subtype in caller variable, and return true if the layer is of type "typeOfInterest". 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)
 Define what we do with the object associated with the layer when we delete the layer. More...
 
bool GetCanDelete (void) const
 Retreive what we do with the object associated with the layer when we delete the layer. 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...
 
void UpdateViewBoundary (wxCoord xnew, wxCoord ynew)
 Update label positioning data. More...
 
 wxDECLARE_DYNAMIC_CLASS (mpFXY)
 
- Protected Member Functions inherited from mpFunction
 wxDECLARE_DYNAMIC_CLASS (mpFunction)
 
- Protected Member Functions inherited from mpLayer
void UpdateContext (wxDC &dc) const
 Initialize the context.
 
virtual bool DoBeforePlot ()
 If we need to do something before plot like reinitialize some parameters ... More...
 
void CheckLog (double *x, double *y, int yAxisID)
 Test if we are in log axis and if true return the log of the values. More...
 

Protected Attributes

mpRange< int > m_drawX
 Range min and max on x axis.
 
mpRange< int > m_drawY
 Range min and max on y axis.
 
double m_deltaX
 Min delta between 2 consecutive coordinate on x direction.
 
double m_deltaY
 Min delta between 2 consecutive coordinate on y direction.
 
int m_BarWidth
 
bool m_ViewAsBar = false
 
- Protected Attributes inherited from mpFunction
bool m_continuous
 Specify if the layer will be plotted as a continuous line or a set of points. Default false.
 
mpSymbol m_symbol
 A symbol for the plot in place of point. Default mpNone.
 
int m_symbolSize
 Size of the symbol. Default 6.
 
int m_symbolSize2
 Size of the symbol div 2.
 
unsigned int m_step
 Step to get point to be draw. Default : 1.
 
int m_yAxisID
 The ID of the Y axis used by the function. Equal 0 if no axis.
 
- Protected Attributes inherited from 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_SW for series and mpALIGN_CENTER for scale.
 
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

Abstract base class providing plot and labeling functionality for a locus plot F:N->X,Y.

Locus argument N is assumed to be in range 0 .. MAX_N, and implicitly derived by enumerating all locus values.
Override mpFXY::Rewind and mpFXY::GetNextXY to implement a locus.
Override mpFXY::GetMinX and mpFXY::GetMaxX to provide min and max X range
Override mpFXY::GetMinY and mpFXY::GetMaxY to provide min and max Y range
Optionally implement a constructor and pass a name (label) and a label alignment to the constructor mpFXY::mpFXY. If the layer name is empty, no label will be plotted.

Constructor & Destructor Documentation

◆ mpFXY()

mpFXY::mpFXY ( const wxString &  name = wxEmptyString,
int  flags = mpALIGN_SW,
bool  viewAsBar = false,
unsigned int  yAxisID = 0 
)
Parameters
nameLabel
flagsLabel alignment, pass one of mpALIGN_NE, mpALIGN_NW, mpALIGN_SW, mpALIGN_SE.
viewAsBartrue if we plot the XY series as bar mode (default false)
yAxisIDID of the y axis (default 0, the first y axis)

Member Function Documentation

◆ Clear()

virtual void mpFXY::Clear ( )
inlinevirtual

Clears all the data, leaving the layer empty.

See also
SetData

Reimplemented in mpFXYVector.

◆ DoGetNextXY()

bool mpFXY::DoGetNextXY ( double *  x,
double *  y 
)

Get function value with log test.

Parameters
xx-coordinate
yy-coordinate
Returns
false when there are no more points (normally true)

◆ DoPlot()

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

Layer plot handler.

This implementation will plot the locus in the visible area and put a label according to the alignment specified.

Parameters
dcthe device content where to plot
wthe window to plot

Implements mpLayer.

◆ GetBarWidth()

int mpFXY::GetBarWidth ( void  ) const
inline

Get the width of the bar when we plot in bar mode.

Returns
the width of the bar

◆ GetNextXY()

virtual bool mpFXY::GetNextXY ( double *  x,
double *  y 
)
pure virtual

Get locus value for next N.

Override this function in your implementation.

Parameters
xReturns X value
yReturns Y value
Returns
false when there are no more points (normally true)

Implemented in mpFXYVector, and MyLissajoux.

◆ Rewind()

virtual void mpFXY::Rewind ( )
pure virtual

Rewind value enumeration with mpFXY::GetNextXY.

Override this function in your implementation.

Implemented in mpFXYVector, and MyLissajoux.

◆ SetViewMode()

void mpFXY::SetViewMode ( bool  asBar)

Switch series plot like a bar mode.

Parameters
asBarIf true, XY series is plotted as bar

◆ UpdateViewBoundary()

void mpFXY::UpdateViewBoundary ( wxCoord  xnew,
wxCoord  ynew 
)
protected

Update label positioning data.

Parameters
xnewNew x coordinate
ynewNew y coordinate

◆ ViewAsBar()

bool mpFXY::ViewAsBar ( void  ) const
inline

Get if we are in bar mode.

Returns
true if XY series is plotted with bar