wxEcMath - Official documentation
0.6.4
|
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) |
wxEcCurve * | GetCurve (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) |
wxEcAxis * | GetAxis (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) |
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.
wxEcPlot::wxEcPlot | ( | wxWindow * | parent, |
wxWindowID | id = wxID_ANY , |
||
const wxPoint & | pos = wxDefaultPosition , |
||
const wxSize & | size = wxDefaultSize , |
||
long | style = 0 |
||
) |
The default constructor.
parent | The parent of the component. Can be a wxFrame, a wxDialog, a wxPanel... |
id | The unique identifier. |
pos | The default position. |
size | The default size. |
style | The style (see wxWindow). |
wxEcPlot::~wxEcPlot | ( | ) |
The default destructor.
|
inline |
Adds a new curve.
curve | An object defining the curve to add. |
|
inline |
Adds a new curve.
curve | Pointer to an object defining the curve to add. |
|
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()).
X | The X-coordinate. |
Y | The Y-coordinate. |
|
inline |
Removes the curve specified by its identifier.
index | The 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.
index | The identifier of the curve (obtained with AddCurve()). |
bool wxEcPlot::DrawTangent | ( | int | index, |
double | position | ||
) |
Draws a temporary tangent.
index | The identifier of the curve (obtained with AddCurve()). |
position | The X-coordinate where the tangent shall be drawn. |
|
inline |
Enables or disables the curve specified by its identifier.
index | The identifier of the curve (obtained with AddCurve()). |
state | true to enable, false to disable. |
|
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().
|
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.
|
inline |
Gives a pointer to the axis currently used for X or Y.
forX | true returns for X, false returns for Y |
|
inline |
Gets the colour of the background.
|
inline |
Returns a curve.
index | The identifier of the curve (obtained with AddCurve()). |
|
inline |
Indicates if the control have a black border.
|
inline |
Gets the colour of the grid.
|
inline |
Returns true if the grid is polar.
|
inline |
Returns the visibility of the grid
|
inline |
Returns the equation you obtained at the last call of DrawTangent().
|
inline |
Gets the colour of the reticule.
|
inline |
Gets the visibility of the reticule.
|
inline |
Returns the maximal value of Y found during the last refresh.
|
inline |
Returns the minimal value of Y found during the last refresh.
|
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.
X | The X-coordinate. |
Y | The Y-coordinate. |
|
inline |
Locks or unlocks the automatic refresh.
state | true 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.
|
inline |
This function solves YPerPixel()=XPerPixel(). The grid will look like squares and right angles are possible.
symetrical | If false, Ymax will be adjusted. If true, Ymax and Ymin will be edited, and Ymin = -Ymin. |
|
inline |
Refresh only works when your component is visible. With this method, you can force the redraw even if your component is not visible.
|
inline |
Deletes all the curves.
|
inline |
Resets the component, but colours are not affected. All the curves will be deleted.
|
inline |
Applies a new configuration to the designed axis.
axis | The new definition. |
forX | If true, X-axis will be modified, else it will be the Y-axis. |
|
inline |
Sets the colour of the background.
|
inline |
Sets a new curve at the given index.
index | The position to edit. |
curve | The pointer to the new curve. |
|
inline |
Resets the grid.
|
inline |
Sets a solid border to the control, or not.
|
inline |
Sets the colour of the grid
|
inline |
Defines a polar mode (true) or a cartesian mode (false)
|
inline |
Sets the visibility of the grid
|
inline |
Sets the position of the reticule, relative to the axis.
x | The X-coordinate. |
y | The Y-coordinate. |
|
inline |
Sets the colour of the grid.
|
inline |
Sets the visibility of the reticule.
void wxEcPlot::SetUnit | ( | double | perpixel, |
bool | forX | ||
) |
Sets the unit per pixel.
perpixel | The value per pixel (can be retrieved from XPerPixel() and YPerPixel()) |
forX | If true, X-axis will be modified, else it will be the Y-axis. |
|
inline |
Changes the zoom factor. The default value is wxECD_ZOOMFACTOR defined in ec_defs.h
|
inline |
Zooms out.
int wxEcPlot::ValueToX | ( | double | value | ) |
Converts a value using the system of coordinates of the control, relative to X.
int wxEcPlot::ValueToY | ( | double | value | ) |
Converts a value using the system of coordinates of the control, relative to Y.
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.
|
inline |
Zooms in.