mathplot.h code formatting

This commit is contained in:
Maciej Suminski 2016-08-11 14:41:25 +02:00
parent 88adcc894a
commit d5ce31dc8e
1 changed files with 1171 additions and 1171 deletions

View File

@ -42,20 +42,20 @@
The original author is David Schalig <mrhill@users.sourceforge.net>.<br>
From June 2007 the project is maintained by Davide Rondini <cdron77@users.sourceforge.net>.<br>
Authors can be contacted via the wxMathPlot's homepage at
https://sourceforge.net/projects/wxmathplot<br>
Contributors:<br>
Jose Luis Blanco, Val Greene.<br>
https://sourceforge.net/projects/wxmathplot<br>
Contributors:<br>
Jose Luis Blanco, Val Greene.<br>
*/
//this definition uses windows dll to export function.
//WXDLLIMPEXP_MATHPLOT definition definition changed to WXDLLIMPEXP_MATHPLOT
//mathplot_EXPORTS will be defined by cmake
#ifdef mathplot_EXPORTS
#define WXDLLIMPEXP_MATHPLOT WXEXPORT
#define WXDLLIMPEXP_DATA_MATHPLOT(type) WXEXPORT type
#define WXDLLIMPEXP_MATHPLOT WXEXPORT
#define WXDLLIMPEXP_DATA_MATHPLOT(type) WXEXPORT type
#else // not making DLL
#define WXDLLIMPEXP_MATHPLOT
#define WXDLLIMPEXP_DATA_MATHPLOT(type) type
#define WXDLLIMPEXP_MATHPLOT
#define WXDLLIMPEXP_DATA_MATHPLOT(type) type
#endif
#if defined(__GNUG__) && !defined(__APPLE__)
@ -140,10 +140,10 @@ typedef enum __mp_Layer_Type {
The default values at constructor are the default font, a black pen, and
continuity set to false (draw separate points).
These may or may not be used by implementations.
*/
*/
class WXDLLIMPEXP_MATHPLOT mpLayer : public wxObject
{
public:
public:
mpLayer();
virtual ~mpLayer() {};
@ -305,7 +305,7 @@ public:
@param brush brush, will be copied to internal class member */
void SetBrush(wxBrush brush) { m_brush = brush; };
protected:
protected:
wxFont m_font; //!< Layer's font
wxPen m_pen; //!< Layer's pen
wxBrush m_brush; //!< Layer's brush
@ -326,10 +326,10 @@ protected:
/** @class mpInfoLayer
@brief Base class to create small rectangular info boxes
mpInfoLayer is the base class to create a small rectangular info box in transparent overlay over plot layers. It is used to implement objects like legends.
*/
*/
class WXDLLIMPEXP_MATHPLOT mpInfoLayer : public mpLayer
{
public:
public:
/** Default constructor. */
mpInfoLayer();
@ -386,7 +386,7 @@ public:
@return The info layer rectangle */
const wxRect& GetRectangle() { return m_dim; };
protected:
protected:
wxRect m_dim; //!< The bounding rectangle of the box. It may be resized dynamically by the Plot method.
wxPoint m_reference; //!< Holds the reference point for movements
wxBrush m_brush; //!< The brush to be used for the background
@ -400,7 +400,7 @@ protected:
When an mpInfoCoords layer is activated, when mouse is moved over the mpWindow, its coordinates (in mpWindow units, not pixels) are continuously reported inside the layer box. */
class WXDLLIMPEXP_MATHPLOT mpInfoCoords : public mpInfoLayer
{
public:
public:
/** Default constructor */
mpInfoCoords();
/** Complete constructor, setting initial rectangle and background brush.
@ -422,7 +422,7 @@ public:
@sa mpLayer::Plot */
virtual void Plot(wxDC & dc, mpWindow & w);
protected:
protected:
wxString m_content; //!< string holding the coordinates to be drawn.
};
@ -431,7 +431,7 @@ protected:
This layer allows you to add a legend to describe the plots in the window. The legend uses the layer name as a label, and displays only layers of type mpLAYER_PLOT. */
class WXDLLIMPEXP_MATHPLOT mpInfoLegend : public mpInfoLayer
{
public:
public:
/** Default constructor */
mpInfoLegend();
@ -455,7 +455,7 @@ public:
@sa mpLayer::Plot */
virtual void Plot(wxDC & dc, mpWindow & w);
protected:
protected:
};
@ -465,7 +465,7 @@ protected:
//-----------------------------------------------------------------------------
/** @name Label alignment constants
@{*/
@{*/
/** @internal */
#define mpALIGNMASK 0x03
@ -509,16 +509,16 @@ protected:
/*@}*/
/** @name mpLayer implementations - functions
@{*/
@{*/
/** Abstract base class providing plot and labeling functionality for functions F:X->Y.
Override mpFX::GetY to implement a function.
Optionally implement a constructor and pass a name (label) and a label alignment
to the constructor mpFX::mpFX. If the layer name is empty, no label will be plotted.
*/
*/
class WXDLLIMPEXP_MATHPLOT mpFX : public mpLayer
{
public:
public:
/** @param name Label
@param flags Label alignment, pass one of #mpALIGN_RIGHT, #mpALIGN_CENTER, #mpALIGN_LEFT.
*/
@ -537,7 +537,7 @@ public:
*/
virtual void Plot(wxDC & dc, mpWindow & w);
protected:
protected:
int m_flags; //!< Holds label alignment
DECLARE_DYNAMIC_CLASS(mpFX)
@ -547,10 +547,10 @@ protected:
Override mpFY::GetX to implement a function.
Optionally implement a constructor and pass a name (label) and a label alignment
to the constructor mpFY::mpFY. If the layer name is empty, no label will be plotted.
*/
*/
class WXDLLIMPEXP_MATHPLOT mpFY : public mpLayer
{
public:
public:
/** @param name Label
@param flags Label alignment, pass one of #mpALIGN_BOTTOM, #mpALIGN_CENTER, #mpALIGN_TOP.
*/
@ -569,7 +569,7 @@ public:
*/
virtual void Plot(wxDC & dc, mpWindow & w);
protected:
protected:
int m_flags; //!< Holds label alignment
DECLARE_DYNAMIC_CLASS(mpFY)
@ -580,10 +580,10 @@ protected:
all locus values. Override mpFXY::Rewind and mpFXY::GetNextXY to implement a locus.
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.
*/
*/
class WXDLLIMPEXP_MATHPLOT mpFXY : public mpLayer
{
public:
public:
/** @param name Label
@param flags Label alignment, pass one of #mpALIGN_NE, #mpALIGN_NW, #mpALIGN_SW, #mpALIGN_SE.
*/
@ -608,7 +608,7 @@ public:
virtual void Plot(wxDC & dc, mpWindow & w);
protected:
protected:
int m_flags; //!< Holds label alignment
// Data to calculate label positioning
@ -629,10 +629,10 @@ protected:
This class is similar to mpFY, but the Plot method is different. The plot is in fact represented by lines instead of points, which gives best rendering of rapidly-varying functions, and in general, data which are not so close one to another.
Optionally implement a constructor and pass a name (label) and a label alignment
to the constructor mpProfile::mpProfile. If the layer name is empty, no label will be plotted.
*/
*/
class WXDLLIMPEXP_MATHPLOT mpProfile : public mpLayer
{
public:
public:
/** @param name Label
@param flags Label alignment, pass one of #mpALIGN_BOTTOM, #mpALIGN_CENTER, #mpALIGN_TOP.
*/
@ -651,7 +651,7 @@ public:
*/
virtual void Plot(wxDC & dc, mpWindow & w);
protected:
protected:
int m_flags; //!< Holds label alignment
DECLARE_DYNAMIC_CLASS(mpProfile)
@ -664,16 +664,16 @@ protected:
//-----------------------------------------------------------------------------
/** @name mpLayer implementations - furniture (scales, ...)
@{*/
@{*/
/** 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.
*/
*/
class WXDLLIMPEXP_MATHPLOT mpScaleX : public mpLayer
{
public:
public:
/** Full constructor.
@param name Label to plot by the ruler
@param flags Set the position of the scale with respect to the window.
@ -718,7 +718,7 @@ public:
@return The format string */
const wxString& SetLabelFormat() { return m_labelFormat; };
protected:
protected:
int m_flags; //!< Flag for axis alignment
bool m_ticks; //!< Flag to toggle between ticks or grid
unsigned int m_labelType; //!< Select labels mode: mpX_NORMAL for normal labels, mpX_TIME for time axis in hours, minutes, seconds
@ -731,10 +731,10 @@ protected:
If align is set to mpALIGN_CENTER, the ruler is fixed at X=0 in the coordinate system. If the align is set to mpALIGN_TOP or mpALIGN_BOTTOM, the axis is always drawn respectively at top or bottom of the window. A label is plotted at
the top-right hand of the ruler. The scale numbering automatically
adjusts to view and zoom factor.
*/
*/
class WXDLLIMPEXP_MATHPLOT mpScaleY : public mpLayer
{
public:
public:
/** @param name Label to plot by the ruler
@param flags Set position of the scale respect to the window.
@param ticks Select ticks or grid. Give TRUE (default) for drawing axis ticks, FALSE for drawing the grid */
@ -771,7 +771,7 @@ public:
@return The format string */
const wxString& SetLabelFormat() { return m_labelFormat; };
protected:
protected:
int m_flags; //!< Flag for axis alignment
bool m_ticks; //!< Flag to toggle between ticks or grid
wxString m_labelFormat; //!< Format string used to print labels
@ -784,7 +784,7 @@ protected:
//-----------------------------------------------------------------------------
/** @name Constants defining mouse modes for mpWindow
@{*/
@{*/
/** Mouse panning drags the view. Mouse mode for mpWindow. */
#define mpMOUSEMODE_DRAG 0
@ -820,7 +820,7 @@ typedef std::deque<mpLayer*> wxLayerList;
*/
class WXDLLIMPEXP_MATHPLOT mpWindow : public wxWindow
{
public:
public:
mpWindow() {}
mpWindow( wxWindow *parent, wxWindowID id,
const wxPoint &pos = wxDefaultPosition,
@ -953,22 +953,22 @@ public:
/** Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates, using current mpWindow position and scale.
* @sa p2y,x2p,y2p */
// double p2x(wxCoord pixelCoordX, bool drawOutside = true ); // { return m_posX + pixelCoordX/m_scaleX; }
// double p2x(wxCoord pixelCoordX, bool drawOutside = true ); // { return m_posX + pixelCoordX/m_scaleX; }
inline double p2x(wxCoord pixelCoordX ) { return m_posX + pixelCoordX/m_scaleX; }
/** Converts mpWindow (screen) pixel coordinates into graph (floating point) coordinates, using current mpWindow position and scale.
* @sa p2x,x2p,y2p */
// double p2y(wxCoord pixelCoordY, bool drawOutside = true ); //{ return m_posY - pixelCoordY/m_scaleY; }
// double p2y(wxCoord pixelCoordY, bool drawOutside = true ); //{ return m_posY - pixelCoordY/m_scaleY; }
inline double p2y(wxCoord pixelCoordY ) { return m_posY - pixelCoordY/m_scaleY; }
/** Converts graph (floating point) coordinates into mpWindow (screen) pixel coordinates, using current mpWindow position and scale.
* @sa p2x,p2y,y2p */
// wxCoord x2p(double x, bool drawOutside = true); // { return (wxCoord) ( (x-m_posX) * m_scaleX); }
// wxCoord x2p(double x, bool drawOutside = true); // { return (wxCoord) ( (x-m_posX) * m_scaleX); }
inline wxCoord x2p(double x) { return (wxCoord) ( (x-m_posX) * m_scaleX); }
/** Converts graph (floating point) coordinates into mpWindow (screen) pixel coordinates, using current mpWindow position and scale.
* @sa p2x,p2y,x2p */
// wxCoord y2p(double y, bool drawOutside = true); // { return (wxCoord) ( (m_posY-y) * m_scaleY); }
// wxCoord y2p(double y, bool drawOutside = true); // { return (wxCoord) ( (m_posY-y) * m_scaleY); }
inline wxCoord y2p(double y) { return (wxCoord) ( (m_posY-y) * m_scaleY); }
@ -1156,7 +1156,7 @@ public:
@return reference to axis colour used in theme */
const wxColour& GetAxesColour() { return m_axColour; };
protected:
protected:
void OnPaint (wxPaintEvent &event); //!< Paint handler, will plot all attached layers
void OnSize (wxSizeEvent &event); //!< Size handler, will update scroll bar sizes
// void OnScroll2 (wxScrollWinEvent &event); //!< Scroll handler, will move canvas
@ -1258,10 +1258,10 @@ protected:
to render the sequence of coordinates as a continuous line.
(Added: Jose Luis Blanco, AGO-2007)
*/
*/
class WXDLLIMPEXP_MATHPLOT mpFXYVector : public mpFXY
{
public:
public:
/** @param name Label
@param flags Label alignment, pass one of #mpALIGN_NE, #mpALIGN_NW, #mpALIGN_SW, #mpALIGN_SE.
*/
@ -1278,7 +1278,7 @@ public:
*/
void Clear();
protected:
protected:
/** The internal copy of the set of data to draw.
*/
std::vector<double> m_xs,m_ys;
@ -1329,14 +1329,14 @@ protected:
//-----------------------------------------------------------------------------
/** Plot layer implementing a text string.
The text is plotted using a percentage system 0-100%, so the actual
coordinates for the location are not required, and the text stays
on the plot reguardless of the other layers location and scaling
factors.
*/
The text is plotted using a percentage system 0-100%, so the actual
coordinates for the location are not required, and the text stays
on the plot reguardless of the other layers location and scaling
factors.
*/
class WXDLLIMPEXP_MATHPLOT mpText : public mpLayer
{
public:
public:
/** @param name text to be drawn in the plot
@param offsetx holds offset for the X location in percentage (0-100)
@param offsety holds offset for the Y location in percentage (0-100) */
@ -1349,7 +1349,7 @@ public:
/** mpText should not be used for scaling decisions. */
virtual bool HasBBox() { return FALSE; }
protected:
protected:
int m_offsetx; //!< Holds offset for X in percentage
int m_offsety; //!< Holds offset for Y in percentage
@ -1364,10 +1364,10 @@ protected:
/** Printout class used by mpWindow to draw in the objects to be printed.
The object itself can then used by the default wxWidgets printing system
to print mppWindow objects.
*/
*/
class WXDLLIMPEXP_MATHPLOT mpPrintout : public wxPrintout
{
public:
public:
mpPrintout(mpWindow* drawWindow, const wxChar *title = _T("wxMathPlot print output"));
virtual ~mpPrintout() {};
@ -1375,7 +1375,7 @@ public:
bool OnPrintPage(int page);
bool HasPage(int page);
private:
private:
bool drawn;
mpWindow *plotWindow;
};
@ -1392,7 +1392,7 @@ private:
*/
class WXDLLIMPEXP_MATHPLOT mpMovableObject : public mpLayer
{
public:
public:
/** Default constructor (sets location and rotation to (0,0,0))
*/
mpMovableObject( ) :
@ -1452,7 +1452,7 @@ public:
*/
void SetAlign(int align) { m_flags = align; };
protected:
protected:
int m_flags; //!< Holds label alignment
/** The coordinates of the object (orientation "phi" is in radians).
@ -1500,7 +1500,7 @@ protected:
*/
class WXDLLIMPEXP_MATHPLOT mpCovarianceEllipse : public mpMovableObject
{
public:
public:
/** Default constructor.
* Initializes to a unity diagonal covariance matrix, a 95% confidence interval (2 sigmas), 32 segments, and a continuous plot (m_continuous=true).
*/
@ -1557,7 +1557,7 @@ public:
RecalculateShape();
}
protected:
protected:
/** The elements of the matrix (only 3 since cov(0,1)=cov(1,0) in any positive definite matrix).
*/
double m_cov_00,m_cov_11,m_cov_01;
@ -1581,7 +1581,7 @@ protected:
*/
class WXDLLIMPEXP_MATHPLOT mpPolygon : public mpMovableObject
{
public:
public:
/** Default constructor.
*/
mpPolygon( const wxString & layerName = wxT("") )
@ -1617,7 +1617,7 @@ public:
*/
class WXDLLIMPEXP_MATHPLOT mpBitmapLayer : public mpLayer
{
public:
public:
/** Default constructor.
*/
mpBitmapLayer( )
@ -1668,7 +1668,7 @@ public:
*/
void SetAlign(int align) { m_flags = align; };
protected:
protected:
int m_flags; //!< Holds label alignment
/** The internal copy of the Bitmap: