MathPlot
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
MathPlot::mpInfoLayer Class Reference

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. More...

#include <mathplot.h>

Inheritance diagram for MathPlot::mpInfoLayer:
Inheritance graph
[legend]
Collaboration diagram for MathPlot::mpInfoLayer:
Collaboration graph
[legend]

Public Member Functions

 mpInfoLayer ()
 Default constructor. More...
 
 mpInfoLayer (wxRect rect, const wxBrush &brush= *wxTRANSPARENT_BRUSH, mpLocation location=mpMarginNone)
 Complete constructor. More...
 
virtual ~mpInfoLayer ()
 Destructor.
 
virtual void SetVisible (bool show)
 Sets layer visibility. More...
 
virtual void UpdateInfo (mpWindow &w, wxEvent &event)
 Updates the content of the info box. More...
 
virtual bool HasBBox ()
 mpInfoLayer has not bounding box. More...
 
virtual void ErasePlot (wxDC &dc, mpWindow &w)
 Just delete the bitmap of the info.
 
virtual bool Inside (const wxPoint &point)
 Checks whether a point is inside the info box rectangle. More...
 
virtual void Move (wxPoint delta)
 Moves the layer rectangle of given pixel deltas. More...
 
virtual void UpdateReference ()
 Updates the rectangle reference point. More...
 
wxPoint GetPosition () const
 Returns the position of the upper left corner of the box (in pixels) More...
 
wxSize GetSize () const
 Returns the size of the box (in pixels) More...
 
const wxRect & GetRectangle () const
 Returns the current rectangle coordinates. More...
 
void SetLocation (mpLocation location)
 Set the location of the mpInfoLayer box.
 
mpLocation GetLocation () const
 Return the location of the mpInfoLayer box. More...
 
- Public Member Functions inherited from MathPlot::mpLayer
 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...
 
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...
 
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)
 Plot method. More...
 
void SetInfoRectangle (mpWindow &w, int width=0, int height=0)
 Compute the dimensions and position of the mpInfoLayer rectangle.
 
 wxDECLARE_DYNAMIC_CLASS (mpInfoLayer)
 
- Protected Member Functions inherited from MathPlot::mpLayer
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

wxRect m_dim
 The bounding rectangle of the mpInfoLayer box (may be resized dynamically by the Plot method).
 
wxRect m_oldDim
 Keep the old values of m_dim.
 
wxBitmap * m_info_bmp
 The bitmap that contain the info.
 
wxPoint m_reference
 Holds the reference point for movements.
 
int m_winX
 
int m_winY
 Holds the mpWindow size. Used to rescale position when window is resized.
 
mpLocation m_location
 Location of the box in the margin. Default mpMarginNone = use coordinates.
 
- Protected Attributes inherited from MathPlot::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_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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ mpInfoLayer() [1/2]

mpInfoLayer::mpInfoLayer ( )

Default constructor.

◆ mpInfoLayer() [2/2]

mpInfoLayer::mpInfoLayer ( wxRect  rect,
const wxBrush &  brush = *wxTRANSPARENT_BRUSH,
mpLocation  location = mpMarginNone 
)

Complete constructor.

Parameters
rectSets the initial size rectangle of the layer.
brushpointer to a fill brush. Default is transparent
locationto place in the margin or free

Member Function Documentation

◆ DoPlot()

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

Plot method.

Can be overridden by derived classes.

Parameters
dcthe device content where to plot
wthe window to plot
See also
mpLayer::Plot

Implements MathPlot::mpLayer.

Reimplemented in MathPlot::mpInfoLegend, and MathPlot::mpInfoCoords.

◆ GetLocation()

mpLocation MathPlot::mpInfoLayer::GetLocation ( ) const
inline

Return the location of the mpInfoLayer box.

Returns
location

◆ GetPosition()

wxPoint MathPlot::mpInfoLayer::GetPosition ( ) const
inline

Returns the position of the upper left corner of the box (in pixels)

Returns
The rectangle position

◆ GetRectangle()

const wxRect& MathPlot::mpInfoLayer::GetRectangle ( ) const
inline

Returns the current rectangle coordinates.

Returns
The info layer rectangle

◆ GetSize()

wxSize MathPlot::mpInfoLayer::GetSize ( ) const
inline

Returns the size of the box (in pixels)

Returns
The rectangle size

◆ HasBBox()

virtual bool MathPlot::mpInfoLayer::HasBBox ( )
inlinevirtual

mpInfoLayer has not bounding box.

See also
mpLayer::HasBBox
Returns
always FALSE

Reimplemented from MathPlot::mpLayer.

◆ Inside()

bool mpInfoLayer::Inside ( const wxPoint &  point)
virtual

Checks whether a point is inside the info box rectangle.

Parameters
pointThe point to be checked
Returns
true if the point is inside the bounding box

◆ Move()

void mpInfoLayer::Move ( wxPoint  delta)
virtual

Moves the layer rectangle of given pixel deltas.

Parameters
deltaThe wxPoint container for delta coordinates along x and y. Units are in pixels.

◆ SetVisible()

void mpInfoLayer::SetVisible ( bool  show)
virtual

Sets layer visibility.

Parameters
showvisibility bool.

Reimplemented from MathPlot::mpLayer.

◆ UpdateInfo()

void mpInfoLayer::UpdateInfo ( mpWindow w,
wxEvent &  event 
)
virtual

Updates the content of the info box.

Should be overridden by derived classes. Update may behave in different ways according to the type of event which called it.

Parameters
wparent mpWindow from which to obtain informations
eventThe event which called the update.

Reimplemented in MathPlot::mpInfoCoords.

◆ UpdateReference()

void mpInfoLayer::UpdateReference ( )
virtual

Updates the rectangle reference point.

Used by internal methods of mpWindow to correctly move mpInfoLayers.