wxEcMath - Official documentation  0.6.4
Public Member Functions | List of all members
wxEcPlot Class Reference

The component which draws the curves. More...

#include <ec_plot.h>

Inherits wxWindow.

Public Member Functions

void Redraw ()
 
 wxEcPlot (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0)
 
 ~wxEcPlot ()
 
void Lock (bool state=true)
 
void Reset ()
 
wxString GetLastTangentEquation ()
 
bool DrawTangent (int index, double position)
 
bool DrawDerivative (int index)
 
int AddCurve (wxEcCurve curve)
 
int AddCurve (wxEcCurve *curve)
 
int CountCurve ()
 
void DeleteCurve (int index)
 
void EnableCurve (int index, bool state)
 
wxEcCurveGetCurve (int index)
 
bool SetCurve (int index, wxEcCurve *curve)
 
void RemoveAllCurves ()
 
wxPoint CoupleValueToXY (double X, double Y)
 
bool IsVisible (double X, double Y)
 
void SetUnit (double perpixel, bool forX)
 
int ValueToX (double value)
 
int ValueToY (double value)
 
double XPerPixel ()
 
double XToValue (int X)
 
double YPerPixel ()
 
double YToValue (int Y)
 
wxColour GetBackgroundColour ()
 
bool SetBackgroundColour (const wxColour &value)
 
bool GetFlatBorder ()
 
void SetFlatBorder (bool value)
 
void SetDefaultGrid ()
 
bool GetGridVisible ()
 
void SetGridVisible (bool value)
 
bool GetGridPolar ()
 
void SetGridPolar (bool value)
 
wxColour GetGridColour ()
 
void SetGridColour (wxColour value)
 
wxEcAxisGetAxis (bool forX)
 
void SetAxis (wxEcAxis axis, bool forX=true)
 
bool FitYAxis ()
 
bool FitXAxis ()
 
double GetYMax ()
 
double GetYMin ()
 
void Orthonormalize (bool symetrical=true)
 
double GetZoomFactor ()
 
bool SetZoomFactor (double value=wxECD_ZOOMFACTOR)
 
void Unzoom ()
 
void Zoom ()
 
void SetReticule (double x, double y)
 
bool GetReticuleVisible ()
 
void SetReticuleVisible (bool value)
 
wxColour GetReticuleColour ()
 
void SetReticuleColour (wxColour value)
 
void OnPaint (wxPaintEvent &event)
 
void OnResize (wxSizeEvent &event)
 

Detailed Description

The component which draws the curves.

wxEcPlot is a component derived from wxWindow. It has a canvas on which you can draw. Most of the time, the curves are drawn when a onPaint event occurs. If you call wxWindowDC(myPlot), it is possible to draw on the client area.

Before using the component, you must be aware that most of the methods does NOT refresh the component automatically. So you must call wxEcPlot::Refresh() to see any modification. The aim is to have better performances.

Constructor & Destructor Documentation

wxEcPlot::wxEcPlot ( wxWindow *  parent,
wxWindowID  id = wxID_ANY,
const wxPoint &  pos = wxDefaultPosition,
const wxSize &  size = wxDefaultSize,
long  style = 0 
)

The default constructor.

Parameters
parentThe parent of the component. Can be a wxFrame, a wxDialog, a wxPanel...
idThe unique identifier.
posThe default position.
sizeThe default size.
styleThe style (see wxWindow).
wxEcPlot::~wxEcPlot ( )

The default destructor.

Member Function Documentation

int wxEcPlot::AddCurve ( wxEcCurve  curve)
inline

Adds a new curve.

Parameters
curveAn object defining the curve to add.
Returns
wxNOT_FOUND if memory is exceeded, a positive or null value on success.
int wxEcPlot::AddCurve ( wxEcCurve curve)
inline

Adds a new curve.

Parameters
curvePointer to an object defining the curve to add.
Returns
wxNOT_FOUND if memory is exceeded, a positive or null value on success.
int wxEcPlot::CountCurve ( )
inline

Returns the number of curves currently defined.

wxPoint wxEcPlot::CoupleValueToXY ( double  X,
double  Y 
)

Converts floating values into coordinates of the plan. The result depends on how the axis are defined (see SetAxis()).

Parameters
XThe X-coordinate.
YThe Y-coordinate.
Returns
A structure containing X and Y converted.
void wxEcPlot::DeleteCurve ( int  index)
inline

Removes the curve specified by its identifier.

Parameters
indexThe identifier of the curve (obtained with AddCurve()).
bool wxEcPlot::DrawDerivative ( int  index)

Draws in entire but temporarily the derivative of a curve, restricted on the correct domain.

Parameters
indexThe identifier of the curve (obtained with AddCurve()).
Returns
true on success, false on failure.
Remarks
It only works with wxECT_CARTESIAN.
See also
wxEcEngine::Derivate()
bool wxEcPlot::DrawTangent ( int  index,
double  position 
)

Draws a temporary tangent.

Parameters
indexThe identifier of the curve (obtained with AddCurve()).
positionThe X-coordinate where the tangent shall be drawn.
Returns
true on success, false on failure.
Remarks
It only works with wxECT_CARTESIAN.
See also
GetLastTangentEquation()
void wxEcPlot::EnableCurve ( int  index,
bool  state 
)
inline

Enables or disables the curve specified by its identifier.

Parameters
indexThe identifier of the curve (obtained with AddCurve()).
statetrue to enable, false to disable.
bool wxEcPlot::FitXAxis ( )
inline

By considering all the curves defined as wxECT_CLOUD, this function sets the X-coordinate to allow the cloud to be correctly visible. To fit the second coordinate, use wxEcPlot::FitYAxis().

Remarks
This function doesn't care of other curves not typed as wxECT_CLOUD. In this case, compare the new value of the axis with the old one.
Returns
true if the axis has been edited, else false.
bool wxEcPlot::FitYAxis ( )
inline

Fits the Y-axis to make all the enabled curves visible. You cannot use this function if the curves have not been drawn at least one time. Use Refresh() to do so.

Returns
true if the Y-axis has been modified, else false.
See also
GetYMin()
GetYMax()
FitXAxis()
wxEcAxis* wxEcPlot::GetAxis ( bool  forX)
inline

Gives a pointer to the axis currently used for X or Y.

Parameters
forXtrue returns for X, false returns for Y
wxColour wxEcPlot::GetBackgroundColour ( )
inline

Gets the colour of the background.

wxEcCurve* wxEcPlot::GetCurve ( int  index)
inline

Returns a curve.

Parameters
indexThe identifier of the curve (obtained with AddCurve()).
Returns
The curve "as is" : defined or not, enabled or not.
bool wxEcPlot::GetFlatBorder ( )
inline

Indicates if the control have a black border.

wxColour wxEcPlot::GetGridColour ( )
inline

Gets the colour of the grid.

bool wxEcPlot::GetGridPolar ( )
inline

Returns true if the grid is polar.

bool wxEcPlot::GetGridVisible ( )
inline

Returns the visibility of the grid

wxString wxEcPlot::GetLastTangentEquation ( )
inline

Returns the equation you obtained at the last call of DrawTangent().

wxColour wxEcPlot::GetReticuleColour ( )
inline

Gets the colour of the reticule.

bool wxEcPlot::GetReticuleVisible ( )
inline

Gets the visibility of the reticule.

double wxEcPlot::GetYMax ( )
inline

Returns the maximal value of Y found during the last refresh.

See also
FitYAxis()
double wxEcPlot::GetYMin ( )
inline

Returns the minimal value of Y found during the last refresh.

See also
FitYAxis()
double wxEcPlot::GetZoomFactor ( )
inline

Returns the current zoom factor.

bool wxEcPlot::IsVisible ( double  X,
double  Y 
)

Indicates if the point (x,y) relative to the axis is visible.

Parameters
XThe X-coordinate.
YThe Y-coordinate.
Returns
true if the point belongs to the visible client area, false if the point is out of range
void wxEcPlot::Lock ( bool  state = true)
inline

Locks or unlocks the automatic refresh.

Parameters
statetrue to lock, false to unlock.
void wxEcPlot::OnPaint ( wxPaintEvent &  event)

The event when a repaint is called.

void wxEcPlot::OnResize ( wxSizeEvent &  event)

The event when the control is resized.

void wxEcPlot::Orthonormalize ( bool  symetrical = true)
inline

This function solves YPerPixel()=XPerPixel(). The grid will look like squares and right angles are possible.

Parameters
symetricalIf false, Ymax will be adjusted. If true, Ymax and Ymin will be edited, and Ymin = -Ymin.
Remarks
Y-axis will be made symmetrical compared to zero.
void wxEcPlot::Redraw ( )
inline

Refresh only works when your component is visible. With this method, you can force the redraw even if your component is not visible.

void wxEcPlot::RemoveAllCurves ( )
inline

Deletes all the curves.

Remarks
This function call DeleteCurve() wxECD_CURVEMAX times.
void wxEcPlot::Reset ( )
inline

Resets the component, but colours are not affected. All the curves will be deleted.

void wxEcPlot::SetAxis ( wxEcAxis  axis,
bool  forX = true 
)
inline

Applies a new configuration to the designed axis.

Parameters
axisThe new definition.
forXIf true, X-axis will be modified, else it will be the Y-axis.
bool wxEcPlot::SetBackgroundColour ( const wxColour &  value)
inline

Sets the colour of the background.

bool wxEcPlot::SetCurve ( int  index,
wxEcCurve curve 
)
inline

Sets a new curve at the given index.

Parameters
indexThe position to edit.
curveThe pointer to the new curve.
void wxEcPlot::SetDefaultGrid ( )
inline

Resets the grid.

void wxEcPlot::SetFlatBorder ( bool  value)
inline

Sets a solid border to the control, or not.

void wxEcPlot::SetGridColour ( wxColour  value)
inline

Sets the colour of the grid

void wxEcPlot::SetGridPolar ( bool  value)
inline

Defines a polar mode (true) or a cartesian mode (false)

void wxEcPlot::SetGridVisible ( bool  value)
inline

Sets the visibility of the grid

void wxEcPlot::SetReticule ( double  x,
double  y 
)
inline

Sets the position of the reticule, relative to the axis.

Parameters
xThe X-coordinate.
yThe Y-coordinate.
void wxEcPlot::SetReticuleColour ( wxColour  value)
inline

Sets the colour of the grid.

void wxEcPlot::SetReticuleVisible ( bool  value)
inline

Sets the visibility of the reticule.

void wxEcPlot::SetUnit ( double  perpixel,
bool  forX 
)

Sets the unit per pixel.

Parameters
perpixelThe value per pixel (can be retrieved from XPerPixel() and YPerPixel())
forXIf true, X-axis will be modified, else it will be the Y-axis.
Remarks
If the control is resized, this function will not be recalled.
bool wxEcPlot::SetZoomFactor ( double  value = wxECD_ZOOMFACTOR)
inline

Changes the zoom factor. The default value is wxECD_ZOOMFACTOR defined in ec_defs.h

Returns
true on success, false if the factor is not correct.
void wxEcPlot::Unzoom ( )
inline

Zooms out.

See also
SetZoomFactor()
int wxEcPlot::ValueToX ( double  value)

Converts a value using the system of coordinates of the control, relative to X.

Remarks
The result can be outer than the physical limits.
int wxEcPlot::ValueToY ( double  value)

Converts a value using the system of coordinates of the control, relative to Y.

Remarks
The result can be outer than the physical limits.
double wxEcPlot::XPerPixel ( )

Gives the interval represented by 1 pixel on the X-axis.

double wxEcPlot::XToValue ( int  X)

Converts a physical coordinate into the corresponding value, relative to the X-axis.

double wxEcPlot::YPerPixel ( )

Gives the interval represented by 1 pixel on the Y-axis.

double wxEcPlot::YToValue ( int  Y)

Converts a physical coordinate into the corresponding value, relative to the Y-axis.

void wxEcPlot::Zoom ( )
inline

Zooms in.

See also
SetZoomFactor()

The documentation for this class was generated from the following files:



Documentation generated with Doxygen 1.8.10
Hosted on :
Get wxEcMath at SourceForge.net