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 ( )

Definition at line 926 of file mathplot.cpp.

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.

927 {
928  m_rangeSet = false;
930 
931  // initialize these members mainly to avoid not initialized values
932  m_offset = 0.0;
933  m_scale = 1.0;
934  m_absVisibleMaxV = 0.0;
935  m_flags = 0; // Flag for axis alignment
936  m_ticks = true; // Flag to toggle between ticks or grid
937  m_minV = 0.0;
938  m_maxV = 0.0;
939  m_maxLabelHeight = 1;
940  m_maxLabelWidth = 1;
941 }
double m_maxV
Definition: mathplot.h:829
bool m_ticks
Definition: mathplot.h:828
double m_offset
Definition: mathplot.h:824
int m_maxLabelHeight
Definition: mathplot.h:831
int m_flags
Definition: mathplot.h:826
int m_maxLabelWidth
Definition: mathplot.h:832
double m_absVisibleMaxV
Definition: mathplot.h:825
bool m_rangeSet
Definition: mathplot.h:830
double m_minV
Definition: mathplot.h:829
#define mpALIGN_BORDER_BOTTOM
Aligns X axis to bottom border.
Definition: mathplot.h:486
double m_scale
Definition: mathplot.h:824
int m_nameFlags
Definition: mathplot.h:827
virtual mpScaleBase::~mpScaleBase ( )
inlinevirtual

Definition at line 694 of file mathplot.h.

694 {};

Member Function Documentation

double mpScaleBase::AbsMaxValue ( ) const
inline

Definition at line 757 of file mathplot.h.

References abs, and max.

758  {
759  return std::max( std::abs( m_maxV ), std::abs( m_minV ) );
760  }
double m_maxV
Definition: mathplot.h:829
#define abs(a)
Definition: auxiliary.h:84
double m_minV
Definition: mathplot.h:829
#define max(a, b)
Definition: auxiliary.h:86
double mpScaleBase::AbsVisibleMaxValue ( ) const
inline

Definition at line 762 of file mathplot.h.

Referenced by formatSILabels().

763  {
764  return m_absVisibleMaxV;
765  }
double m_absVisibleMaxV
Definition: mathplot.h:825
void mpScaleBase::computeLabelExtents ( wxDC &  dc,
mpWindow w 
)
protected

Definition at line 960 of file mathplot.cpp.

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

Referenced by updateTickLabels().

961 {
962  // printf("test: %d %d %d\n", countDecimalDigits(1.0), countDecimalDigits(1.1), countDecimalDigits(1.22231));
963  m_maxLabelHeight = 0;
964  m_maxLabelWidth = 0;
965 
966  for( int n = 0; n < labelCount(); n++ )
967  {
968  int tx, ty;
969  const wxString s = getLabel( n );
970 
971  dc.GetTextExtent( s, &tx, &ty );
974  }
975 }
int m_maxLabelHeight
Definition: mathplot.h:831
int m_maxLabelWidth
Definition: mathplot.h:832
virtual int labelCount() const
Definition: mathplot.h:798
virtual const wxString getLabel(int n)
Definition: mathplot.h:816
#define max(a, b)
Definition: auxiliary.h:86
void mpScaleBase::ExtendDataRange ( double  minV,
double  maxV 
)
inline

Definition at line 731 of file mathplot.h.

References max, and min.

Referenced by mpFXY::UpdateScales().

732  {
733  if( !m_rangeSet )
734  {
735  m_minV = minV;
736  m_maxV = maxV;
737  m_rangeSet = true;
738  }
739  else
740  {
741  m_minV = std::min( minV, m_minV );
742  m_maxV = std::max( maxV, m_maxV );
743  }
744 
745  if( m_minV == m_maxV )
746  {
747  m_minV = -1.0;
748  m_maxV = 1.0;
749  }
750  }
double m_maxV
Definition: mathplot.h:829
bool m_rangeSet
Definition: mathplot.h:830
double m_minV
Definition: mathplot.h:829
#define max(a, b)
Definition: auxiliary.h:86
#define min(a, b)
Definition: auxiliary.h:85
virtual const wxString mpScaleBase::formatLabel ( double  value,
int  nDigits 
)
inlineprotectedvirtual

Definition at line 803 of file mathplot.h.

803 { return wxT( "" ); }
virtual void mpScaleBase::formatLabels ( )
inlineprotectedvirtual
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
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 82 of file mathplot.cpp.

References mpLayer::m_pen, and square().

83 {
84  wxBitmap square( side, side, -1 );
85  wxColour filler = m_pen.GetColour();
86  wxBrush brush( filler, wxBRUSHSTYLE_SOLID );
87  wxMemoryDC dc;
88 
89  dc.SelectObject( square );
90  dc.SetBackground( brush );
91  dc.Clear();
92  dc.SelectObject( wxNullBitmap );
93  return square;
94 }
static double square(int x)
Definition: trigo.cpp:138
wxPen m_pen
Definition: mathplot.h:314
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
void mpScaleBase::GetDataRange ( double &  minV,
double &  maxV 
)
inline

Definition at line 725 of file mathplot.h.

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

726  {
727  minV = m_minV;
728  maxV = m_maxV;
729  }
double m_maxV
Definition: mathplot.h:829
double m_minV
Definition: mathplot.h:829
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
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
virtual const wxString mpScaleBase::getLabel ( int  n)
inlineprotectedvirtual

Definition at line 816 of file mathplot.h.

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

817  {
818  return m_tickLabels[n].label;
819  }
std::vector< TickLabel > m_tickLabels
Definition: mathplot.h:822
virtual double mpScaleBase::getLabelPos ( int  n)
inlineprotectedvirtual

Definition at line 811 of file mathplot.h.

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

812  {
813  return m_tickLabels[n].pos;
814  }
std::vector< TickLabel > m_tickLabels
Definition: mathplot.h:822
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.

Referenced by mpInfoLegend::Plot().

293 { return m_type; };
mpLayerType m_type
Definition: mathplot.h:320
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.

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

179 { return 1.0; }
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.

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

189 { return 1.0; }
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.

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

174 { return -1.0; }
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.

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

184 { return -1.0; }
const wxString& mpLayer::GetName ( void  ) const
inlineinherited

Get layer name.

Returns
Name

Definition at line 237 of file mathplot.h.

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

237 { return m_name; }
wxString m_name
Definition: mathplot.h:316
const wxPen& mpLayer::GetPen ( ) const
inlineinherited

Get pen set for this layer.

Returns
Pen

Definition at line 247 of file mathplot.h.

Referenced by mpInfoLegend::Plot().

247 { return m_pen; }
wxPen m_pen
Definition: mathplot.h:314
virtual double mpScaleBase::getTickPos ( int  n)
inlineprotectedvirtual

Definition at line 806 of file mathplot.h.

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

807  {
808  return m_tickValues[n];
809  }
std::vector< double > m_tickValues
Definition: mathplot.h:821
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 712 of file mathplot.h.

Referenced by SIM_PLOT_PANEL::IsGridShown().

712 { return m_ticks; };
bool m_ticks
Definition: mathplot.h:828
virtual void mpScaleBase::getVisibleDataRange ( mpWindow w,
double &  minV,
double &  maxV 
)
inlineprotectedvirtual

Reimplemented in mpScaleY, and mpScaleXBase.

Definition at line 790 of file mathplot.h.

790 {};
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; }
virtual bool mpScaleBase::IsHorizontal ( )
pure virtual

Implemented in mpScaleY, and mpScaleXBase.

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; };
bool mpLayer::IsVisible ( )
inlineinherited

Checks whether the layer is visible or not.

Returns
true if visible

Definition at line 297 of file mathplot.h.

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

297 { return m_visible; };
bool m_visible
Definition: mathplot.h:321
virtual int mpScaleBase::labelCount ( ) const
inlineprotectedvirtual

Definition at line 798 of file mathplot.h.

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

799  {
800  return m_tickLabels.size();
801  }
std::vector< TickLabel > m_tickLabels
Definition: mathplot.h:822
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().

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

Reimplemented in mpScaleY, mpScaleXLog, and mpScaleX.

Definition at line 791 of file mathplot.h.

Referenced by mpScaleXBase::Plot().

791 {};
void mpScaleBase::ResetDataRange ( )
inline

Definition at line 752 of file mathplot.h.

Referenced by SIM_PLOT_PANEL::ResetScales().

753  {
754  m_rangeSet = 0;
755  }
bool m_rangeSet
Definition: mathplot.h:830
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 702 of file mathplot.h.

702 { m_flags = align; };
int m_flags
Definition: mathplot.h:826
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
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.

Referenced by TRACE::TRACE().

252 { m_continuous = continuity; }
bool m_continuous
Definition: mathplot.h:317
void mpScaleBase::SetDataRange ( double  minV,
double  maxV 
)
inline

Definition at line 718 of file mathplot.h.

719  {
720  m_rangeSet = true;
721  m_minV = minV;
722  m_maxV = maxV;
723  }
double m_maxV
Definition: mathplot.h:829
bool m_rangeSet
Definition: mathplot.h:830
double m_minV
Definition: mathplot.h:829
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.

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

280 { m_drawOutsideMargins = drawModeOutside; };
bool m_drawOutsideMargins
Definition: mathplot.h:319
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
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; }
wxString m_name
Definition: mathplot.h:316
void mpScaleBase::SetNameAlign ( int  align)
inline

Definition at line 704 of file mathplot.h.

Referenced by SIM_PLOT_PANEL::SIM_PLOT_PANEL().

704 { m_nameFlags = align; }
int m_nameFlags
Definition: mathplot.h:827
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.

Referenced by SIM_PLOT_PANEL::AddTrace().

276 { m_pen = pen; }
wxPen m_pen
Definition: mathplot.h:314
void mpScaleBase::SetTicks ( bool  enable)
inline

Set X axis ticks or grid.

Parameters
ticksTRUE to plot axis ticks, FALSE to plot grid.

Definition at line 708 of file mathplot.h.

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

708 { m_ticks = enable; };
bool m_ticks
Definition: mathplot.h:828
void mpLayer::SetVisible ( bool  show)
inlineinherited

Sets layer visibility.

Parameters
showvisibility bool.

Definition at line 301 of file mathplot.h.

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

301 { m_visible = show; };
bool m_visible
Definition: mathplot.h:321
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.

Referenced by TRACE::TRACE().

261 { m_showName = show; };
bool m_showName
Definition: mathplot.h:318
int mpScaleBase::tickCount ( ) const
inlineprotected

Definition at line 793 of file mathplot.h.

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

794  {
795  return m_tickValues.size();
796  }
std::vector< double > m_tickValues
Definition: mathplot.h:821
std::vector<TickLabel>& mpScaleBase::TickLabels ( )
inline

Definition at line 782 of file mathplot.h.

Referenced by FREQUENCY_LOG_SCALE::formatLabels(), and formatSILabels().

782 { return m_tickLabels; };
std::vector< TickLabel > m_tickLabels
Definition: mathplot.h:822
virtual double mpScaleBase::TransformFromPlot ( double  xplot)
inlinevirtual

Reimplemented in mpScaleY, mpScaleXLog, and mpScaleX.

Definition at line 768 of file mathplot.h.

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

768 { return 0.0; };
virtual double mpScaleBase::TransformToPlot ( double  x)
inlinevirtual

Reimplemented in mpScaleY, mpScaleXLog, and mpScaleX.

Definition at line 767 of file mathplot.h.

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

767 { return 0.0; };
void mpScaleBase::updateTickLabels ( wxDC &  dc,
mpWindow w 
)
protected

Definition at line 978 of file mathplot.cpp.

References computeLabelExtents(), and formatLabels().

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

979 {
980  formatLabels();
981  computeLabelExtents( dc, w );
982 
983  // int gap = IsHorizontal() ? m_maxLabelWidth + 10 : m_maxLabelHeight + 5;
984 
985  // if ( m_tickLabels.size() <= 2)
986  // return;
987 
988  /*
989  * fixme!
990  *
991  * for ( auto &l : m_tickLabels )
992  * {
993  * double p = TransformToPlot ( l.pos );
994  *
995  * if ( !IsHorizontal() )
996  * l.pixelPos = (int)(( w.GetPosY() - p ) * w.GetScaleY());
997  * else
998  * l.pixelPos = (int)(( p - w.GetPosX()) * w.GetScaleX());
999  * }
1000  *
1001  *
1002  * for (int i = 1; i < m_tickLabels.size() - 1; i++)
1003  * {
1004  * int dist_prev;
1005  *
1006  * for(int j = i-1; j >= 1; j--)
1007  * {
1008  * if( m_tickLabels[j].visible)
1009  * {
1010  * dist_prev = abs( m_tickLabels[j].pixelPos - m_tickLabels[i].pixelPos );
1011  * break;
1012  * }
1013  * }
1014  *
1015  * if (dist_prev < gap)
1016  * m_tickLabels[i].visible = false;
1017  * }
1018  */
1019 }
void computeLabelExtents(wxDC &dc, mpWindow &w)
Definition: mathplot.cpp:960
virtual void formatLabels()
Definition: mathplot.h:804

Member Data Documentation

double mpScaleBase::m_absVisibleMaxV
protected
wxBrush mpLayer::m_brush
protectedinherited

Definition at line 315 of file mathplot.h.

bool mpLayer::m_continuous
protectedinherited

Definition at line 317 of file mathplot.h.

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

int mpScaleBase::m_flags
protected

Definition at line 826 of file mathplot.h.

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

int mpScaleBase::m_maxLabelHeight
protected

Definition at line 831 of file mathplot.h.

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

int mpScaleBase::m_maxLabelWidth
protected

Definition at line 832 of file mathplot.h.

Referenced by computeLabelExtents(), and mpScaleBase().

wxString mpLayer::m_name
protectedinherited
int mpScaleBase::m_nameFlags
protected

Definition at line 827 of file mathplot.h.

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

bool mpScaleBase::m_rangeSet
protected

Definition at line 830 of file mathplot.h.

Referenced by mpScaleBase().

bool mpLayer::m_showName
protectedinherited
bool mpScaleBase::m_ticks
protected

Definition at line 828 of file mathplot.h.

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

std::vector<double> mpScaleBase::m_tickValues
protected
mpLayerType mpLayer::m_type
protectedinherited

Definition at line 320 of file mathplot.h.

Referenced by mpInfoLayer::mpInfoLayer().


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