KiCad PCB EDA Suite
mpScaleBase Class Referenceabstract

Plot layer implementing a x-scale ruler. More...

#include <mathplot.h>

Inheritance diagram for mpScaleBase:
mpLayer mpScaleXBase mpScaleY mpScaleX mpScaleXLog CURRENT_SCALE GAIN_SCALE PHASE_SCALE VOLTAGE_SCALE_Y FREQUENCY_LIN_SCALE TIME_SCALE VOLTAGE_SCALE_X FREQUENCY_LOG_SCALE

Classes

struct  TickLabel
 

Public Member Functions

 mpScaleBase ()
 
virtual ~mpScaleBase ()
 
virtual bool IsHorizontal ()=0
 
bool HasBBox () 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 ()
 Get X axis ticks or grid. More...
 
void SetDataRange (double minV, double maxV)
 
void GetDataRange (double &minV, double &maxV)
 
void ExtendDataRange (double minV, double maxV)
 
void ResetDataRange ()
 
double AbsMaxValue () const
 
double AbsVisibleMaxValue () const
 
virtual double TransformToPlot (double x)
 
virtual double TransformFromPlot (double xplot)
 
std::vector< TickLabel > & TickLabels ()
 
virtual bool IsInfo ()
 Check whether the layer is an info box. 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...
 
virtual void Plot (wxDC &dc, mpWindow &w)=0
 Plot given view of layer to the given device context. More...
 
const wxString & GetName () const
 Get layer name. More...
 
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...
 
void SetName (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)
 Get a small square bitmap filled with the colour of the pen used in the layer. More...
 
mpLayerType GetLayerType ()
 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 ()
 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

void updateTickLabels (wxDC &dc, mpWindow &w)
 
void computeLabelExtents (wxDC &dc, mpWindow &w)
 
virtual void getVisibleDataRange (mpWindow &w, double &minV, double &maxV)
 
virtual void recalculateTicks (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)
 
virtual double getLabelPos (int n)
 
virtual const wxString getLabel (int n)
 

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
 
bool m_continuous
 
bool m_showName
 
bool m_drawOutsideMargins
 
mpLayerType m_type
 
bool m_visible
 

Detailed Description

Plot layer implementing a x-scale ruler.

The ruler is fixed at Y=0 in the coordinate system. A label is plotted at the bottom-right hand of the ruler. The scale numbering automatically adjusts to view and zoom factor.

Definition at line 690 of file mathplot.h.

Constructor & Destructor Documentation

◆ mpScaleBase()

mpScaleBase::mpScaleBase ( )

Definition at line 915 of file mathplot.cpp.

916 {
917  m_rangeSet = false;
919 
920  // initialize these members mainly to avoid not initialized values
921  m_offset = 0.0;
922  m_scale = 1.0;
923  m_absVisibleMaxV = 0.0;
924  m_flags = 0; // Flag for axis alignment
925  m_ticks = true; // Flag to toggle between ticks or grid
926  m_minV = 0.0;
927  m_maxV = 0.0;
928  m_maxLabelHeight = 1;
929  m_maxLabelWidth = 1;
930 }
double m_maxV
Definition: mathplot.h:833
bool m_ticks
Definition: mathplot.h:832
double m_offset
Definition: mathplot.h:828
int m_maxLabelHeight
Definition: mathplot.h:835
int m_flags
Definition: mathplot.h:830
int m_maxLabelWidth
Definition: mathplot.h:836
double m_absVisibleMaxV
Definition: mathplot.h:829
bool m_rangeSet
Definition: mathplot.h:834
double m_minV
Definition: mathplot.h:833
#define mpALIGN_BORDER_BOTTOM
Aligns X axis to bottom border.
Definition: mathplot.h:486
double m_scale
Definition: mathplot.h:828
int m_nameFlags
Definition: mathplot.h:831

References m_absVisibleMaxV, m_flags, m_maxLabelHeight, m_maxLabelWidth, m_maxV, m_minV, m_nameFlags, m_offset, m_rangeSet, m_scale, m_ticks, and mpALIGN_BORDER_BOTTOM.

◆ ~mpScaleBase()

virtual mpScaleBase::~mpScaleBase ( )
inlinevirtual

Definition at line 694 of file mathplot.h.

694 {};

Member Function Documentation

◆ AbsMaxValue()

double mpScaleBase::AbsMaxValue ( ) const
inline

Definition at line 761 of file mathplot.h.

762  {
763  return std::max( std::abs( m_maxV ), std::abs( m_minV ) );
764  }
double m_maxV
Definition: mathplot.h:833
#define abs(a)
Definition: auxiliary.h:84
double m_minV
Definition: mathplot.h:833
#define max(a, b)
Definition: auxiliary.h:86

References abs, and max.

◆ AbsVisibleMaxValue()

double mpScaleBase::AbsVisibleMaxValue ( ) const
inline

Definition at line 766 of file mathplot.h.

767  {
768  return m_absVisibleMaxV;
769  }
double m_absVisibleMaxV
Definition: mathplot.h:829

◆ computeLabelExtents()

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

Definition at line 949 of file mathplot.cpp.

950 {
951  // printf("test: %d %d %d\n", countDecimalDigits(1.0), countDecimalDigits(1.1), countDecimalDigits(1.22231));
952  m_maxLabelHeight = 0;
953  m_maxLabelWidth = 0;
954 
955  for( int n = 0; n < labelCount(); n++ )
956  {
957  int tx, ty;
958  const wxString s = getLabel( n );
959 
960  dc.GetTextExtent( s, &tx, &ty );
963  }
964 }
int m_maxLabelHeight
Definition: mathplot.h:835
int m_maxLabelWidth
Definition: mathplot.h:836
virtual const wxString getLabel(int n)
Definition: mathplot.h:820
#define max(a, b)
Definition: auxiliary.h:86
virtual int labelCount() const
Definition: mathplot.h:802

References getLabel(), labelCount(), m_maxLabelHeight, m_maxLabelWidth, and max.

Referenced by updateTickLabels().

◆ ExtendDataRange()

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

Definition at line 735 of file mathplot.h.

736  {
737  if( !m_rangeSet )
738  {
739  m_minV = minV;
740  m_maxV = maxV;
741  m_rangeSet = true;
742  }
743  else
744  {
745  m_minV = std::min( minV, m_minV );
746  m_maxV = std::max( maxV, m_maxV );
747  }
748 
749  if( m_minV == m_maxV )
750  {
751  m_minV = m_minV - 1.0;
752  m_maxV = m_maxV + 1.0;
753  }
754  }
double m_maxV
Definition: mathplot.h:833
bool m_rangeSet
Definition: mathplot.h:834
double m_minV
Definition: mathplot.h:833
#define max(a, b)
Definition: auxiliary.h:86
#define min(a, b)
Definition: auxiliary.h:85

References max, and min.

Referenced by mpFXY::UpdateScales().

◆ formatLabel()

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

Definition at line 807 of file mathplot.h.

807 { return wxT( "" ); }

◆ formatLabels()

virtual void mpScaleBase::formatLabels ( )
inlineprotectedvirtual

◆ GetBrush()

const wxBrush& mpLayer::GetBrush ( ) const
inlineinherited

Get brush set for this layer.

Returns
brush.

Definition at line 305 of file mathplot.h.

305 { return m_brush; };
wxBrush m_brush
Definition: mathplot.h:315

◆ GetColourSquare()

wxBitmap mpLayer::GetColourSquare ( int  side = 16)
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 83 of file mathplot.cpp.

84 {
85  wxBitmap square( side, side, -1 );
86  wxColour filler = m_pen.GetColour();
87  wxBrush brush( filler, wxBRUSHSTYLE_SOLID );
88  wxMemoryDC dc;
89 
90  dc.SelectObject( square );
91  dc.SetBackground( brush );
92  dc.Clear();
93  dc.SelectObject( wxNullBitmap );
94  return square;
95 }
wxPen m_pen
Definition: mathplot.h:314

References mpLayer::m_pen.

◆ GetContinuity()

bool mpLayer::GetContinuity ( ) const
inlineinherited

Gets the 'continuity' property of the layer.

See also
SetContinuity

Definition at line 257 of file mathplot.h.

257 { return m_continuous; }
bool m_continuous
Definition: mathplot.h:317

◆ GetDataRange()

void mpScaleBase::GetDataRange ( double &  minV,
double &  maxV 
)
inline

Definition at line 729 of file mathplot.h.

730  {
731  minV = m_minV;
732  maxV = m_maxV;
733  }
double m_maxV
Definition: mathplot.h:833
double m_minV
Definition: mathplot.h:833

Referenced by mpScaleX::recalculateTicks(), mpScaleXLog::recalculateTicks(), and mpScaleY::recalculateTicks().

◆ GetDrawOutsideMargins()

bool mpLayer::GetDrawOutsideMargins ( )
inlineinherited

Get Draw mode: inside or outside margins.

Returns
The draw mode

Definition at line 284 of file mathplot.h.

284 { return m_drawOutsideMargins; };
bool m_drawOutsideMargins
Definition: mathplot.h:319

◆ GetFont()

const wxFont& mpLayer::GetFont ( ) const
inlineinherited

Get font set for this layer.

Returns
Font

Definition at line 242 of file mathplot.h.

242 { return m_font; }
wxFont m_font
Definition: mathplot.h:309

◆ getLabel()

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

Definition at line 820 of file mathplot.h.

821  {
822  return m_tickLabels[n].label;
823  }
std::vector< TickLabel > m_tickLabels
Definition: mathplot.h:826

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

◆ getLabelPos()

virtual double mpScaleBase::getLabelPos ( int  n)
inlineprotectedvirtual

Definition at line 815 of file mathplot.h.

816  {
817  return m_tickLabels[n].pos;
818  }
std::vector< TickLabel > m_tickLabels
Definition: mathplot.h:826

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

◆ GetLayerType()

mpLayerType mpLayer::GetLayerType ( )
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 293 of file mathplot.h.

293 { return m_type; };
mpLayerType m_type
Definition: mathplot.h:320

Referenced by mpInfoLegend::Plot().

◆ GetMaxX()

virtual double mpLayer::GetMaxX ( )
inlinevirtualinherited

Get inclusive right border of bounding box.

Returns
Value

Reimplemented in mpBitmapLayer, mpMovableObject, and mpFXYVector.

Definition at line 179 of file mathplot.h.

179 { return 1.0; }

Referenced by mpWindow::UpdateBBox(), and mpFXY::UpdateScales().

◆ GetMaxY()

virtual double mpLayer::GetMaxY ( )
inlinevirtualinherited

Get inclusive top border of bounding box.

Returns
Value

Reimplemented in mpBitmapLayer, mpMovableObject, and mpFXYVector.

Definition at line 189 of file mathplot.h.

189 { return 1.0; }

Referenced by mpWindow::UpdateBBox(), and mpFXY::UpdateScales().

◆ GetMinX()

virtual double mpLayer::GetMinX ( )
inlinevirtualinherited

Get inclusive left border of bounding box.

Returns
Value

Reimplemented in mpBitmapLayer, mpMovableObject, and mpFXYVector.

Definition at line 174 of file mathplot.h.

174 { return -1.0; }

Referenced by mpWindow::UpdateBBox(), and mpFXY::UpdateScales().

◆ GetMinY()

virtual double mpLayer::GetMinY ( )
inlinevirtualinherited

Get inclusive bottom border of bounding box.

Returns
Value

Reimplemented in mpBitmapLayer, mpMovableObject, and mpFXYVector.

Definition at line 184 of file mathplot.h.

184 { return -1.0; }

Referenced by mpWindow::UpdateBBox(), and mpFXY::UpdateScales().

◆ GetName()

const wxString& mpLayer::GetName ( void  ) const
inlineinherited

Get layer name.

Returns
Name

Definition at line 237 of file mathplot.h.

237 { return m_name; }
wxString m_name
Definition: mathplot.h:316

Referenced by SIM_PLOT_PANEL::GetLabelX(), SIM_PLOT_PANEL::GetLabelY1(), SIM_PLOT_PANEL::GetLabelY2(), mpInfoLegend::Plot(), and mpText::Plot().

◆ GetPen()

const wxPen& mpLayer::GetPen ( ) const
inlineinherited

Get pen set for this layer.

Returns
Pen

Definition at line 247 of file mathplot.h.

247 { return m_pen; }
wxPen m_pen
Definition: mathplot.h:314

Referenced by mpInfoLegend::Plot().

◆ getTickPos()

virtual double mpScaleBase::getTickPos ( int  n)
inlineprotectedvirtual

Definition at line 810 of file mathplot.h.

811  {
812  return m_tickValues[n];
813  }
std::vector< double > m_tickValues
Definition: mathplot.h:825

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

◆ GetTicks()

bool mpScaleBase::GetTicks ( )
inline

Get X axis ticks or grid.

Returns
TRUE if plot is drawing axis ticks, FALSE if the grid is active.

Definition at line 716 of file mathplot.h.

716 { return m_ticks; };
bool m_ticks
Definition: mathplot.h:832

Referenced by SIM_PLOT_PANEL::IsGridShown().

◆ getVisibleDataRange()

virtual void mpScaleBase::getVisibleDataRange ( mpWindow w,
double &  minV,
double &  maxV 
)
inlineprotectedvirtual

Reimplemented in mpScaleY, and mpScaleXBase.

Definition at line 794 of file mathplot.h.

794 {};

◆ HasBBox()

bool mpScaleBase::HasBBox ( )
inlineoverridevirtual

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 698 of file mathplot.h.

698 { return FALSE; }

◆ IsHorizontal()

virtual bool mpScaleBase::IsHorizontal ( )
pure virtual

Implemented in mpScaleY, and mpScaleXBase.

◆ IsInfo()

virtual bool mpLayer::IsInfo ( )
inlinevirtualinherited

Check whether the layer is an info box.

The default implementation returns FALSE. It is overrided 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 169 of file mathplot.h.

169 { return false; };

◆ IsVisible()

bool mpLayer::IsVisible ( )
inlineinherited

Checks whether the layer is visible or not.

Returns
true if visible

Definition at line 297 of file mathplot.h.

297 { return m_visible; };
bool m_visible
Definition: mathplot.h:321

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

◆ labelCount()

virtual int mpScaleBase::labelCount ( ) const
inlineprotectedvirtual

Definition at line 802 of file mathplot.h.

803  {
804  return m_tickLabels.size();
805  }
std::vector< TickLabel > m_tickLabels
Definition: mathplot.h:826

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

◆ Plot()

virtual void mpLayer::Plot ( wxDC &  dc,
mpWindow w 
)
pure virtualinherited

Plot given view of layer to the given device context.

An implementation of this function has to transform layer coordinates to wxDC coordinates based on the view parameters retrievable from the mpWindow passed in w. Note that the public methods of mpWindow: x2p,y2p and p2x,p2y are already provided which transform layer coordinates to DC pixel coordinates, and user code should rely on them for portability and future changes to be applied transparently, instead of implementing the following formulas manually.

The passed device context dc has its coordinate origin set to the top-left corner of the visible area (the default). The coordinate orientation is as shown in the following picture:

(wxDC origin 0,0)
x-------------> ascending X ----------------+
|                                           |
|                                           |
|  V ascending Y                            |
|                                           |
|                                           |
|                                           |
|+------------------------------------------+  <-- right-bottom corner of the mpWindow visible area.

Note that Y ascends in downward direction, whereas the usual vertical orientation for mathematical plots is vice versa. Thus Y-orientation will be swapped usually, when transforming between wxDC and mpLayer coordinates. This change of coordinates is taken into account in the methods p2x,p2y,x2p,y2p.

Rules for transformation between mpLayer and wxDC coordinates

dc_X = (layer_X - mpWindow::GetPosX()) * mpWindow::GetScaleX()
dc_Y = (mpWindow::GetPosY() - layer_Y) * mpWindow::GetScaleY() // swapping Y-orientation
layer_X = (dc_X / mpWindow::GetScaleX()) + mpWindow::GetPosX() // scale guaranteed to be not 0
layer_Y = mpWindow::GetPosY() - (dc_Y / mpWindow::GetScaleY()) // swapping Y-orientation
Parameters
dcDevice context to plot to.
wView to plot. The visible area can be retrieved from this object.
See also
mpWindow::p2x,mpWindow::p2y,mpWindow::x2p,mpWindow::y2p

Implemented in mpBitmapLayer, mpMovableObject, mpText, mpScaleY, mpScaleXBase, mpProfile, mpFXY, mpFY, mpFX, mpInfoLegend, mpInfoCoords, mpInfoLayer, and CURSOR.

Referenced by mpPrintout::OnPrintPage().

◆ recalculateTicks()

virtual void mpScaleBase::recalculateTicks ( wxDC &  dc,
mpWindow w 
)
inlineprotectedvirtual

Reimplemented in mpScaleY, mpScaleXLog, and mpScaleX.

Definition at line 795 of file mathplot.h.

795 {};

Referenced by mpScaleXBase::Plot().

◆ ResetDataRange()

void mpScaleBase::ResetDataRange ( )
inline

Definition at line 756 of file mathplot.h.

757  {
758  m_rangeSet = 0;
759  }
bool m_rangeSet
Definition: mathplot.h:834

Referenced by SIM_PLOT_PANEL::ResetScales().

◆ SetAlign()

void mpScaleBase::SetAlign ( int  align)
inline

Set X axis alignment.

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

Definition at line 704 of file mathplot.h.

704 { m_flags = align; };
int m_flags
Definition: mathplot.h:830

◆ SetBrush()

void mpLayer::SetBrush ( wxBrush  brush)
inlineinherited

Set layer brush.

Parameters
brushbrush, will be copied to internal class member

Definition at line 309 of file mathplot.h.

309 { m_brush = brush; };
wxBrush m_brush
Definition: mathplot.h:315

◆ 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 252 of file mathplot.h.

252 { m_continuous = continuity; }
bool m_continuous
Definition: mathplot.h:317

Referenced by TRACE::TRACE().

◆ SetDataRange()

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

Definition at line 722 of file mathplot.h.

723  {
724  m_rangeSet = true;
725  m_minV = minV;
726  m_maxV = maxV;
727  }
double m_maxV
Definition: mathplot.h:833
bool m_rangeSet
Definition: mathplot.h:834
double m_minV
Definition: mathplot.h:833

◆ 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 280 of file mathplot.h.

280 { m_drawOutsideMargins = drawModeOutside; };
bool m_drawOutsideMargins
Definition: mathplot.h:319

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 271 of file mathplot.h.

271 { m_font = font; }
wxFont m_font
Definition: mathplot.h:309

◆ SetName()

void mpLayer::SetName ( wxString  name)
inlineinherited

Set layer name.

Parameters
nameName, will be copied to internal class member

Definition at line 266 of file mathplot.h.

266 { m_name = name; }
const char * name
Definition: DXF_plotter.cpp:61
wxString m_name
Definition: mathplot.h:316

References name.

◆ SetNameAlign()

void mpScaleBase::SetNameAlign ( int  align)
inline

Definition at line 706 of file mathplot.h.

706 { m_nameFlags = align; }
int m_nameFlags
Definition: mathplot.h:831

Referenced by SIM_PLOT_PANEL::SIM_PLOT_PANEL().

◆ SetPen()

void mpLayer::SetPen ( wxPen  pen)
inlineinherited

Set layer pen.

Parameters
penPen, will be copied to internal class member

Definition at line 276 of file mathplot.h.

276 { m_pen = pen; }
wxPen m_pen
Definition: mathplot.h:314

Referenced by SIM_PLOT_PANEL::AddTrace().

◆ SetTicks()

void mpScaleBase::SetTicks ( bool  enable)
inline

Set X axis ticks or grid.

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

Definition at line 711 of file mathplot.h.

711 { m_ticks = enable; };
bool m_ticks
Definition: mathplot.h:832

Referenced by SIM_PLOT_PANEL::ShowGrid(), and SIM_PLOT_PANEL::SIM_PLOT_PANEL().

◆ SetVisible()

void mpLayer::SetVisible ( bool  show)
inlineinherited

Sets layer visibility.

Parameters
showvisibility bool.

Definition at line 301 of file mathplot.h.

301 { m_visible = show; };
bool m_visible
Definition: mathplot.h:321

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 261 of file mathplot.h.

261 { m_showName = show; };
bool m_showName
Definition: mathplot.h:318

Referenced by TRACE::TRACE().

◆ tickCount()

int mpScaleBase::tickCount ( ) const
inlineprotected

Definition at line 797 of file mathplot.h.

798  {
799  return m_tickValues.size();
800  }
std::vector< double > m_tickValues
Definition: mathplot.h:825

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

◆ TickLabels()

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

Definition at line 786 of file mathplot.h.

786 { return m_tickLabels; };
std::vector< TickLabel > m_tickLabels
Definition: mathplot.h:826

Referenced by FREQUENCY_LOG_SCALE::formatLabels().

◆ TransformFromPlot()

virtual double mpScaleBase::TransformFromPlot ( double  xplot)
inlinevirtual

Reimplemented in mpScaleY, mpScaleXLog, and mpScaleX.

Definition at line 772 of file mathplot.h.

772 { return 0.0; };

Referenced by mpScaleXBase::getVisibleDataRange(), mpFXY::s2x(), and mpFXY::s2y().

◆ TransformToPlot()

virtual double mpScaleBase::TransformToPlot ( double  x)
inlinevirtual

Reimplemented in mpScaleY, mpScaleXLog, and mpScaleX.

Definition at line 771 of file mathplot.h.

771 { return 0.0; };

Referenced by mpFXY::Plot(), mpScaleXBase::Plot(), mpFXY::x2s(), and mpFXY::y2s().

◆ updateTickLabels()

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

Definition at line 967 of file mathplot.cpp.

968 {
969  formatLabels();
970  computeLabelExtents( dc, w );
971 
972  // int gap = IsHorizontal() ? m_maxLabelWidth + 10 : m_maxLabelHeight + 5;
973 
974  // if ( m_tickLabels.size() <= 2)
975  // return;
976 
977  /*
978  * fixme!
979  *
980  * for ( auto &l : m_tickLabels )
981  * {
982  * double p = TransformToPlot ( l.pos );
983  *
984  * if ( !IsHorizontal() )
985  * l.pixelPos = (int)(( w.GetPosY() - p ) * w.GetScaleY());
986  * else
987  * l.pixelPos = (int)(( p - w.GetPosX()) * w.GetScaleX());
988  * }
989  *
990  *
991  * for (int i = 1; i < m_tickLabels.size() - 1; i++)
992  * {
993  * int dist_prev;
994  *
995  * for(int j = i-1; j >= 1; j--)
996  * {
997  * if( m_tickLabels[j].visible)
998  * {
999  * dist_prev = abs( m_tickLabels[j].pixelPos - m_tickLabels[i].pixelPos );
1000  * break;
1001  * }
1002  * }
1003  *
1004  * if (dist_prev < gap)
1005  * m_tickLabels[i].visible = false;
1006  * }
1007  */
1008 }
void computeLabelExtents(wxDC &dc, mpWindow &w)
Definition: mathplot.cpp:949
virtual void formatLabels()
Definition: mathplot.h:808

References computeLabelExtents(), and formatLabels().

Referenced by mpScaleX::recalculateTicks(), mpScaleXLog::recalculateTicks(), and mpScaleY::recalculateTicks().

Member Data Documentation

◆ m_absVisibleMaxV

double mpScaleBase::m_absVisibleMaxV
protected

◆ m_brush

wxBrush mpLayer::m_brush
protectedinherited

Definition at line 315 of file mathplot.h.

◆ m_continuous

bool mpLayer::m_continuous
protectedinherited

Definition at line 317 of file mathplot.h.

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

◆ m_drawOutsideMargins

◆ m_flags

int mpScaleBase::m_flags
protected

Definition at line 830 of file mathplot.h.

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

◆ m_font

◆ m_maxLabelHeight

int mpScaleBase::m_maxLabelHeight
protected

Definition at line 835 of file mathplot.h.

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

◆ m_maxLabelWidth

int mpScaleBase::m_maxLabelWidth
protected

Definition at line 836 of file mathplot.h.

Referenced by computeLabelExtents(), and mpScaleBase().

◆ m_maxV

◆ m_minV

◆ m_name

wxString mpLayer::m_name
protectedinherited

◆ m_nameFlags

int mpScaleBase::m_nameFlags
protected

Definition at line 831 of file mathplot.h.

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

◆ m_offset

◆ m_pen

◆ m_rangeSet

bool mpScaleBase::m_rangeSet
protected

Definition at line 834 of file mathplot.h.

Referenced by mpScaleBase().

◆ m_scale

◆ m_showName

bool mpLayer::m_showName
protectedinherited

◆ m_tickLabels

◆ m_ticks

bool mpScaleBase::m_ticks
protected

Definition at line 832 of file mathplot.h.

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

◆ m_tickValues

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

◆ m_type

mpLayerType mpLayer::m_type
protectedinherited

Definition at line 320 of file mathplot.h.

Referenced by mpInfoLayer::mpInfoLayer().

◆ m_visible


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