MathPlot
|
This virtual class represents objects that can be moved to an arbitrary 2D location+rotation. More...
#include <mathplot.h>
Public Member Functions | |
mpMovableObject () | |
Default constructor (sets mpMovableObject location and rotation to (0,0,0)) | |
void | GetCoordinateBase (double &x, double &y, double &phi) const |
Get the current coordinate transformation. | |
void | SetCoordinateBase (double x, double y, double phi=0) |
Set the coordinate transformation (phi in radians, 0 means no rotation). | |
virtual bool | HasBBox () |
Check whether this layer has a bounding box. More... | |
virtual double | GetMinX () |
Get inclusive left border of bounding box. | |
virtual double | GetMaxX () |
Get inclusive right border of bounding box. | |
virtual double | GetMinY () |
Get inclusive bottom border of bounding box. | |
virtual double | GetMaxY () |
Get inclusive top border of bounding box. | |
![]() | |
mpFunction (mpLayerType layerType=mpLAYER_PLOT, const wxString &name=wxEmptyString, bool useY2Axis=false) | |
Full constructor. | |
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... | |
void | SetY2Axis (bool _useY2) |
Set use of second Y axis. More... | |
bool | GetY2Axis () const |
Is second Y axis selected for this layer? More... | |
![]() | |
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... | |
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) |
Pure virtual method to plot the layer. More... | |
void | TranslatePoint (double x, double y, double &out_x, double &out_y) const |
A method for 2D translation and rotation, using the current transformation stored in m_reference_x,m_reference_y,m_reference_phi. | |
void | ShapeUpdated () |
Must be called by the descendent class after updating the shape (m_shape_xs/ys), or when the transformation changes. More... | |
wxDECLARE_DYNAMIC_CLASS (mpMovableObject) | |
![]() | |
wxDECLARE_DYNAMIC_CLASS (mpFunction) | |
![]() | |
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 | |
double | m_reference_x |
The coordinates of the object (orientation "phi" is in radians). | |
double | m_reference_y |
double | m_reference_phi |
std::vector< double > | m_shape_xs |
This contains the object points, in local coordinates (to be transformed by the current transformation). | |
std::vector< double > | m_shape_ys |
std::vector< double > | m_trans_shape_xs |
The buffer for the translated & rotated points (to avoid recomputing them with each mpWindow refresh). | |
std::vector< double > | m_trans_shape_ys |
double | m_bbox_min_x |
The precomputed bounding box: More... | |
double | m_bbox_max_x |
double | m_bbox_min_y |
double | m_bbox_max_y |
![]() | |
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. | |
bool | m_UseY2Axis |
Use Y2 axis. This second axis must exist. | |
![]() | |
const mpLayerType | m_type |
Layer type mpLAYER_*. | |
mpWindow * | m_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. | |
This virtual class represents objects that can be moved to an arbitrary 2D location+rotation.
The current transformation is set through SetCoordinateBase. To ease the implementation of descendent classes, mpMovableObject will be in charge of Bounding Box computation and layer rendering, assuming that the object updates its shape in m_shape_xs & m_shape_ys. We derive from mpFunction to have symbol and continuity properties
|
protectedvirtual |
Pure virtual method to plot the layer.
Must be overridden and implemented by derived classes.
Implements MathPlot::mpLayer.
|
inlinevirtual |
Check whether this layer has a bounding box.
The default implementation returns TRUE. Override and return FALSE if your mpLayer implementation should be ignored by the calculation of the global bounding box for all layers in a mpWindow.
TRUE | Has bounding box |
FALSE | Has not bounding box |
Reimplemented from MathPlot::mpLayer.
|
protected |
Must be called by the descendent class after updating the shape (m_shape_xs/ys), or when the transformation changes.
This method updates the buffers m_trans_shape_xs/ys, and the precomputed bounding box.
|
protected |
The precomputed bounding box: