KiCad PCB EDA Suite
TRACE Class Reference

#include <sim_plot_panel.h>

Inheritance diagram for TRACE:
mpFXYVector mpFXY mpLayer

Public Member Functions

 TRACE (const wxString &aName, SIM_TRACE_TYPE aType)
 
void SetName (wxString aName) override
 Set layer name. More...
 
void SetData (const std::vector< double > &aX, const std::vector< double > &aY) override
 Assigns new data set for the trace. More...
 
const std::vector< double > & GetDataX () const
 
const std::vector< double > & GetDataY () const
 
bool HasCursor (int aCursorId)
 
void SetCursor (int aCursorId, CURSOR *aCursor)
 
CURSORGetCursor (int aCursorId)
 
std::map< int, CURSOR * > & GetCursors ()
 
SIM_TRACE_TYPE GetType () const
 
void SetTraceColour (const wxColour &aColour)
 
wxColour GetTraceColour () const
 
void Clear ()
 Clears all the data, leaving the layer empty. More...
 
double GetMinX () const override
 Returns the actual minimum X data (loaded in SetData). More...
 
double GetMinY () const override
 Returns the actual minimum Y data (loaded in SetData). More...
 
double GetMaxX () const override
 Returns the actual maximum X data (loaded in SetData). More...
 
double GetMaxY () const override
 Returns the actual maximum Y data (loaded in SetData). More...
 
virtual void Plot (wxDC &dc, mpWindow &w) override
 Layer plot handler. More...
 
virtual void SetScale (mpScaleBase *scaleX, mpScaleBase *scaleY)
 
void UpdateScales ()
 
double s2x (double plotCoordX) const
 
double s2y (double plotCoordY) const
 
double x2s (double x) const
 
double y2s (double y) const
 
virtual bool HasBBox () const
 Check whether this layer has a bounding box. More...
 
virtual bool IsInfo () const
 Check whether the layer is an info box. 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 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 Rewind () override
 Rewind value enumeration with mpFXY::GetNextXY. More...
 
bool GetNextXY (double &x, double &y) override
 Get locus value for next N. More...
 
size_t GetCount () const override
 
void UpdateViewBoundary (wxCoord xnew, wxCoord ynew)
 Update label positioning data. More...
 

Protected Attributes

std::map< int, CURSOR * > m_cursors
 
SIM_TRACE_TYPE m_type
 
wxColour m_traceColour
 
std::vector< double > m_xs
 The internal copy of the set of data to draw. More...
 
std::vector< double > m_ys
 
size_t m_index
 The internal counter for the "GetNextXY" interface. More...
 
double m_minX
 Loaded at SetData. More...
 
double m_maxX
 
double m_minY
 
double m_maxY
 
int m_flags
 
wxCoord maxDrawX
 
wxCoord minDrawX
 
wxCoord maxDrawY
 
wxCoord minDrawY
 
mpScaleBasem_scaleX
 
mpScaleBasem_scaleY
 
wxFont m_font
 
wxPen m_pen
 
wxBrush m_brush
 
wxString m_name
 
bool m_continuous
 
bool m_showName
 
bool m_drawOutsideMargins
 
bool m_visible
 

Detailed Description

Definition at line 124 of file sim_plot_panel.h.

Constructor & Destructor Documentation

◆ TRACE()

TRACE::TRACE ( const wxString &  aName,
SIM_TRACE_TYPE  aType 
)
inline

Definition at line 127 of file sim_plot_panel.h.

127 :
128 mpFXYVector( aName ),
129 m_type( aType )
130 {
131 SetContinuity( true );
132 SetDrawOutsideMargins( false );
133 ShowName( false );
134 }
SIM_TRACE_TYPE m_type
mpFXYVector(const wxString &name=wxEmptyString, int flags=mpALIGN_NE)
Definition: mathplot.cpp:2834
void SetContinuity(bool continuity)
Set the 'continuity' property of the layer (true:draws a continuous line, false:draws separate points...
Definition: mathplot.h:253
void ShowName(bool show)
Shows or hides the text label with the name of the layer (default is visible).
Definition: mathplot.h:262
void SetDrawOutsideMargins(bool drawModeOutside)
Set Draw mode: inside or outside margins.
Definition: mathplot.h:281

References mpLayer::SetContinuity(), mpLayer::SetDrawOutsideMargins(), and mpLayer::ShowName().

Member Function Documentation

◆ Clear()

void mpFXYVector::Clear ( )
inherited

Clears all the data, leaving the layer empty.

See also
SetData

Definition at line 2923 of file mathplot.cpp.

2924{
2925 m_xs.clear();
2926 m_ys.clear();
2927}
std::vector< double > m_ys
Definition: mathplot.h:1595
std::vector< double > m_xs
The internal copy of the set of data to draw.
Definition: mathplot.h:1595

References mpFXYVector::m_xs, and mpFXYVector::m_ys.

◆ 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

◆ GetCount()

size_t mpFXYVector::GetCount ( ) const
overrideprotectedvirtualinherited

Implements mpFXY.

Definition at line 2902 of file mathplot.cpp.

2903{
2904 return m_xs.size();
2905}

References mpFXYVector::m_xs.

◆ GetCursor()

CURSOR * TRACE::GetCursor ( int  aCursorId)
inline

Definition at line 170 of file sim_plot_panel.h.

170{ return m_cursors[ aCursorId ]; }
std::map< int, CURSOR * > m_cursors

References m_cursors.

Referenced by SIM_PLOT_PANEL::EnableCursor().

◆ GetCursors()

std::map< int, CURSOR * > & TRACE::GetCursors ( )
inline

Definition at line 171 of file sim_plot_panel.h.

171{ return m_cursors; }

References m_cursors.

Referenced by SIM_PLOT_PANEL::DeleteTrace(), CURSOR::getID(), and SIM_PLOT_PANEL::SetTraceData().

◆ GetDataX()

const std::vector< double > & TRACE::GetDataX ( ) const
inline

Definition at line 164 of file sim_plot_panel.h.

164{ return m_xs; }

References mpFXYVector::m_xs.

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

◆ GetDataY()

const std::vector< double > & TRACE::GetDataY ( ) const
inline

Definition at line 165 of file sim_plot_panel.h.

165{ return m_ys; }

References mpFXYVector::m_ys.

Referenced by CURSOR::doSetCoordX().

◆ 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

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

double mpFXYVector::GetMaxX ( ) const
inlineoverridevirtualinherited

Returns the actual maximum X data (loaded in SetData).

Reimplemented from mpLayer.

Definition at line 1630 of file mathplot.h.

1630{ return m_maxX; }
double m_maxX
Definition: mathplot.h:1603

◆ GetMaxY()

double mpFXYVector::GetMaxY ( ) const
inlineoverridevirtualinherited

Returns the actual maximum Y data (loaded in SetData).

Reimplemented from mpLayer.

Definition at line 1634 of file mathplot.h.

1634{ return m_maxY; }
double m_maxY
Definition: mathplot.h:1603

◆ GetMinX()

double mpFXYVector::GetMinX ( ) const
inlineoverridevirtualinherited

Returns the actual minimum X data (loaded in SetData).

Reimplemented from mpLayer.

Definition at line 1622 of file mathplot.h.

1622{ return m_minX; }
double m_minX
Loaded at SetData.
Definition: mathplot.h:1603

◆ GetMinY()

double mpFXYVector::GetMinY ( ) const
inlineoverridevirtualinherited

Returns the actual minimum Y data (loaded in SetData).

Reimplemented from mpLayer.

Definition at line 1626 of file mathplot.h.

1626{ return m_minY; }
double m_minY
Definition: mathplot.h:1603

◆ GetName()

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

◆ GetNextXY()

bool mpFXYVector::GetNextXY ( double &  x,
double &  y 
)
overrideprotectedvirtualinherited

Get locus value for next N.

Overridden in this implementation.

Parameters
xReturns X value
yReturns Y value

Implements mpFXY.

Definition at line 2908 of file mathplot.cpp.

2909{
2910 if( m_index >= m_xs.size() )
2911 {
2912 return false;
2913 }
2914 else
2915 {
2916 x = m_xs[m_index];
2917 y = m_ys[m_index++];
2918 return m_index <= m_xs.size();
2919 }
2920}
size_t m_index
The internal counter for the "GetNextXY" interface.
Definition: mathplot.h:1599

References mpFXYVector::m_index, mpFXYVector::m_xs, and mpFXYVector::m_ys.

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

◆ GetTraceColour()

wxColour TRACE::GetTraceColour ( ) const
inline

◆ GetType()

SIM_TRACE_TYPE TRACE::GetType ( ) const
inline

Definition at line 173 of file sim_plot_panel.h.

173{ return m_type; }

References m_type.

Referenced by SIM_PLOT_PANEL::SetTraceData(), and SIM_PLOT_PANEL::UpdateTraceStyle().

◆ HasBBox()

virtual bool mpLayer::HasBBox ( ) const
inlinevirtualinherited

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 in mpInfoLayer, mpScaleBase, mpScaleY, mpText, mpMovableObject, and mpBitmapLayer.

Definition at line 161 of file mathplot.h.

161{ return true; }

◆ HasCursor()

bool TRACE::HasCursor ( int  aCursorId)
inline

Definition at line 167 of file sim_plot_panel.h.

167{ return m_cursors[ aCursorId ] != nullptr; }

References m_cursors.

Referenced by SIM_PLOT_PANEL::EnableCursor().

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

◆ Plot()

void mpFXY::Plot ( wxDC &  dc,
mpWindow w 
)
overridevirtualinherited

Layer plot handler.

This implementation will plot the locus in the visible area and put a label according to the alignment specified.

Implements mpLayer.

Definition at line 564 of file mathplot.cpp.

565{
566 // If trace doesn't have any data yet then it won't have any scale set. In any case, there's
567 // nothing to plot.
568 if( !GetCount() )
569 return;
570
571 wxCHECK_RET( m_scaleX, wxS( "X scale was not set" ) );
572
573 wxCHECK_RET( m_scaleY, wxS( "Y scale was not set" ) );
574
575 if( !m_visible )
576 return;
577
578 wxCoord startPx = m_drawOutsideMargins ? 0 : w.GetMarginLeft();
579 wxCoord endPx = m_drawOutsideMargins ? w.GetScrX() : w.GetScrX() - w.GetMarginRight();
580 wxCoord minYpx = m_drawOutsideMargins ? 0 : w.GetMarginTop();
581 wxCoord maxYpx = m_drawOutsideMargins ? w.GetScrY() : w.GetScrY() - w.GetMarginBottom();
582
583 // Check for a collapsed window before we try to allocate a negative number of points
584 if( endPx <= startPx || minYpx >= maxYpx )
585 return;
586
587 dc.SetPen( m_pen );
588
589 double x, y;
590 // Do this to reset the counters to evaluate bounding box for label positioning
591 Rewind();
592 GetNextXY( x, y );
593 maxDrawX = x;
594 minDrawX = x;
595 maxDrawY = y;
596 minDrawY = y;
597 // drawnPoints = 0;
598 Rewind();
599
600 dc.SetClippingRegion( startPx, minYpx, endPx - startPx + 1, maxYpx - minYpx + 1 );
601
602 if( !m_continuous )
603 {
604 bool first = true;
605 wxCoord ix = 0;
606 std::set<wxCoord> ys;
607
608 while( GetNextXY( x, y ) )
609 {
610 double px = m_scaleX->TransformToPlot( x );
611 double py = m_scaleY->TransformToPlot( y );
612 wxCoord newX = w.x2p( px );
613
614 if( first )
615 {
616 ix = newX;
617 first = false;
618 }
619
620 if( newX == ix ) // continue until a new X coordinate is reached
621 {
622 // collect all unique points
623 ys.insert( w.y2p( py ) );
624 continue;
625 }
626
627 for( auto& iy: ys )
628 {
630 || ( (ix >= startPx) && (ix <= endPx) && (iy >= minYpx) && (iy <= maxYpx) ) )
631 {
632 // for some reason DrawPoint does not use the current pen, so we use
633 // DrawLine for fat pens
634 if( m_pen.GetWidth() <= 1 )
635 dc.DrawPoint( ix, iy );
636 else
637 dc.DrawLine( ix, iy, ix, iy );
638
639 UpdateViewBoundary( ix, iy );
640 }
641 }
642
643 ys.clear();
644 ix = newX;
645 ys.insert( w.y2p( py ) );
646 }
647 }
648 else
649 {
650 int count = 0;
651 int x0=0; // X position of merged current vertical line
652 int ymin0=0; // y min coord of merged current vertical line
653 int ymax0=0; // y max coord of merged current vertical line
654 int dupx0 = 0; // count of currently merged vertical lines
655 wxPoint line_start; // starting point of the current line to draw
656
657 // A buffer to store coordinates of lines to draw
658 std::vector<wxPoint>pointList;
659 pointList.reserve( endPx - startPx + 1 );
660
661 // Note: we can use dc.DrawLines() only for a reasonable number or points (<10000),
662 // because at least on Windows dc.DrawLines() can hang for a lot of points.
663 // (> 10000 points) (can happens when a lot of points is calculated)
664 // To avoid long draw time (and perhaps hanging) one plot only not redundant lines.
665 // To avoid artifacts when skipping points to the same x coordinate, for each group of
666 // points at a give, x coordinate we also draw a vertical line at this coord, from the
667 // ymin to the ymax vertical coordinates of skipped points
668 while( GetNextXY( x, y ) )
669 {
670 double px = m_scaleX->TransformToPlot( x );
671 double py = m_scaleY->TransformToPlot( y );
672
673 wxCoord x1 = w.x2p( px );
674 wxCoord y1 = w.y2p( py );
675
676 // Store only points on the drawing area, to speed up the drawing time
677 // Note: x1 is a value truncated from px by w.x2p(). So to be sure the first point
678 // is drawn, the x1 low limit is startPx-1 in plot coordinates
679 if( x1 >= startPx-1 && x1 <= endPx )
680 {
681 if( !count || line_start.x != x1 )
682 {
683 if( count && dupx0 > 1 && ymin0 != ymax0 )
684 {
685 // Vertical points are merged, draw the pending vertical line
686 // However, if the line is one pixel length, it is not drawn, because
687 // the main trace show this point
688 dc.DrawLine( x0, ymin0, x0, ymax0 );
689 }
690
691 x0 = x1;
692 ymin0 = ymax0 = y1;
693 dupx0 = 0;
694
695 pointList.emplace_back( wxPoint( x1, y1 ) );
696
697 line_start.x = x1;
698 line_start.y = y1;
699 count++;
700 }
701 else
702 {
703 ymin0 = std::min( ymin0, y1 );
704 ymax0 = std::max( ymax0, y1 );
705 x0 = x1;
706 dupx0++;
707 }
708 }
709 }
710
711 if( pointList.size() > 1 )
712 {
713 // For a better look (when using dashed lines) and more optimization, try to merge
714 // horizontal segments, in order to plot longer lines
715 // We are merging horizontal segments because this is easy, and horizontal segments
716 // are a frequent cases
717 std::vector<wxPoint> drawPoints;
718 drawPoints.reserve( endPx - startPx + 1 );
719
720 drawPoints.push_back( pointList[0] ); // push the first point in list
721
722 for( size_t ii = 1; ii < pointList.size()-1; ii++ )
723 {
724 // Skip intermediate points between the first point and the last point of the
725 // segment candidate
726 if( drawPoints.back().y == pointList[ii].y &&
727 drawPoints.back().y == pointList[ii+1].y )
728 {
729 continue;
730 }
731 else
732 {
733 drawPoints.push_back( pointList[ii] );
734 }
735 }
736
737 // push the last point to draw in list
738 if( drawPoints.back() != pointList.back() )
739 drawPoints.push_back( pointList.back() );
740
741 dc.DrawLines( drawPoints.size(), &drawPoints[0] );
742 }
743 }
744
745 if( !m_name.IsEmpty() && m_showName )
746 {
747 dc.SetFont( m_font );
748
749 wxCoord tx, ty;
750 dc.GetTextExtent( m_name, &tx, &ty );
751
752 // xxx implement else ... if (!HasBBox())
753 {
754 // const int sx = w.GetScrX();
755 // const int sy = w.GetScrY();
756
757 if( (m_flags & mpALIGNMASK) == mpALIGN_NW )
758 {
759 tx = minDrawX + 8;
760 ty = maxDrawY + 8;
761 }
762 else if( (m_flags & mpALIGNMASK) == mpALIGN_NE )
763 {
764 tx = maxDrawX - tx - 8;
765 ty = maxDrawY + 8;
766 }
767 else if( (m_flags & mpALIGNMASK) == mpALIGN_SE )
768 {
769 tx = maxDrawX - tx - 8;
770 ty = minDrawY - ty - 8;
771 }
772 else
773 {
774 // mpALIGN_SW
775 tx = minDrawX + 8;
776 ty = minDrawY - ty - 8;
777 }
778 }
779
780 dc.DrawText( m_name, tx, ty );
781 }
782
783 dc.DestroyClippingRegion();
784}
mpScaleBase * m_scaleX
Definition: mathplot.h:635
wxCoord maxDrawY
Definition: mathplot.h:633
mpScaleBase * m_scaleY
Definition: mathplot.h:635
wxCoord maxDrawX
Definition: mathplot.h:633
virtual void Rewind()=0
Rewind value enumeration with mpFXY::GetNextXY.
virtual size_t GetCount() const =0
int m_flags
Definition: mathplot.h:630
void UpdateViewBoundary(wxCoord xnew, wxCoord ynew)
Update label positioning data.
Definition: mathplot.cpp:553
wxCoord minDrawX
Definition: mathplot.h:633
wxCoord minDrawY
Definition: mathplot.h:633
virtual bool GetNextXY(double &x, double &y)=0
Get locus value for next N.
bool m_showName
Definition: mathplot.h:319
virtual double TransformToPlot(double x) const
Definition: mathplot.h:776
int GetMarginLeft() const
Definition: mathplot.h:1379
int GetScrX(void) const
Get current view's X dimension in device context units.
Definition: mathplot.h:1140
wxCoord x2p(double x)
Converts graph (floating point) coordinates into mpWindow (screen) pixel coordinates,...
Definition: mathplot.h:1204
int GetMarginTop() const
Definition: mathplot.h:1373
wxCoord y2p(double y)
Converts graph (floating point) coordinates into mpWindow (screen) pixel coordinates,...
Definition: mathplot.h:1209
int GetMarginRight() const
Definition: mathplot.h:1375
int GetMarginBottom() const
Definition: mathplot.h:1377
int GetScrY(void) const
Get current view's Y dimension in device context units.
Definition: mathplot.h:1149
#define mpALIGN_NW
Aligns label to north-west.
Definition: mathplot.h:509
#define mpALIGNMASK
Definition: mathplot.h:475
#define mpALIGN_SE
Aligns label to south-east.
Definition: mathplot.h:513
#define mpALIGN_NE
Aligns label to north-east.
Definition: mathplot.h:507

References mpFXY::GetCount(), mpWindow::GetMarginBottom(), mpWindow::GetMarginLeft(), mpWindow::GetMarginRight(), mpWindow::GetMarginTop(), mpFXY::GetNextXY(), mpWindow::GetScrX(), mpWindow::GetScrY(), mpLayer::m_continuous, mpLayer::m_drawOutsideMargins, mpFXY::m_flags, mpLayer::m_font, mpLayer::m_name, mpLayer::m_pen, mpFXY::m_scaleX, mpFXY::m_scaleY, mpLayer::m_showName, mpLayer::m_visible, mpFXY::maxDrawX, mpFXY::maxDrawY, mpFXY::minDrawX, mpFXY::minDrawY, mpALIGN_NE, mpALIGN_NW, mpALIGN_SE, mpALIGNMASK, mpFXY::Rewind(), mpScaleBase::TransformToPlot(), mpFXY::UpdateViewBoundary(), mpWindow::x2p(), and mpWindow::y2p().

◆ Rewind()

void mpFXYVector::Rewind ( )
overrideprotectedvirtualinherited

Rewind value enumeration with mpFXY::GetNextXY.

Overridden in this implementation.

Implements mpFXY.

Definition at line 2897 of file mathplot.cpp.

2898{
2899 m_index = 0;
2900}

References mpFXYVector::m_index.

◆ s2x()

double mpFXY::s2x ( double  plotCoordX) const
inherited

Definition at line 3592 of file mathplot.cpp.

3593{
3594 return m_scaleX ? m_scaleX->TransformFromPlot( plotCoordX ) : plotCoordX;
3595}
virtual double TransformFromPlot(double xplot) const
Definition: mathplot.h:777

References mpFXY::m_scaleX, and mpScaleBase::TransformFromPlot().

Referenced by CURSOR::Plot().

◆ s2y()

double mpFXY::s2y ( double  plotCoordY) const
inherited

Definition at line 3598 of file mathplot.cpp.

3599{
3600 return m_scaleY ? m_scaleY->TransformFromPlot( plotCoordY ) : plotCoordY;
3601}

References mpFXY::m_scaleY, and mpScaleBase::TransformFromPlot().

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

◆ SetCursor()

void TRACE::SetCursor ( int  aCursorId,
CURSOR aCursor 
)
inline

Definition at line 169 of file sim_plot_panel.h.

169{ m_cursors[ aCursorId ] = aCursor; }

References m_cursors.

Referenced by SIM_PLOT_PANEL::EnableCursor(), and SIMULATOR_FRAME::parseTraceParams().

◆ SetData()

void TRACE::SetData ( const std::vector< double > &  aX,
const std::vector< double > &  aY 
)
inlineoverridevirtual

Assigns new data set for the trace.

aX and aY need to have the same length.

Parameters
aXare the X axis values.
aYare the Y axis values.

Reimplemented from mpFXYVector.

Definition at line 153 of file sim_plot_panel.h.

154 {
155 for( auto& [ idx, cursor ] : m_cursors )
156 {
157 if( cursor )
158 cursor->Update();
159 }
160
161 mpFXYVector::SetData( aX, aY );
162 }
virtual void SetData(const std::vector< double > &xs, const std::vector< double > &ys)
Changes the internal data: the set of points to draw.
Definition: mathplot.cpp:2930

References cursor, m_cursors, and mpFXYVector::SetData().

Referenced by SIM_PLOT_PANEL::SetTraceData().

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

◆ 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 TRACE::SetName ( wxString  name)
inlineoverridevirtual

Set layer name.

Parameters
nameName, will be copied to internal class member

Reimplemented from mpLayer.

Definition at line 136 of file sim_plot_panel.h.

137 {
138 for( auto& [ idx, cursor ] : m_cursors )
139 {
140 if( cursor )
141 cursor->SetName( aName );
142 }
143
144 mpFXYVector::SetName( aName );
145 }
virtual void SetName(wxString name)
Set layer name.
Definition: mathplot.h:267

References cursor, m_cursors, and mpLayer::SetName().

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

◆ SetScale()

void mpFXY::SetScale ( mpScaleBase scaleX,
mpScaleBase scaleY 
)
virtualinherited

Definition at line 3573 of file mathplot.cpp.

3574{
3575 m_scaleX = scaleX;
3576 m_scaleY = scaleY;
3577
3578 UpdateScales();
3579}
void UpdateScales()
Definition: mathplot.cpp:3582

References mpFXY::m_scaleX, mpFXY::m_scaleY, and mpFXY::UpdateScales().

Referenced by SIM_PLOT_PANEL::SetTraceData().

◆ SetTraceColour()

void TRACE::SetTraceColour ( const wxColour &  aColour)
inline

◆ 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; };

Referenced by TRACE().

◆ UpdateScales()

void mpFXY::UpdateScales ( )
inherited

Definition at line 3582 of file mathplot.cpp.

3583{
3584 if( m_scaleX )
3586
3587 if( m_scaleY )
3589}
virtual double GetMinY() const
Get inclusive bottom border of bounding box.
Definition: mathplot.h:185
virtual double GetMaxX() const
Get inclusive right border of bounding box.
Definition: mathplot.h:180
virtual double GetMinX() const
Get inclusive left border of bounding box.
Definition: mathplot.h:175
virtual double GetMaxY() const
Get inclusive top border of bounding box.
Definition: mathplot.h:190
void ExtendDataRange(double minV, double maxV)
Definition: mathplot.h:740

References mpScaleBase::ExtendDataRange(), mpLayer::GetMaxX(), mpLayer::GetMaxY(), mpLayer::GetMinX(), mpLayer::GetMinY(), mpFXY::m_scaleX, and mpFXY::m_scaleY.

Referenced by mpFXY::SetScale().

◆ UpdateViewBoundary()

void mpFXY::UpdateViewBoundary ( wxCoord  xnew,
wxCoord  ynew 
)
protectedinherited

Update label positioning data.

Parameters
xnewNew x coordinate
ynewNew y coordinate

Definition at line 553 of file mathplot.cpp.

554{
555 // Keep track of how many points have been drawn and the bounding box
556 maxDrawX = (xnew > maxDrawX) ? xnew : maxDrawX;
557 minDrawX = (xnew < minDrawX) ? xnew : minDrawX;
558 maxDrawY = (maxDrawY > ynew) ? maxDrawY : ynew;
559 minDrawY = (minDrawY < ynew) ? minDrawY : ynew;
560 // drawnPoints++;
561}

References mpFXY::maxDrawX, mpFXY::maxDrawY, mpFXY::minDrawX, and mpFXY::minDrawY.

Referenced by mpFXY::Plot().

◆ x2s()

double mpFXY::x2s ( double  x) const
inherited

Definition at line 3604 of file mathplot.cpp.

3605{
3606 return m_scaleX ? m_scaleX->TransformToPlot( x ) : x;
3607}

References mpFXY::m_scaleX, and mpScaleBase::TransformToPlot().

Referenced by CURSOR::Inside(), CURSOR::Plot(), CURSOR::SetCoordX(), and CURSOR::UpdateReference().

◆ y2s()

double mpFXY::y2s ( double  y) const
inherited

Definition at line 3610 of file mathplot.cpp.

3611{
3612 return m_scaleY ? m_scaleY->TransformToPlot( y ) : y;
3613}

References mpFXY::m_scaleY, and mpScaleBase::TransformToPlot().

Referenced by CURSOR::Inside(), CURSOR::Plot(), CURSOR::SetCoordX(), and CURSOR::UpdateReference().

Member Data Documentation

◆ 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_cursors

std::map<int, CURSOR*> TRACE::m_cursors
protected

Definition at line 179 of file sim_plot_panel.h.

Referenced by GetCursor(), GetCursors(), HasCursor(), SetCursor(), SetData(), and SetName().

◆ m_drawOutsideMargins

◆ m_flags

int mpFXY::m_flags
protectedinherited

Definition at line 630 of file mathplot.h.

Referenced by mpFXY::Plot().

◆ m_font

◆ m_index

size_t mpFXYVector::m_index
protectedinherited

The internal counter for the "GetNextXY" interface.

Definition at line 1599 of file mathplot.h.

Referenced by mpFXYVector::GetNextXY(), and mpFXYVector::Rewind().

◆ m_maxX

double mpFXYVector::m_maxX
protectedinherited

Definition at line 1603 of file mathplot.h.

Referenced by mpFXYVector::SetData().

◆ m_maxY

double mpFXYVector::m_maxY
protectedinherited

Definition at line 1603 of file mathplot.h.

Referenced by mpFXYVector::SetData().

◆ m_minX

double mpFXYVector::m_minX
protectedinherited

Loaded at SetData.

Definition at line 1603 of file mathplot.h.

Referenced by mpFXYVector::SetData().

◆ m_minY

double mpFXYVector::m_minY
protectedinherited

Definition at line 1603 of file mathplot.h.

Referenced by mpFXYVector::SetData().

◆ m_name

wxString mpLayer::m_name
protectedinherited

◆ m_pen

◆ m_scaleX

mpScaleBase* mpFXY::m_scaleX
protectedinherited

Definition at line 635 of file mathplot.h.

Referenced by mpFXY::Plot(), mpFXY::s2x(), mpFXY::SetScale(), mpFXY::UpdateScales(), and mpFXY::x2s().

◆ m_scaleY

mpScaleBase * mpFXY::m_scaleY
protectedinherited

Definition at line 635 of file mathplot.h.

Referenced by mpFXY::Plot(), mpFXY::s2y(), mpFXY::SetScale(), mpFXY::UpdateScales(), and mpFXY::y2s().

◆ m_showName

bool mpLayer::m_showName
protectedinherited

◆ m_traceColour

wxColour TRACE::m_traceColour
protected

Definition at line 181 of file sim_plot_panel.h.

Referenced by GetTraceColour(), and SetTraceColour().

◆ m_type

SIM_TRACE_TYPE TRACE::m_type
protected

Definition at line 180 of file sim_plot_panel.h.

Referenced by GetType().

◆ m_visible

◆ m_xs

std::vector<double> mpFXYVector::m_xs
protectedinherited

The internal copy of the set of data to draw.

Definition at line 1595 of file mathplot.h.

Referenced by mpFXYVector::Clear(), mpFXYVector::GetCount(), GetDataX(), mpFXYVector::GetNextXY(), and mpFXYVector::SetData().

◆ m_ys

std::vector<double> mpFXYVector::m_ys
protectedinherited

◆ maxDrawX

wxCoord mpFXY::maxDrawX
protectedinherited

Definition at line 633 of file mathplot.h.

Referenced by mpFXY::Plot(), and mpFXY::UpdateViewBoundary().

◆ maxDrawY

wxCoord mpFXY::maxDrawY
protectedinherited

Definition at line 633 of file mathplot.h.

Referenced by mpFXY::Plot(), and mpFXY::UpdateViewBoundary().

◆ minDrawX

wxCoord mpFXY::minDrawX
protectedinherited

Definition at line 633 of file mathplot.h.

Referenced by mpFXY::Plot(), and mpFXY::UpdateViewBoundary().

◆ minDrawY

wxCoord mpFXY::minDrawY
protectedinherited

Definition at line 633 of file mathplot.h.

Referenced by mpFXY::Plot(), and mpFXY::UpdateViewBoundary().


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