KiCad PCB EDA Suite
SIM_PLOT_PANEL Class Reference

#include <sim_plot_panel.h>

Inheritance diagram for SIM_PLOT_PANEL:
SIM_PANEL_BASE

Public Member Functions

 SIM_PLOT_PANEL (const wxString &aCommand, int aOptions, wxWindow *parent, SIM_PLOT_FRAME *aMainFrame, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=wxPanelNameStr)
 
virtual ~SIM_PLOT_PANEL ()
 set the pointer to the sim plot frame More...
 
void SetMasterFrame (SIM_PLOT_FRAME *aFrame)
 
wxString GetLabelX () const
 
wxString GetLabelY1 () const
 
wxString GetLabelY2 () const
 
bool TraceShown (const wxString &aName) const
 
const std::map< wxString, TRACE * > & GetTraces () const
 
TRACEGetTrace (const wxString &aName) const
 
void ShowGrid (bool aEnable)
 
bool IsGridShown () const
 
void ShowLegend (bool aEnable)
 
bool IsLegendShown () const
 
void SetDottedCurrentPhase (bool aEnable)
 
bool GetDottedCurrentPhase () const
 Toggle cursor for a particular trace. More...
 
void EnableCursor (const wxString &aName, bool aEnable)
 Reset scale ranges to fit the current traces. More...
 
void ResetScales ()
 Update trace line style. More...
 
void UpdateTraceStyle (TRACE *trace)
 
void UpdatePlotColors ()
 

‍Update plot colors

More...
 
mpWindowGetPlotWin () const
 
SIM_TYPE GetType () const
 

Static Public Member Functions

static bool IsPlottable (SIM_TYPE aSimType)
 

Protected Member Functions

bool addTrace (const wxString &aTitle, const wxString &aName, int aPoints, const double *aX, const double *aY, SIM_PLOT_TYPE aType)
 
bool deleteTrace (const wxString &aName)
 
const wxString & getSimCommand () const
 
void setSimCommand (const wxString &aSimCommand)
 
const int getSimOptions () const
 
void setSimOptions (int aOptions)
 

Private Member Functions

void prepareDCAxes ()
 < More...
 
void updateAxes ()
 

‍Create/Ensure axes are available for plotting

More...
 

Private Attributes

SIM_PLOT_COLORS m_colors
 
mpWindowm_plotWin
 
wxBoxSizer * m_sizer
 
std::map< wxString, TRACE * > m_traces
 
mpScaleXBasem_axis_x
 
mpScaleYm_axis_y1
 
mpScaleYm_axis_y2
 
mpInfoLegendm_legend
 
bool m_dotted_cp
 
std::vector< mpLayer * > m_topLevel
 
SIM_PLOT_FRAMEm_masterFrame
 
wxString m_simCommand
 
int m_simOptions
 

Friends

class SIM_WORKBOOK
 

Detailed Description

Definition at line 181 of file sim_plot_panel.h.

Constructor & Destructor Documentation

◆ SIM_PLOT_PANEL()

SIM_PLOT_PANEL::SIM_PLOT_PANEL ( const wxString &  aCommand,
int  aOptions,
wxWindow *  parent,
SIM_PLOT_FRAME aMainFrame,
wxWindowID  id,
const wxPoint &  pos = wxDefaultPosition,
const wxSize &  size = wxDefaultSize,
long  style = 0,
const wxString &  name = wxPanelNameStr 
)

Definition at line 304 of file sim_plot_panel.cpp.

307 : SIM_PANEL_BASE( aCommand, aOptions, parent, id, pos, size, style, name ),
308 m_axis_x( nullptr ),
309 m_axis_y1( nullptr ),
310 m_axis_y2( nullptr ),
311 m_dotted_cp( false ),
312 m_masterFrame( aMainFrame )
313{
314 m_sizer = new wxBoxSizer( wxVERTICAL );
315 m_plotWin = new mpWindow( this, wxID_ANY, pos, size, style );
316
317 m_plotWin->LimitView( true );
318 m_plotWin->SetMargins( 50, 80, 50, 80 );
319
321
322 updateAxes();
323
324 // a mpInfoLegend displays le name of traces on the left top panel corner:
325 m_legend = new mpInfoLegend( wxRect( 0, 40, 200, 40 ), wxTRANSPARENT_BRUSH );
326 m_legend->SetVisible( false );
328
331
332 m_sizer->Add( m_plotWin, 1, wxALL | wxEXPAND, 1 );
333 SetSizer( m_sizer );
334}
const char * name
Definition: DXF_plotter.cpp:56
mpScaleY * m_axis_y1
void UpdatePlotColors()
‍Update plot colors
wxBoxSizer * m_sizer
mpInfoLegend * m_legend
void updateAxes()
‍Create/Ensure axes are available for plotting
mpScaleXBase * m_axis_x
SIM_PLOT_FRAME * m_masterFrame
mpWindow * m_plotWin
mpScaleY * m_axis_y2
Implements the legend to be added to the plot This layer allows you to add a legend to describe the p...
Definition: mathplot.h:438
void SetVisible(bool show)
Sets layer visibility.
Definition: mathplot.h:302
void SetMargins(int top, int right, int bottom, int left)
Set window margins, creating a blank area where some kinds of layers cannot draw.
Definition: mathplot.cpp:2716
void LimitView(bool aEnable)
Limit zooming & panning to the area used by the plots.
Definition: mathplot.h:1429
void UpdateAll()
Refresh display.
Definition: mathplot.cpp:2437
void EnableDoubleBuffer(bool enabled)
Enable/disable the double-buffering of the window, eliminating the flicker (default=disabled).
Definition: mathplot.h:1212
bool AddLayer(mpLayer *layer, bool refreshDisplay=true)
Add a plot layer to the canvas.
Definition: mathplot.cpp:2278
class WXDLLIMPEXP_MATHPLOT mpWindow
Definition: mathplot.h:108

References mpWindow::AddLayer(), mpWindow::EnableDoubleBuffer(), mpWindow::LimitView(), m_legend, m_plotWin, m_sizer, mpWindow, mpWindow::SetMargins(), mpLayer::SetVisible(), mpWindow::UpdateAll(), updateAxes(), and UpdatePlotColors().

◆ ~SIM_PLOT_PANEL()

SIM_PLOT_PANEL::~SIM_PLOT_PANEL ( )
virtual

set the pointer to the sim plot frame

Definition at line 337 of file sim_plot_panel.cpp.

338{
339 // ~mpWindow destroys all the added layers, so there is no need to destroy m_traces contents
340}

Member Function Documentation

◆ addTrace()

bool SIM_PLOT_PANEL::addTrace ( const wxString &  aTitle,
const wxString &  aName,
int  aPoints,
const double *  aX,
const double *  aY,
SIM_PLOT_TYPE  aType 
)
protected

Definition at line 475 of file sim_plot_panel.cpp.

477{
478 TRACE* trace = nullptr;
479
480 updateAxes();
481
482 // Find previous entry, if there is one
483 auto prev = m_traces.find( aTitle );
484 bool addedNewEntry = ( prev == m_traces.end() );
485
486 if( addedNewEntry )
487 {
488 if( GetType() == ST_TRANSIENT )
489 {
490 bool hasVoltageTraces = false;
491
492 for( const auto& tr : m_traces )
493 {
494 if( !( tr.second->GetType() & SPT_CURRENT ) )
495 {
496 hasVoltageTraces = true;
497 break;
498 }
499 }
500
501 if( !hasVoltageTraces )
502 m_axis_y2->SetMasterScale( nullptr );
503 else
505 }
506
507 // New entry
508 trace = new TRACE( aName, aType );
510 UpdateTraceStyle( trace );
511 m_traces[ aTitle ] = trace;
512
513 // It is a trick to keep legend & coords always on the top
514 for( mpLayer* l : m_topLevel )
515 m_plotWin->DelLayer( l );
516
517 m_plotWin->AddLayer( (mpLayer*) trace );
518
519 for( mpLayer* l : m_topLevel )
520 m_plotWin->AddLayer( l );
521 }
522 else
523 {
524 trace = prev->second;
525 }
526
527 std::vector<double> tmp( aY, aY + aPoints );
528
529 if( GetType() == ST_AC )
530 {
531 if( aType & SPT_AC_PHASE )
532 {
533 for( int i = 0; i < aPoints; i++ )
534 tmp[i] = tmp[i] * 180.0 / M_PI; // convert to degrees
535 }
536 else
537 {
538 for( int i = 0; i < aPoints; i++ )
539 {
540 // log( 0 ) is not valid.
541 if( tmp[i] != 0 )
542 tmp[i] = 20 * log( tmp[i] ) / log( 10.0 ); // convert to dB
543 }
544 }
545 }
546
547 trace->SetData( std::vector<double>( aX, aX + aPoints ), tmp );
548
549 if( ( aType & SPT_AC_PHASE ) || ( aType & SPT_CURRENT ) )
550 trace->SetScale( m_axis_x, m_axis_y2 );
551 else
552 trace->SetScale( m_axis_x, m_axis_y1 );
553
555
556 return addedNewEntry;
557}
SIM_TYPE GetType() const
wxColour GenerateColor(std::map< wxString, TRACE * > aTraces)
SIM_PLOT_COLORS m_colors
void UpdateTraceStyle(TRACE *trace)
std::map< wxString, TRACE * > m_traces
std::vector< mpLayer * > m_topLevel
void SetTraceColour(wxColour aColour)
void SetMasterScale(mpScaleY *masterScale)
Definition: mathplot.h:979
bool DelLayer(mpLayer *layer, bool alsoDeleteObject=false, bool refreshDisplay=true)
Remove a plot layer from the canvas.
Definition: mathplot.cpp:2295
@ SPT_AC_PHASE
Definition: sim_types.h:51
@ SPT_CURRENT
Definition: sim_types.h:50
@ ST_TRANSIENT
Definition: sim_types.h:42
@ ST_AC
Definition: sim_types.h:34

References mpWindow::AddLayer(), mpWindow::DelLayer(), SIM_PLOT_COLORS::GenerateColor(), SIM_PANEL_BASE::GetType(), m_axis_x, m_axis_y1, m_axis_y2, m_colors, m_plotWin, m_topLevel, m_traces, TRACE::SetData(), mpScaleY::SetMasterScale(), mpFXY::SetScale(), TRACE::SetTraceColour(), SPT_AC_PHASE, SPT_CURRENT, ST_AC, ST_TRANSIENT, mpWindow::UpdateAll(), updateAxes(), and UpdateTraceStyle().

Referenced by SIM_WORKBOOK::AddTrace().

◆ deleteTrace()

bool SIM_PLOT_PANEL::deleteTrace ( const wxString &  aName)
protected

Definition at line 560 of file sim_plot_panel.cpp.

561{
562 auto it = m_traces.find( aName );
563
564 if( it != m_traces.end() )
565 {
566 TRACE* trace = it->second;
567 m_traces.erase( it );
568
569 if( CURSOR* cursor = trace->GetCursor() )
570 m_plotWin->DelLayer( cursor, true );
571
572 m_plotWin->DelLayer( trace, true, true );
573 ResetScales();
574
575 return true;
576 }
577
578 return false;
579}
Cursor attached to a trace to follow its values:
void ResetScales()
Update trace line style.
CURSOR * GetCursor() const

References cursor, mpWindow::DelLayer(), TRACE::GetCursor(), m_plotWin, m_traces, and ResetScales().

Referenced by SIM_WORKBOOK::DeleteTrace().

◆ EnableCursor()

void SIM_PLOT_PANEL::EnableCursor ( const wxString &  aName,
bool  aEnable 
)

Reset scale ranges to fit the current traces.

Definition at line 582 of file sim_plot_panel.cpp.

583{
584 TRACE* t = GetTrace( aName );
585
586 if( t == nullptr || t->HasCursor() == aEnable )
587 return;
588
589 if( aEnable )
590 {
591 CURSOR* c = new CURSOR( t, this );
592 int plotCenter = GetPlotWin()->GetMarginLeft()
595 / 2;
596 c->SetX( plotCenter );
598 t->SetCursor( c );
599 m_plotWin->AddLayer( c );
600 }
601 else
602 {
603 CURSOR* c = t->GetCursor();
604 t->SetCursor( nullptr );
605 m_plotWin->DelLayer( c, true );
606 }
607
608 // Notify the parent window about the changes
609 wxQueueEvent( GetParent(), new wxCommandEvent( EVT_SIM_CURSOR_UPDATE ) );
610}
void SetX(int aX)
wxColour GetPlotColor(enum COLOR_SET aColorId)
TRACE * GetTrace(const wxString &aName) const
mpWindow * GetPlotWin() const
void SetCursor(CURSOR *aCursor)
bool HasCursor() const
void SetPen(wxPen pen)
Set layer pen.
Definition: mathplot.h:277
int GetMarginLeft() const
Definition: mathplot.h:1377
int GetXScreen(void) const
Definition: mathplot.h:1139
int GetMarginRight() const
Definition: mathplot.h:1373

References mpWindow::AddLayer(), SIM_PLOT_COLORS::CURSOR, mpWindow::DelLayer(), TRACE::GetCursor(), mpWindow::GetMarginLeft(), mpWindow::GetMarginRight(), SIM_PLOT_COLORS::GetPlotColor(), GetPlotWin(), GetTrace(), mpWindow::GetXScreen(), TRACE::HasCursor(), m_colors, m_plotWin, TRACE::SetCursor(), mpLayer::SetPen(), and CURSOR::SetX().

◆ GetDottedCurrentPhase()

bool SIM_PLOT_PANEL::GetDottedCurrentPhase ( ) const
inline

Toggle cursor for a particular trace.

Definition at line 271 of file sim_plot_panel.h.

References m_dotted_cp.

◆ GetLabelX()

wxString SIM_PLOT_PANEL::GetLabelX ( ) const
inline

Definition at line 199 of file sim_plot_panel.h.

200 {
201 return m_axis_x ? m_axis_x->GetName() : "";
202 }
const wxString & GetName() const
Get layer name.
Definition: mathplot.h:238

References mpLayer::GetName(), and m_axis_x.

Referenced by SIM_PLOT_FRAME::onCursorUpdate().

◆ GetLabelY1()

wxString SIM_PLOT_PANEL::GetLabelY1 ( ) const
inline

Definition at line 204 of file sim_plot_panel.h.

205 {
206 return m_axis_y1 ? m_axis_y1->GetName() : "";
207 }

References mpLayer::GetName(), and m_axis_y1.

Referenced by SIM_PLOT_FRAME::onCursorUpdate().

◆ GetLabelY2()

wxString SIM_PLOT_PANEL::GetLabelY2 ( ) const
inline

Definition at line 209 of file sim_plot_panel.h.

210 {
211 return m_axis_y2 ? m_axis_y2->GetName() : "";
212 }

References mpLayer::GetName(), and m_axis_y2.

Referenced by SIM_PLOT_FRAME::onCursorUpdate().

◆ GetPlotWin()

◆ getSimCommand()

const wxString & SIM_PANEL_BASE::getSimCommand ( ) const
inlineprotectedinherited

Definition at line 56 of file sim_panel_base.h.

56{ return m_simCommand; }
wxString m_simCommand

References SIM_PANEL_BASE::m_simCommand.

Referenced by SIM_WORKBOOK::GetSimCommand(), and prepareDCAxes().

◆ getSimOptions()

const int SIM_PANEL_BASE::getSimOptions ( ) const
inlineprotectedinherited

Definition at line 66 of file sim_panel_base.h.

66{ return m_simOptions; }

References SIM_PANEL_BASE::m_simOptions.

Referenced by SIM_WORKBOOK::GetSimOptions().

◆ GetTrace()

TRACE * SIM_PLOT_PANEL::GetTrace ( const wxString &  aName) const
inline

Definition at line 224 of file sim_plot_panel.h.

225 {
226 auto trace = m_traces.find( aName );
227
228 return trace == m_traces.end() ? nullptr : trace->second;
229 }

References m_traces.

Referenced by EnableCursor().

◆ GetTraces()

const std::map< wxString, TRACE * > & SIM_PLOT_PANEL::GetTraces ( ) const
inline

◆ GetType()

◆ IsGridShown()

bool SIM_PLOT_PANEL::IsGridShown ( ) const
inline

Definition at line 239 of file sim_plot_panel.h.

240 {
241 if( !m_axis_x || !m_axis_y1 )
242 return false;
243
244 assert( m_axis_x->GetTicks() == m_axis_y1->GetTicks() );
245 return !m_axis_x->GetTicks();
246 }
bool GetTicks() const
Get X axis ticks or grid.
Definition: mathplot.h:719
bool GetTicks() const
Get Y axis ticks or grid.
Definition: mathplot.h:973

References mpScaleBase::GetTicks(), mpScaleY::GetTicks(), m_axis_x, and m_axis_y1.

◆ IsLegendShown()

bool SIM_PLOT_PANEL::IsLegendShown ( ) const
inline

Definition at line 254 of file sim_plot_panel.h.

255 {
256 return m_legend->IsVisible();
257 }
bool IsVisible() const
Checks whether the layer is visible or not.
Definition: mathplot.h:298

References mpLayer::IsVisible(), and m_legend.

◆ IsPlottable()

bool SIM_PANEL_BASE::IsPlottable ( SIM_TYPE  aSimType)
staticinherited

Definition at line 55 of file sim_panel_base.cpp.

56{
57 switch( aSimType )
58 {
59 case ST_AC:
60 case ST_DC:
61 case ST_TRANSIENT:
62 return true;
63
64 default:
65 return false;
66 }
67}
@ ST_DC
Definition: sim_types.h:35

References ST_AC, ST_DC, and ST_TRANSIENT.

Referenced by SIM_PLOT_FRAME::addPlot(), SIM_PLOT_FRAME::menuNewPlot(), SIM_PLOT_FRAME::NewPlotPanel(), SIM_PLOT_FRAME::onSimFinished(), and SIM_PLOT_FRAME::updatePlot().

◆ prepareDCAxes()

void SIM_PLOT_PANEL::prepareDCAxes ( )
private

<

Construct the plot axes for DC simulation plot.

Definition at line 401 of file sim_plot_panel.cpp.

402{
403 wxString sim_cmd = getSimCommand().Lower();
404 wxString rem;
405
406 if( sim_cmd.StartsWith( ".dc", &rem ) )
407 {
408 wxChar ch;
409
410 rem.Trim( false );
411
412 try
413 {
414 ch = rem.GetChar( 0 );
415 }
416 catch( ... )
417 {;}
418
419 switch( ch )
420 {
421 // Make sure that we have a reliable default (even if incorrectly labeled)
422 default:
423 case 'v':
424 m_axis_x = new LIN_SCALE<mpScaleX>( _( "Voltage (swept)" ), wxT( "V" ),
426 break;
427 case 'i':
428 m_axis_x = new LIN_SCALE<mpScaleX>( _( "Current (swept)" ), wxT( "A" ),
430 break;
431 case 'r':
432 m_axis_x = new LIN_SCALE<mpScaleX>( _( "Resistance (swept)" ), wxT( "Ω" ),
434 break;
435 case 't':
436 m_axis_x = new LIN_SCALE<mpScaleX>( _( "Temperature (swept)" ), wxT( "°C" ),
438 break;
439 }
440
441 m_axis_y1 = new LIN_SCALE<mpScaleY>( _( "Voltage (measured)" ), wxT( "V" ), mpALIGN_LEFT );
442 m_axis_y2 = new LIN_SCALE<mpScaleY>( _( "Current" ), wxT( "A" ), mpALIGN_RIGHT );
443 }
444}
const wxString & getSimCommand() const
#define _(s)
#define mpALIGN_RIGHT
Aligns label to the right.
Definition: mathplot.h:477
#define mpALIGN_LEFT
Aligns label to the left.
Definition: mathplot.h:481
#define mpALIGN_BOTTOM
Aligns label to the bottom.
Definition: mathplot.h:485

References _, SIM_PANEL_BASE::getSimCommand(), m_axis_x, m_axis_y1, m_axis_y2, mpALIGN_BOTTOM, mpALIGN_LEFT, and mpALIGN_RIGHT.

Referenced by updateAxes().

◆ ResetScales()

void SIM_PLOT_PANEL::ResetScales ( )

Update trace line style.

Definition at line 613 of file sim_plot_panel.cpp.

614{
615 if( m_axis_x )
617
618 if( m_axis_y1 )
620
621 if( m_axis_y2 )
623
624 for( auto& [ name, trace ] : m_traces )
625 trace->UpdateScales();
626}
void ResetDataRange()
Definition: mathplot.h:759

References m_axis_x, m_axis_y1, m_axis_y2, m_traces, name, and mpScaleBase::ResetDataRange().

Referenced by deleteTrace(), and SIM_PLOT_FRAME::onSimFinished().

◆ SetDottedCurrentPhase()

void SIM_PLOT_PANEL::SetDottedCurrentPhase ( bool  aEnable)
inline

Definition at line 259 of file sim_plot_panel.h.

260 {
261 m_dotted_cp = aEnable;
262
263 for( const auto& tr : m_traces )
264 {
265 UpdateTraceStyle( tr.second );
266 }
267
269 }

References m_dotted_cp, m_plotWin, m_traces, mpWindow::UpdateAll(), and UpdateTraceStyle().

◆ SetMasterFrame()

void SIM_PLOT_PANEL::SetMasterFrame ( SIM_PLOT_FRAME aFrame)
inline

Definition at line 194 of file sim_plot_panel.h.

195 {
196 m_masterFrame = aFrame;
197 }

References m_masterFrame.

◆ setSimCommand()

void SIM_PANEL_BASE::setSimCommand ( const wxString &  aSimCommand)
inlineprotectedinherited

Definition at line 58 of file sim_panel_base.h.

59 {
60 wxCHECK_RET( GetType() == NGSPICE_CIRCUIT_MODEL::CommandToSimType( aSimCommand ),
61 "Cannot change the type of simulation of the existing plot panel" );
62
63 m_simCommand = aSimCommand;
64 }

References NGSPICE_CIRCUIT_MODEL::CommandToSimType(), SIM_PANEL_BASE::GetType(), and SIM_PANEL_BASE::m_simCommand.

Referenced by SIM_WORKBOOK::SetSimCommand().

◆ setSimOptions()

void SIM_PANEL_BASE::setSimOptions ( int  aOptions)
inlineprotectedinherited

Definition at line 67 of file sim_panel_base.h.

67{ m_simOptions = aOptions; }

References SIM_PANEL_BASE::m_simOptions.

Referenced by SIM_WORKBOOK::SetSimOptions().

◆ ShowGrid()

void SIM_PLOT_PANEL::ShowGrid ( bool  aEnable)
inline

Definition at line 231 of file sim_plot_panel.h.

232 {
233 m_axis_x->SetTicks( !aEnable );
234 m_axis_y1->SetTicks( !aEnable );
235 m_axis_y2->SetTicks( !aEnable );
237 }
void SetTicks(bool enable)
Set X axis ticks or grid.
Definition: mathplot.h:714
void SetTicks(bool ticks)
Set Y axis ticks or grid.
Definition: mathplot.h:969

References m_axis_x, m_axis_y1, m_axis_y2, m_plotWin, mpScaleBase::SetTicks(), mpScaleY::SetTicks(), and mpWindow::UpdateAll().

◆ ShowLegend()

void SIM_PLOT_PANEL::ShowLegend ( bool  aEnable)
inline

Definition at line 248 of file sim_plot_panel.h.

249 {
250 m_legend->SetVisible( aEnable );
252 }

References m_legend, m_plotWin, mpLayer::SetVisible(), and mpWindow::UpdateAll().

◆ TraceShown()

bool SIM_PLOT_PANEL::TraceShown ( const wxString &  aName) const
inline

Definition at line 214 of file sim_plot_panel.h.

215 {
216 return m_traces.count( aName ) > 0;
217 }

References m_traces.

Referenced by SIM_PLOT_FRAME::removePlot().

◆ updateAxes()

void SIM_PLOT_PANEL::updateAxes ( )
private

‍Create/Ensure axes are available for plotting

Definition at line 343 of file sim_plot_panel.cpp.

344{
345 if( m_axis_x )
346 return;
347
348 switch( GetType() )
349 {
350 case ST_AC:
351 m_axis_x = new LOG_SCALE<mpScaleXLog>( _( "Frequency" ), wxT( "Hz" ), mpALIGN_BOTTOM );
352 m_axis_y1 = new LIN_SCALE<mpScaleY>( _( "Gain" ), wxT( "dBV" ), mpALIGN_LEFT );
353 m_axis_y2 = new LIN_SCALE<mpScaleY>( _( "Phase" ), wxT( "°" ), mpALIGN_RIGHT );
355 break;
356
357 case ST_DC:
359 break;
360
361 case ST_NOISE:
362 m_axis_x = new LOG_SCALE<mpScaleXLog>( _( "Frequency" ), wxT( "Hz" ), mpALIGN_BOTTOM );
363 m_axis_y1 = new mpScaleY( _( "noise [(V or A)^2/Hz]" ), mpALIGN_LEFT );
364 break;
365
366 case ST_TRANSIENT:
367 m_axis_x = new LIN_SCALE<mpScaleX>( _( "Time" ), wxT( "s" ), mpALIGN_BOTTOM );
368 m_axis_y1 = new LIN_SCALE<mpScaleY>( _( "Voltage" ), wxT( "V" ), mpALIGN_LEFT );
369 m_axis_y2 = new LIN_SCALE<mpScaleY>( _( "Current" ), wxT( "A" ), mpALIGN_RIGHT );
371 break;
372
373 default:
374 // suppress warnings
375 break;
376 }
377
378 if( m_axis_x )
379 {
380 m_axis_x->SetTicks( false );
382
384 }
385
386 if( m_axis_y1 )
387 {
388 m_axis_y1->SetTicks( false );
391 }
392
393 if( m_axis_y2 )
394 {
395 m_axis_y2->SetTicks( false );
398 }
399}
void SetNameAlign(int align)
Definition: mathplot.h:709
class WXDLLIMPEXP_MATHPLOT mpScaleY
Definition: mathplot.h:107
@ ST_NOISE
Definition: sim_types.h:37

References _, mpWindow::AddLayer(), SIM_PANEL_BASE::GetType(), m_axis_x, m_axis_y1, m_axis_y2, m_plotWin, mpALIGN_BOTTOM, mpALIGN_LEFT, mpALIGN_RIGHT, mpScaleY, prepareDCAxes(), mpScaleY::SetMasterScale(), mpScaleBase::SetNameAlign(), mpScaleBase::SetTicks(), mpScaleY::SetTicks(), ST_AC, ST_DC, ST_NOISE, and ST_TRANSIENT.

Referenced by addTrace(), and SIM_PLOT_PANEL().

◆ UpdatePlotColors()

void SIM_PLOT_PANEL::UpdatePlotColors ( )

‍Update plot colors

Getter for math plot window

Definition at line 447 of file sim_plot_panel.cpp.

448{
449 // Update bg and fg colors:
453
454 // Update color of all traces
455 for( auto& [ name, trace ] : m_traces )
456 {
457 if( CURSOR* cursor = trace->GetCursor() )
459 }
460
462}
void SetColourTheme(const wxColour &bgColour, const wxColour &drawColour, const wxColour &axesColour)
Set Color theme.
Definition: mathplot.cpp:2782

References SIM_PLOT_COLORS::AXIS, SIM_PLOT_COLORS::BACKGROUND, SIM_PLOT_COLORS::CURSOR, cursor, SIM_PLOT_COLORS::FOREGROUND, SIM_PLOT_COLORS::GetPlotColor(), m_colors, m_plotWin, m_traces, name, mpWindow::SetColourTheme(), and mpWindow::UpdateAll().

Referenced by SIM_PLOT_FRAME::menuWhiteBackground(), and SIM_PLOT_PANEL().

◆ UpdateTraceStyle()

void SIM_PLOT_PANEL::UpdateTraceStyle ( TRACE trace)

Definition at line 465 of file sim_plot_panel.cpp.

466{
467 int type = trace->GetType();
468 wxPenStyle penStyle = ( ( ( type & SPT_AC_PHASE ) || ( type & SPT_CURRENT ) ) && m_dotted_cp )
469 ? wxPENSTYLE_DOT
470 : wxPENSTYLE_SOLID;
471 trace->SetPen( wxPen( trace->GetTraceColour(), 2, penStyle ) );
472}
wxColour GetTraceColour()
SIM_PLOT_TYPE GetType() const

References TRACE::GetTraceColour(), TRACE::GetType(), m_dotted_cp, mpLayer::SetPen(), SPT_AC_PHASE, and SPT_CURRENT.

Referenced by addTrace(), and SetDottedCurrentPhase().

Friends And Related Function Documentation

◆ SIM_WORKBOOK

friend class SIM_WORKBOOK
friend

Definition at line 183 of file sim_plot_panel.h.

Member Data Documentation

◆ m_axis_x

mpScaleXBase* SIM_PLOT_PANEL::m_axis_x
private

◆ m_axis_y1

mpScaleY* SIM_PLOT_PANEL::m_axis_y1
private

◆ m_axis_y2

mpScaleY* SIM_PLOT_PANEL::m_axis_y2
private

Definition at line 318 of file sim_plot_panel.h.

Referenced by addTrace(), GetLabelY2(), prepareDCAxes(), ResetScales(), ShowGrid(), and updateAxes().

◆ m_colors

SIM_PLOT_COLORS SIM_PLOT_PANEL::m_colors
private

Definition at line 307 of file sim_plot_panel.h.

Referenced by addTrace(), EnableCursor(), and UpdatePlotColors().

◆ m_dotted_cp

bool SIM_PLOT_PANEL::m_dotted_cp
private

◆ m_legend

mpInfoLegend* SIM_PLOT_PANEL::m_legend
private

Definition at line 319 of file sim_plot_panel.h.

Referenced by IsLegendShown(), ShowLegend(), and SIM_PLOT_PANEL().

◆ m_masterFrame

SIM_PLOT_FRAME* SIM_PLOT_PANEL::m_masterFrame
private

Definition at line 325 of file sim_plot_panel.h.

Referenced by SetMasterFrame().

◆ m_plotWin

◆ m_simCommand

wxString SIM_PANEL_BASE::m_simCommand
privateinherited

◆ m_simOptions

int SIM_PANEL_BASE::m_simOptions
privateinherited

◆ m_sizer

wxBoxSizer* SIM_PLOT_PANEL::m_sizer
private

Definition at line 311 of file sim_plot_panel.h.

Referenced by SIM_PLOT_PANEL().

◆ m_topLevel

std::vector<mpLayer*> SIM_PLOT_PANEL::m_topLevel
private

Definition at line 323 of file sim_plot_panel.h.

Referenced by addTrace().

◆ m_traces

std::map<wxString, TRACE*> SIM_PLOT_PANEL::m_traces
private

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