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

Constructor & Destructor Documentation

◆ mpScaleBase()

mpScaleBase::mpScaleBase ( )

Definition at line 899 of file mathplot.cpp.

900{
901 m_rangeSet = false;
903
904 // initialize these members mainly to avoid not initialized values
905 m_offset = 0.0;
906 m_scale = 1.0;
907 m_absVisibleMaxV = 0.0;
908 m_flags = 0; // Flag for axis alignment
909 m_ticks = true; // Flag to toggle between ticks or grid
910 m_minV = 0.0;
911 m_maxV = 0.0;
913 m_maxLabelWidth = 1;
914}
double m_scale
Definition: mathplot.h:831
double m_offset
Definition: mathplot.h:831
bool m_rangeSet
Definition: mathplot.h:837
int m_maxLabelHeight
Definition: mathplot.h:838
double m_maxV
Definition: mathplot.h:836
int m_maxLabelWidth
Definition: mathplot.h:839
double m_absVisibleMaxV
Definition: mathplot.h:832
bool m_ticks
Definition: mathplot.h:835
double m_minV
Definition: mathplot.h:836
int m_flags
Definition: mathplot.h:833
int m_nameFlags
Definition: mathplot.h:834
#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 697 of file mathplot.h.

697{};

Member Function Documentation

◆ AbsMaxValue()

double mpScaleBase::AbsMaxValue ( ) const
inline

Definition at line 764 of file mathplot.h.

765 {
766 return std::max( std::abs( m_maxV ), std::abs( m_minV ) );
767 }
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Definition: eda_angle.h:401

References std::abs().

◆ AbsVisibleMaxValue()

double mpScaleBase::AbsVisibleMaxValue ( ) const
inline

Definition at line 769 of file mathplot.h.

770 {
771 return m_absVisibleMaxV;
772 }

◆ computeLabelExtents()

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

Definition at line 917 of file mathplot.cpp.

918{
920 m_maxLabelWidth = 0;
921
922 for( int n = 0; n < labelCount(); n++ )
923 {
924 int tx, ty;
925 const wxString s = getLabel( n );
926
927 dc.GetTextExtent( s, &tx, &ty );
928 m_maxLabelHeight = std::max( ty, m_maxLabelHeight );
929 m_maxLabelWidth = std::max( tx, m_maxLabelWidth );
930 }
931}
virtual wxString getLabel(int n) const
Definition: mathplot.h:823
virtual int labelCount() const
Definition: mathplot.h:805

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

Referenced by updateTickLabels().

◆ ExtendDataRange()

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

Definition at line 738 of file mathplot.h.

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

Referenced by mpFXY::UpdateScales().

◆ formatLabel()

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

Definition at line 810 of file mathplot.h.

810{ return wxT( "" ); }

◆ formatLabels()

virtual void mpScaleBase::formatLabels ( )
inlineprotectedvirtual

Definition at line 811 of file mathplot.h.

811{};

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

75{
76 wxBitmap square( side, side, -1 );
77 wxColour filler = m_pen.GetColour();
78 wxBrush brush( filler, wxBRUSHSTYLE_SOLID );
79 wxMemoryDC dc;
80
81 dc.SelectObject( square );
82 dc.SetBackground( brush );
83 dc.Clear();
84 dc.SelectObject( wxNullBitmap );
85 return square;
86}
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 732 of file mathplot.h.

733 {
734 minV = m_minV;
735 maxV = m_maxV;
736 }

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

824 {
825 return m_tickLabels[n].label;
826 }
std::vector< TickLabel > m_tickLabels
Definition: mathplot.h:829

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

◆ getLabelPos()

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

Definition at line 818 of file mathplot.h.

819 {
820 return m_tickLabels[n].pos;
821 }

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

Get layer name.

Returns
Name

Definition at line 238 of file mathplot.h.

238{ return m_name; }
wxString m_name
Definition: mathplot.h:317

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

248{ return m_pen; }

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

◆ getTickPos()

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

Definition at line 813 of file mathplot.h.

814 {
815 return m_tickValues[n];
816 }
std::vector< double > m_tickValues
Definition: mathplot.h:828

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

719{ 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 797 of file mathplot.h.

797{};

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

701{ 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 805 of file mathplot.h.

806 {
807 return m_tickLabels.size();
808 }

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:1130
double GetScaleX(void) const
Definition: mathplot.h:1109
double GetScaleY(void) const
Definition: mathplot.h:1116
double GetPosX(void) const
Definition: mathplot.h:1123
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 798 of file mathplot.h.

798{};

Referenced by mpScaleXBase::Plot().

◆ ResetDataRange()

void mpScaleBase::ResetDataRange ( )
inline

Definition at line 759 of file mathplot.h.

760 {
761 m_rangeSet = 0;
762 }

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

707{ 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 725 of file mathplot.h.

726 {
727 m_rangeSet = true;
728 m_minV = minV;
729 m_maxV = maxV;
730 }

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

void mpLayer::SetName ( wxString  name)
inlineinherited

Set layer name.

Parameters
nameName, will be copied to internal class member

Definition at line 267 of file mathplot.h.

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

References name.

◆ SetNameAlign()

void mpScaleBase::SetNameAlign ( int  align)
inline

Definition at line 709 of file mathplot.h.

709{ m_nameFlags = align; }

Referenced by 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::EnableCursor(), and 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 714 of file mathplot.h.

714{ m_ticks = enable; };

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

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

801 {
802 return m_tickValues.size();
803 }

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

◆ TickLabels()

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

Definition at line 789 of file mathplot.h.

789{ return m_tickLabels; };

◆ TransformFromPlot()

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

Reimplemented in mpScaleX, mpScaleXLog, and mpScaleY.

Definition at line 775 of file mathplot.h.

775{ 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 774 of file mathplot.h.

774{ 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 934 of file mathplot.cpp.

935{
936 formatLabels();
937 computeLabelExtents( dc, w );
938
939 // int gap = IsHorizontal() ? m_maxLabelWidth + 10 : m_maxLabelHeight + 5;
940
941 // if ( m_tickLabels.size() <= 2)
942 // return;
943
944 /*
945 * fixme!
946 *
947 * for ( auto &l : m_tickLabels )
948 * {
949 * double p = TransformToPlot ( l.pos );
950 *
951 * if ( !IsHorizontal() )
952 * l.pixelPos = (int)(( w.GetPosY() - p ) * w.GetScaleY());
953 * else
954 * l.pixelPos = (int)(( p - w.GetPosX()) * w.GetScaleX());
955 * }
956 *
957 *
958 * for (int i = 1; i < m_tickLabels.size() - 1; i++)
959 * {
960 * int dist_prev;
961 *
962 * for(int j = i-1; j >= 1; j--)
963 * {
964 * if( m_tickLabels[j].visible)
965 * {
966 * dist_prev = abs( m_tickLabels[j].pixelPos - m_tickLabels[i].pixelPos );
967 * break;
968 * }
969 * }
970 *
971 * if (dist_prev < gap)
972 * m_tickLabels[i].visible = false;
973 * }
974 */
975}
virtual void formatLabels()
Definition: mathplot.h:811
void computeLabelExtents(wxDC &dc, mpWindow &w)
Definition: mathplot.cpp:917

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

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

◆ m_font

◆ m_maxLabelHeight

int mpScaleBase::m_maxLabelHeight
protected

Definition at line 838 of file mathplot.h.

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

◆ m_maxLabelWidth

int mpScaleBase::m_maxLabelWidth
protected

Definition at line 839 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 834 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 837 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 835 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: