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

Plot layer implementing a text string. More...

#include <mathplot.h>

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

Public Member Functions

 mpText (const wxString &name=wxEmptyString)
 Default constructor.
 
 mpText (const wxString &name, int offsetx, int offsety)
 
 mpText (const wxString &name, mpLocation marginLocation)
 
virtual bool HasBBox ()
 Text Layer has not bounding box. More...
 
void SetLocation (mpLocation location)
 Set the location of the box.
 
mpLocation GetLocation () const
 Returns the location of the box. More...
 
void SetOffset (int offX, int offY)
 Set offset.
 
void GetOffset (int *offX, int *offY) const
 Get the offset. 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...
 
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)
 Text Layer plot handler. More...
 
 wxDECLARE_DYNAMIC_CLASS (mpText)
 
- 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

int m_offsetx
 Holds offset for X in percentage.
 
int m_offsety
 Holds offset for Y in percentage.
 
mpLocation m_location
 
- 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

Plot layer implementing a text string.

The text is plotted in two ways : first : 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. second : center of a margin

Constructor & Destructor Documentation

◆ mpText() [1/2]

mpText::mpText ( const wxString &  name,
int  offsetx,
int  offsety 
)
Parameters
nametext to be drawn in the plot
offsetxholds offset for the X location in percentage (0-100)
offsetyholds offset for the Y location in percentage (0-100)
nametext to be displayed
offsetxx position in percentage (0-100)
offsetxy position in percentage (0-100)

◆ mpText() [2/2]

mpText::mpText ( const wxString &  name,
mpLocation  marginLocation 
)
Parameters
nametext to be displayed
locationin the margin

Member Function Documentation

◆ DoPlot()

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

Text Layer plot handler.

mpText Layer plot handler.

This implementation will plot text adjusted to the visible area.

This implementation will plot the text adjusted to the visible area.

Implements MathPlot::mpLayer.

◆ GetLocation()

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

Returns the location of the box.

Returns
location

◆ GetOffset()

void MathPlot::mpText::GetOffset ( int *  offX,
int *  offY 
) const
inline

Get the offset.

Returns
void

◆ HasBBox()

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

Text Layer has not bounding box.

See also
mpLayer::HasBBox
Returns
always FALSE

Reimplemented from MathPlot::mpLayer.