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

Classes

struct  TickLabel
 

Public Member Functions

 mpScaleBase ()
 
virtual ~mpScaleBase ()
 
virtual bool IsHorizontal () const =0
 
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
 
virtual double TransformToPlot (double x) const
 
virtual double TransformFromPlot (double xplot) 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...
 
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...
 
virtual 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) 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

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

Constructor & Destructor Documentation

◆ mpScaleBase()

mpScaleBase::mpScaleBase ( )

Definition at line 917 of file mathplot.cpp.

918{
919 m_rangeSet = false;
921
922 // initialize these members mainly to avoid not initialized values
923 m_offset = 0.0;
924 m_scale = 1.0;
925 m_absVisibleMaxV = 0.0;
926 m_flags = 0; // Flag for axis alignment
927 m_ticks = true; // Flag to toggle between ticks or grid
928 m_minV = 0.0;
929 m_maxV = 0.0;
931 m_maxLabelWidth = 1;
932}
double m_scale
Definition: mathplot.h:833
double m_offset
Definition: mathplot.h:833
bool m_rangeSet
Definition: mathplot.h:839
int m_maxLabelHeight
Definition: mathplot.h:840
double m_maxV
Definition: mathplot.h:838
int m_maxLabelWidth
Definition: mathplot.h:841
double m_absVisibleMaxV
Definition: mathplot.h:834
bool m_ticks
Definition: mathplot.h:837
double m_minV
Definition: mathplot.h:838
int m_flags
Definition: mathplot.h:835
int m_nameFlags
Definition: mathplot.h:836
#define mpALIGN_BORDER_BOTTOM
Aligns X axis to bottom border.
Definition: mathplot.h:487

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

699{};

Member Function Documentation

◆ AbsMaxValue()

double mpScaleBase::AbsMaxValue ( ) const
inline

Definition at line 766 of file mathplot.h.

767 {
768 return std::max( std::abs( m_maxV ), std::abs( m_minV ) );
769 }
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Definition: eda_angle.h:418

References std::abs().

◆ AbsVisibleMaxValue()

double mpScaleBase::AbsVisibleMaxValue ( ) const
inline

Definition at line 771 of file mathplot.h.

772 {
773 return m_absVisibleMaxV;
774 }

◆ computeLabelExtents()

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

Definition at line 935 of file mathplot.cpp.

936{
938 m_maxLabelWidth = 0;
939
940 for( int n = 0; n < labelCount(); n++ )
941 {
942 int tx, ty;
943 const wxString s = getLabel( n );
944
945 dc.GetTextExtent( s, &tx, &ty );
946 m_maxLabelHeight = std::max( ty, m_maxLabelHeight );
947 m_maxLabelWidth = std::max( tx, m_maxLabelWidth );
948 }
949}
virtual wxString getLabel(int n) const
Definition: mathplot.h:825
virtual int labelCount() const
Definition: mathplot.h:807

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

Referenced by updateTickLabels().

◆ ExtendDataRange()

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

Definition at line 740 of file mathplot.h.

741 {
742 if( !m_rangeSet )
743 {
744 m_minV = minV;
745 m_maxV = maxV;
746 m_rangeSet = true;
747 }
748 else
749 {
750 m_minV = std::min( minV, m_minV );
751 m_maxV = std::max( maxV, m_maxV );
752 }
753
754 if( m_minV == m_maxV )
755 {
756 m_minV = m_minV - 1.0;
757 m_maxV = m_maxV + 1.0;
758 }
759 }

Referenced by mpFXY::UpdateScales().

◆ formatLabel()

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

Definition at line 812 of file mathplot.h.

812{ return wxT( "" ); }

◆ formatLabels()

virtual void mpScaleBase::formatLabels ( )
inlineprotectedvirtual

Definition at line 813 of file mathplot.h.

813{};

Referenced by updateTickLabels().

◆ GetBrush()

const wxBrush & mpLayer::GetBrush ( ) const
inlineinherited

Get brush set for this layer.

Returns
brush.

Definition at line 306 of file mathplot.h.

306{ return m_brush; };
wxBrush m_brush
Definition: mathplot.h:316

◆ 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 75 of file mathplot.cpp.

76{
77 wxBitmap square( side, side, -1 );
78 wxColour filler = m_pen.GetColour();
79 wxBrush brush( filler, wxBRUSHSTYLE_SOLID );
80 wxMemoryDC dc;
81
82 dc.SelectObject( square );
83 dc.SetBackground( brush );
84 dc.Clear();
85 dc.SelectObject( wxNullBitmap );
86 return square;
87}
double square(double x)
wxPen m_pen
Definition: mathplot.h:315

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

258{ return m_continuous; }
bool m_continuous
Definition: mathplot.h:318

◆ GetDataRange()

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

Definition at line 734 of file mathplot.h.

735 {
736 minV = m_minV;
737 maxV = m_maxV;
738 }

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

285{ return m_drawOutsideMargins; };
bool m_drawOutsideMargins
Definition: mathplot.h:320

◆ GetFont()

const wxFont & mpLayer::GetFont ( ) const
inlineinherited

Get font set for this layer.

Returns
Font

Definition at line 243 of file mathplot.h.

243{ return m_font; }
wxFont m_font
Definition: mathplot.h:314

◆ getLabel()

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

Definition at line 825 of file mathplot.h.

826 {
827 return m_tickLabels[n].label;
828 }
std::vector< TickLabel > m_tickLabels
Definition: mathplot.h:831

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

◆ getLabelPos()

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

Definition at line 820 of file mathplot.h.

821 {
822 return m_tickLabels[n].pos;
823 }

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

294{ return m_type; };
mpLayerType m_type
Definition: mathplot.h:321

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

180{ return 1.0; }

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

190{ return 1.0; }

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

175{ return -1.0; }

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

185{ return -1.0; }

Referenced by mpFXY::UpdateScales().

◆ GetName()

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

◆ GetPen()

const wxPen & mpLayer::GetPen ( ) const
inlineinherited

Get pen set for this layer.

Returns
Pen

Definition at line 248 of file mathplot.h.

248{ return m_pen; }

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

◆ getTickPos()

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

Definition at line 815 of file mathplot.h.

816 {
817 return m_tickValues[n];
818 }
std::vector< double > m_tickValues
Definition: mathplot.h:830

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

◆ GetTicks()

bool mpScaleBase::GetTicks ( ) const
inline

Get X axis ticks or grid.

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

Definition at line 721 of file mathplot.h.

721{ return m_ticks; };

Referenced by SIM_PLOT_PANEL::IsGridShown().

◆ getVisibleDataRange()

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

Reimplemented in mpScaleXBase, and mpScaleY.

Definition at line 799 of file mathplot.h.

799{};

◆ HasBBox()

bool mpScaleBase::HasBBox ( ) const
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 703 of file mathplot.h.

703{ return false; }

◆ IsHorizontal()

virtual bool mpScaleBase::IsHorizontal ( ) const
pure virtual

Implemented in mpScaleXBase, and mpScaleY.

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

170{ return false; };

◆ IsVisible()

bool mpLayer::IsVisible ( ) const
inlineinherited

Checks whether the layer is visible or not.

Returns
true if visible

Definition at line 298 of file mathplot.h.

298{ return m_visible; };
bool m_visible
Definition: mathplot.h:322

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

◆ labelCount()

virtual int mpScaleBase::labelCount ( ) const
inlineprotectedvirtual

Definition at line 807 of file mathplot.h.

808 {
809 return m_tickLabels.size();
810 }

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
double GetPosY(void) const
Definition: mathplot.h:1132
double GetScaleX(void) const
Definition: mathplot.h:1111
double GetScaleY(void) const
Definition: mathplot.h:1118
double GetPosX(void) const
Definition: mathplot.h:1125
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 CURSOR, mpInfoLayer, mpInfoCoords, mpInfoLegend, mpFX, mpFY, mpFXY, mpProfile, mpScaleXBase, mpScaleY, mpText, mpMovableObject, and mpBitmapLayer.

Referenced by mpPrintout::OnPrintPage().

◆ recalculateTicks()

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

Reimplemented in mpScaleX, mpScaleXLog, and mpScaleY.

Definition at line 800 of file mathplot.h.

800{};

Referenced by mpScaleXBase::Plot().

◆ ResetDataRange()

void mpScaleBase::ResetDataRange ( )
inline

Definition at line 761 of file mathplot.h.

762 {
763 m_rangeSet = 0;
764 }

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

709{ m_flags = align; };

◆ SetBrush()

void mpLayer::SetBrush ( wxBrush  brush)
inlineinherited

Set layer brush.

Parameters
brushbrush, will be copied to internal class member

Definition at line 310 of file mathplot.h.

310{ m_brush = brush; };

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

253{ m_continuous = continuity; }

Referenced by TRACE::TRACE().

◆ SetDataRange()

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

Definition at line 727 of file mathplot.h.

728 {
729 m_rangeSet = true;
730 m_minV = minV;
731 m_maxV = maxV;
732 }

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

281{ m_drawOutsideMargins = drawModeOutside; };

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

272{ m_font = font; }

◆ SetName()

virtual void mpLayer::SetName ( wxString  name)
inlinevirtualinherited

Set layer name.

Parameters
nameName, will be copied to internal class member

Reimplemented in TRACE.

Definition at line 267 of file mathplot.h.

267{ m_name = name; }
const char * name
Definition: DXF_plotter.cpp:56

References name.

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

◆ SetNameAlign()

void mpScaleBase::SetNameAlign ( int  align)
inline

Definition at line 711 of file mathplot.h.

711{ m_nameFlags = align; }

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

277{ m_pen = pen; }

Referenced by SIM_PLOT_PANEL::UpdateTraceStyle().

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

716{ m_ticks = enable; };

Referenced by SIM_PLOT_PANEL::ShowGrid().

◆ SetVisible()

void mpLayer::SetVisible ( bool  show)
inlineinherited

Sets layer visibility.

Parameters
showvisibility bool.

Definition at line 302 of file mathplot.h.

302{ m_visible = show; };

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

262{ m_showName = show; };
bool m_showName
Definition: mathplot.h:319

Referenced by TRACE::TRACE().

◆ tickCount()

int mpScaleBase::tickCount ( ) const
inlineprotected

Definition at line 802 of file mathplot.h.

803 {
804 return m_tickValues.size();
805 }

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

◆ TickLabels()

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

Definition at line 791 of file mathplot.h.

791{ return m_tickLabels; };

◆ TransformFromPlot()

virtual double mpScaleBase::TransformFromPlot ( double  xplot) const
inlinevirtual

Reimplemented in mpScaleX, mpScaleXLog, and mpScaleY.

Definition at line 777 of file mathplot.h.

777{ return 0.0; };

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

◆ TransformToPlot()

virtual double mpScaleBase::TransformToPlot ( double  x) const
inlinevirtual

Reimplemented in mpScaleX, mpScaleXLog, and mpScaleY.

Definition at line 776 of file mathplot.h.

776{ 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 952 of file mathplot.cpp.

953{
954 formatLabels();
955 computeLabelExtents( dc, w );
956
957 // int gap = IsHorizontal() ? m_maxLabelWidth + 10 : m_maxLabelHeight + 5;
958
959 // if ( m_tickLabels.size() <= 2)
960 // return;
961
962 /*
963 * fixme!
964 *
965 * for ( auto &l : m_tickLabels )
966 * {
967 * double p = TransformToPlot ( l.pos );
968 *
969 * if ( !IsHorizontal() )
970 * l.pixelPos = (int)(( w.GetPosY() - p ) * w.GetScaleY());
971 * else
972 * l.pixelPos = (int)(( p - w.GetPosX()) * w.GetScaleX());
973 * }
974 *
975 *
976 * for (int i = 1; i < m_tickLabels.size() - 1; i++)
977 * {
978 * int dist_prev;
979 *
980 * for(int j = i-1; j >= 1; j--)
981 * {
982 * if( m_tickLabels[j].visible)
983 * {
984 * dist_prev = abs( m_tickLabels[j].pixelPos - m_tickLabels[i].pixelPos );
985 * break;
986 * }
987 * }
988 *
989 * if (dist_prev < gap)
990 * m_tickLabels[i].visible = false;
991 * }
992 */
993}
virtual void formatLabels()
Definition: mathplot.h:813
void computeLabelExtents(wxDC &dc, mpWindow &w)
Definition: mathplot.cpp:935

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

◆ m_continuous

bool mpLayer::m_continuous
protectedinherited

Definition at line 318 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 835 of file mathplot.h.

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

◆ m_font

◆ m_maxLabelHeight

int mpScaleBase::m_maxLabelHeight
protected

Definition at line 840 of file mathplot.h.

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

◆ m_maxLabelWidth

int mpScaleBase::m_maxLabelWidth
protected

Definition at line 841 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 836 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 839 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 837 of file mathplot.h.

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

◆ m_tickValues

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

◆ m_type

mpLayerType mpLayer::m_type
protectedinherited

Definition at line 321 of file mathplot.h.

Referenced by mpInfoLayer::mpInfoLayer().

◆ m_visible


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