KiCad PCB EDA Suite
Loading...
Searching...
No Matches
mpScaleX Class Reference

#include <mathplot.h>

Inheritance diagram for mpScaleX:
mpScaleXBase mpScaleBase mpLayer

Public Member Functions

 mpScaleX (const wxString &name=wxT("X"), int flags=mpALIGN_CENTER, bool ticks=true, unsigned int type=mpX_NORMAL)
 Full constructor. More...
 
virtual double TransformToPlot (double x) const override
 Layer plot handler. More...
 
virtual double TransformFromPlot (double xplot) const override
 
virtual bool IsHorizontal () const override
 
virtual void Plot (wxDC &dc, mpWindow &w) override
 Layer plot handler. More...
 
virtual void getVisibleDataRange (mpWindow &w, double &minV, double &maxV) override
 
bool HasBBox () const override
 Check whether this layer has a bounding box. More...
 
void SetAlign (int align)
 Set X axis alignment. More...
 
void SetNameAlign (int align)
 
void SetTicks (bool enable)
 Set X axis ticks or grid. More...
 
bool GetTicks () const
 Get X axis ticks or grid. More...
 
void SetDataRange (double minV, double maxV)
 
void GetDataRange (double &minV, double &maxV) const
 
void ExtendDataRange (double minV, double maxV)
 
void ResetDataRange ()
 
double AbsMaxValue () const
 
double AbsVisibleMaxValue () const
 
std::vector< TickLabel > & TickLabels ()
 
virtual bool IsInfo () const
 Check whether the layer is an info box. More...
 
virtual double GetMinX () const
 Get inclusive left border of bounding box. More...
 
virtual double GetMaxX () const
 Get inclusive right border of bounding box. More...
 
virtual double GetMinY () const
 Get inclusive bottom border of bounding box. More...
 
virtual double GetMaxY () const
 Get inclusive top border of bounding box. More...
 
const wxString & GetName () const
 Get layer name. More...
 
const wxString & GetDisplayName () const
 
const wxFont & GetFont () const
 Get font set for this layer. More...
 
const wxPen & GetPen () const
 Get pen set for this layer. More...
 
void SetContinuity (bool continuity)
 Set the 'continuity' property of the layer (true:draws a continuous line, false:draws separate points). More...
 
bool GetContinuity () const
 Gets the 'continuity' property of the layer. More...
 
void ShowName (bool show)
 Shows or hides the text label with the name of the layer (default is visible). More...
 
virtual void SetName (const wxString &name)
 Set layer name. More...
 
void SetFont (wxFont &font)
 Set layer font. More...
 
void SetPen (wxPen pen)
 Set layer pen. More...
 
void SetDrawOutsideMargins (bool drawModeOutside)
 Set Draw mode: inside or outside margins. More...
 
bool GetDrawOutsideMargins ()
 Get Draw mode: inside or outside margins. More...
 
wxBitmap GetColourSquare (int side=16) const
 Get a small square bitmap filled with the colour of the pen used in the layer. More...
 
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...
 
bool IsVisible () const
 Checks whether the layer is visible or not. More...
 
void SetVisible (bool show)
 Sets layer visibility. More...
 
const wxBrush & GetBrush () const
 Get brush set for this layer. More...
 
void SetBrush (wxBrush brush)
 Set layer brush. More...
 

Protected Member Functions

virtual void recalculateTicks (wxDC &dc, mpWindow &w) override
 
void updateTickLabels (wxDC &dc, mpWindow &w)
 
void computeLabelExtents (wxDC &dc, mpWindow &w)
 
int tickCount () const
 
virtual int labelCount () const
 
virtual const wxString formatLabel (double value, int nDigits)
 
virtual void formatLabels ()
 
virtual double getTickPos (int n) const
 
virtual double getLabelPos (int n) const
 
virtual wxString getLabel (int n) const
 

Protected Attributes

std::vector< double > m_tickValues
 
std::vector< TickLabelm_tickLabels
 
double m_offset
 
double m_scale
 
double m_absVisibleMaxV
 
int m_flags
 
int m_nameFlags
 
bool m_ticks
 
double m_minV
 
double m_maxV
 
bool m_rangeSet
 
int m_maxLabelHeight
 
int m_maxLabelWidth
 
wxFont m_font
 
wxPen m_pen
 
wxBrush m_brush
 
wxString m_name
 
wxString m_displayName
 
bool m_continuous
 
bool m_showName
 
bool m_drawOutsideMargins
 
mpLayerType m_type
 
bool m_visible
 

Detailed Description

Definition at line 882 of file mathplot.h.

Constructor & Destructor Documentation

◆ mpScaleX()

mpScaleX::mpScaleX ( const wxString &  name = wxT("X"),
int  flags = mpALIGN_CENTER,
bool  ticks = true,
unsigned int  type = mpX_NORMAL 
)

Full constructor.

Parameters
nameLabel to plot by the ruler
flagsSet the position of the scale with respect to the window.
ticksSelect ticks or grid. Give true (default) for drawing axis ticks, false for drawing the grid.
typempX_NORMAL for normal labels, mpX_TIME for time axis in hours, minutes, seconds.

Definition at line 1212 of file mathplot.cpp.

Member Function Documentation

◆ AbsMaxValue()

double mpScaleBase::AbsMaxValue ( ) const
inlineinherited

Definition at line 777 of file mathplot.h.

References std::abs().

◆ AbsVisibleMaxValue()

double mpScaleBase::AbsVisibleMaxValue ( ) const
inlineinherited

Definition at line 782 of file mathplot.h.

◆ computeLabelExtents()

void mpScaleBase::computeLabelExtents ( wxDC &  dc,
mpWindow w 
)
protectedinherited

◆ ExtendDataRange()

void mpScaleBase::ExtendDataRange ( double  minV,
double  maxV 
)
inlineinherited

Definition at line 751 of file mathplot.h.

Referenced by mpFXY::UpdateScales().

◆ formatLabel()

virtual const wxString mpScaleBase::formatLabel ( double  value,
int  nDigits 
)
inlineprotectedvirtualinherited

Definition at line 823 of file mathplot.h.

◆ formatLabels()

virtual void mpScaleBase::formatLabels ( )
inlineprotectedvirtualinherited

Definition at line 824 of file mathplot.h.

Referenced by mpScaleBase::updateTickLabels().

◆ GetBrush()

const wxBrush & mpLayer::GetBrush ( ) const
inlineinherited

Get brush set for this layer.

Returns
brush.

Definition at line 315 of file mathplot.h.

◆ GetColourSquare()

wxBitmap mpLayer::GetColourSquare ( int  side = 16) const
inherited

Get a small square bitmap filled with the colour of the pen used in the layer.

Useful to create legends or similar reference to the layers.

Parameters
sideside length in pixels
Returns
a wxBitmap filled with layer's colour

Definition at line 76 of file mathplot.cpp.

References mpLayer::m_pen, and square().

◆ GetContinuity()

bool mpLayer::GetContinuity ( ) const
inlineinherited

Gets the 'continuity' property of the layer.

See also
SetContinuity

Definition at line 267 of file mathplot.h.

◆ GetDataRange()

void mpScaleBase::GetDataRange ( double &  minV,
double &  maxV 
) const
inlineinherited

◆ GetDisplayName()

const wxString & mpLayer::GetDisplayName ( ) const
inlineinherited

Definition at line 244 of file mathplot.h.

Referenced by mpInfoLegend::Plot().

◆ GetDrawOutsideMargins()

bool mpLayer::GetDrawOutsideMargins ( )
inlineinherited

Get Draw mode: inside or outside margins.

Returns
The draw mode

Definition at line 294 of file mathplot.h.

◆ GetFont()

const wxFont & mpLayer::GetFont ( ) const
inlineinherited

Get font set for this layer.

Returns
Font

Definition at line 252 of file mathplot.h.

◆ getLabel()

virtual wxString mpScaleBase::getLabel ( int  n) const
inlineprotectedvirtualinherited

Definition at line 836 of file mathplot.h.

Referenced by mpScaleBase::computeLabelExtents(), and mpScaleY::Plot().

◆ getLabelPos()

virtual double mpScaleBase::getLabelPos ( int  n) const
inlineprotectedvirtualinherited

Definition at line 831 of file mathplot.h.

Referenced by mpScaleXBase::Plot(), and mpScaleY::Plot().

◆ GetLayerType()

mpLayerType mpLayer::GetLayerType ( ) const
inlineinherited

Get layer type: a Layer can be of different types: plot lines, axis, info boxes, etc, this method returns the right value.

Returns
An integer indicating layer type

Definition at line 303 of file mathplot.h.

Referenced by mpInfoLegend::Plot().

◆ GetMaxX()

virtual double mpLayer::GetMaxX ( ) const
inlinevirtualinherited

Get inclusive right border of bounding box.

Returns
Value

Reimplemented in mpFXYVector, mpMovableObject, and mpBitmapLayer.

Definition at line 184 of file mathplot.h.

Referenced by mpFXY::UpdateScales().

◆ GetMaxY()

virtual double mpLayer::GetMaxY ( ) const
inlinevirtualinherited

Get inclusive top border of bounding box.

Returns
Value

Reimplemented in mpFXYVector, mpMovableObject, and mpBitmapLayer.

Definition at line 194 of file mathplot.h.

Referenced by mpFXY::UpdateScales().

◆ GetMinX()

virtual double mpLayer::GetMinX ( ) const
inlinevirtualinherited

Get inclusive left border of bounding box.

Returns
Value

Reimplemented in mpFXYVector, mpMovableObject, and mpBitmapLayer.

Definition at line 179 of file mathplot.h.

Referenced by mpFXY::UpdateScales().

◆ GetMinY()

virtual double mpLayer::GetMinY ( ) const
inlinevirtualinherited

Get inclusive bottom border of bounding box.

Returns
Value

Reimplemented in mpFXYVector, mpMovableObject, and mpBitmapLayer.

Definition at line 189 of file mathplot.h.

Referenced by mpFXY::UpdateScales().

◆ GetName()

const wxString & mpLayer::GetName ( ) const
inlineinherited

◆ GetPen()

const wxPen & mpLayer::GetPen ( ) const
inlineinherited

Get pen set for this layer.

Returns
Pen

Definition at line 257 of file mathplot.h.

Referenced by CURSOR::Plot(), mpInfoLegend::Plot(), and SIMULATOR_FRAME::rebuildSignalsGrid().

◆ getTickPos()

virtual double mpScaleBase::getTickPos ( int  n) const
inlineprotectedvirtualinherited

Definition at line 826 of file mathplot.h.

Referenced by mpScaleXBase::Plot(), and mpScaleY::Plot().

◆ GetTicks()

bool mpScaleBase::GetTicks ( ) const
inlineinherited

Get X axis ticks or grid.

Returns
true if plot is drawing axis ticks, false if the grid is active.

Definition at line 732 of file mathplot.h.

Referenced by SIM_PLOT_PANEL::IsGridShown().

◆ getVisibleDataRange()

void mpScaleXBase::getVisibleDataRange ( mpWindow w,
double &  minV,
double &  maxV 
)
overridevirtualinherited

◆ HasBBox()

bool mpScaleBase::HasBBox ( ) const
inlineoverridevirtualinherited

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.

Return values
trueHas bounding box
falseHas not bounding box

Reimplemented from mpLayer.

Reimplemented in mpScaleY.

Definition at line 714 of file mathplot.h.

◆ IsHorizontal()

virtual bool mpScaleXBase::IsHorizontal ( ) const
inlineoverridevirtualinherited

Implements mpScaleBase.

Definition at line 868 of file mathplot.h.

◆ IsInfo()

virtual bool mpLayer::IsInfo ( ) const
inlinevirtualinherited

Check whether the layer is an info box.

The default implementation returns false. It is overridden to true for mpInfoLayer class and its derivative. It is necessary to define mouse actions behaviour over info boxes.

Returns
whether the layer is an info boxes
See also
mpInfoLayer::IsInfo

Reimplemented in mpInfoLayer.

Definition at line 174 of file mathplot.h.

◆ IsVisible()

bool mpLayer::IsVisible ( ) const
inlineinherited

Checks whether the layer is visible or not.

Returns
true if visible

Definition at line 307 of file mathplot.h.

Referenced by mpWindow::IsLayerVisible(), SIM_PLOT_PANEL::IsLegendShown(), and mpInfoLegend::Plot().

◆ labelCount()

virtual int mpScaleBase::labelCount ( ) const
inlineprotectedvirtualinherited

◆ Plot()

◆ recalculateTicks()

void mpScaleX::recalculateTicks ( wxDC &  dc,
mpWindow w 
)
overrideprotectedvirtual

◆ ResetDataRange()

void mpScaleBase::ResetDataRange ( )
inlineinherited

Definition at line 772 of file mathplot.h.

Referenced by SIM_PLOT_PANEL::ResetScales().

◆ SetAlign()

void mpScaleBase::SetAlign ( int  align)
inlineinherited

Set X axis alignment.

Parameters
alignalignment (choose between mpALIGN_BORDER_BOTTOM, mpALIGN_BOTTOM, mpALIGN_CENTER, mpALIGN_TOP, mpALIGN_BORDER_TOP

Definition at line 720 of file mathplot.h.

◆ SetBrush()

void mpLayer::SetBrush ( wxBrush  brush)
inlineinherited

Set layer brush.

Parameters
brushbrush, will be copied to internal class member

Definition at line 319 of file mathplot.h.

◆ SetContinuity()

void mpLayer::SetContinuity ( bool  continuity)
inlineinherited

Set the 'continuity' property of the layer (true:draws a continuous line, false:draws separate points).

See also
GetContinuity

Definition at line 262 of file mathplot.h.

Referenced by TRACE::TRACE().

◆ SetDataRange()

void mpScaleBase::SetDataRange ( double  minV,
double  maxV 
)
inlineinherited

Definition at line 738 of file mathplot.h.

◆ SetDrawOutsideMargins()

void mpLayer::SetDrawOutsideMargins ( bool  drawModeOutside)
inlineinherited

Set Draw mode: inside or outside margins.

Default is outside, which allows the layer to draw up to the mpWindow border.

Parameters
drawModeOutsideThe draw mode to be set

Definition at line 290 of file mathplot.h.

Referenced by CURSOR::CURSOR(), and TRACE::TRACE().

◆ SetFont()

void mpLayer::SetFont ( wxFont &  font)
inlineinherited

Set layer font.

Parameters
fontFont, will be copied to internal class member

Definition at line 281 of file mathplot.h.

◆ SetName()

virtual void mpLayer::SetName ( const wxString &  name)
inlinevirtualinherited

Set layer name.

Parameters
nameName, will be copied to internal class member

Reimplemented in TRACE.

Definition at line 276 of file mathplot.h.

References name.

Referenced by SIM_PLOT_PANEL::prepareDCAxes(), TRACE::SetName(), and SIM_PLOT_PANEL::updateAxes().

◆ SetNameAlign()

void mpScaleBase::SetNameAlign ( int  align)
inlineinherited

Definition at line 722 of file mathplot.h.

Referenced by SIM_PLOT_PANEL::prepareDCAxes(), and SIM_PLOT_PANEL::updateAxes().

◆ SetPen()

void mpLayer::SetPen ( wxPen  pen)
inlineinherited

Set layer pen.

Parameters
penPen, will be copied to internal class member

Definition at line 286 of file mathplot.h.

Referenced by SIM_PLOT_PANEL::UpdateTraceStyle().

◆ SetTicks()

void mpScaleBase::SetTicks ( bool  enable)
inlineinherited

Set X axis ticks or grid.

Parameters
enable= true to plot axis ticks, false to plot grid.

Definition at line 727 of file mathplot.h.

Referenced by SIM_PLOT_PANEL::ShowGrid().

◆ SetVisible()

void mpLayer::SetVisible ( bool  show)
inlineinherited

Sets layer visibility.

Parameters
showvisibility bool.

Definition at line 311 of file mathplot.h.

Referenced by mpWindow::SetLayerVisible(), SIM_PLOT_PANEL::ShowLegend(), and SIM_PLOT_PANEL::SIM_PLOT_PANEL().

◆ ShowName()

void mpLayer::ShowName ( bool  show)
inlineinherited

Shows or hides the text label with the name of the layer (default is visible).

Definition at line 271 of file mathplot.h.

Referenced by TRACE::TRACE().

◆ tickCount()

int mpScaleBase::tickCount ( ) const
inlineprotectedinherited

Definition at line 813 of file mathplot.h.

Referenced by mpScaleXBase::Plot(), and mpScaleY::Plot().

◆ TickLabels()

std::vector< TickLabel > & mpScaleBase::TickLabels ( )
inlineinherited

Definition at line 802 of file mathplot.h.

◆ TransformFromPlot()

double mpScaleX::TransformFromPlot ( double  xplot) const
overridevirtual

Reimplemented from mpScaleBase.

Definition at line 2866 of file mathplot.cpp.

References mpScaleBase::m_offset, and mpScaleBase::m_scale.

◆ TransformToPlot()

double mpScaleX::TransformToPlot ( double  x) const
overridevirtual

Layer plot handler.

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

Reimplemented from mpScaleBase.

Definition at line 2860 of file mathplot.cpp.

References mpScaleBase::m_offset, and mpScaleBase::m_scale.

◆ updateTickLabels()

void mpScaleBase::updateTickLabels ( wxDC &  dc,
mpWindow w 
)
protectedinherited

Member Data Documentation

◆ m_absVisibleMaxV

double mpScaleBase::m_absVisibleMaxV
protectedinherited

◆ m_brush

wxBrush mpLayer::m_brush
protectedinherited

Definition at line 325 of file mathplot.h.

◆ m_continuous

bool mpLayer::m_continuous
protectedinherited

Definition at line 328 of file mathplot.h.

Referenced by CURSOR::Plot(), mpFXY::Plot(), and mpMovableObject::Plot().

◆ m_displayName

wxString mpLayer::m_displayName
protectedinherited

Definition at line 327 of file mathplot.h.

Referenced by TRACE::SetName().

◆ m_drawOutsideMargins

◆ m_flags

int mpScaleBase::m_flags
protectedinherited

Definition at line 846 of file mathplot.h.

Referenced by mpScaleBase::mpScaleBase(), and mpScaleXBase::Plot().

◆ m_font

◆ m_maxLabelHeight

int mpScaleBase::m_maxLabelHeight
protectedinherited

◆ m_maxLabelWidth

int mpScaleBase::m_maxLabelWidth
protectedinherited

Definition at line 852 of file mathplot.h.

Referenced by mpScaleBase::computeLabelExtents(), and mpScaleBase::mpScaleBase().

◆ m_maxV

◆ m_minV

◆ m_name

wxString mpLayer::m_name
protectedinherited

◆ m_nameFlags

int mpScaleBase::m_nameFlags
protectedinherited

Definition at line 847 of file mathplot.h.

Referenced by mpScaleBase::mpScaleBase(), mpScaleXBase::Plot(), and mpScaleY::Plot().

◆ m_offset

◆ m_pen

◆ m_rangeSet

bool mpScaleBase::m_rangeSet
protectedinherited

Definition at line 850 of file mathplot.h.

Referenced by mpScaleBase::mpScaleBase().

◆ m_scale

◆ m_showName

bool mpLayer::m_showName
protectedinherited

◆ m_tickLabels

std::vector<TickLabel> mpScaleBase::m_tickLabels
protectedinherited

◆ m_ticks

bool mpScaleBase::m_ticks
protectedinherited

Definition at line 848 of file mathplot.h.

Referenced by mpScaleBase::mpScaleBase(), and mpScaleXBase::Plot().

◆ m_tickValues

std::vector<double> mpScaleBase::m_tickValues
protectedinherited

◆ m_type

mpLayerType mpLayer::m_type
protectedinherited

Definition at line 331 of file mathplot.h.

Referenced by mpInfoLayer::mpInfoLayer().

◆ m_visible


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