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, 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
 Returns true if the trace has cursor shown. More...
 
bool HasCursorEnabled (const wxString &aName) 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)
 
void deleteAllTraces ()
 
const wxString & getSimCommand () const
 
void setSimCommand (const wxString &aSimCommand)
 

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
 

Friends

class SIM_WORKBOOK
 

Detailed Description

Definition at line 176 of file sim_plot_panel.h.

Constructor & Destructor Documentation

◆ SIM_PLOT_PANEL()

SIM_PLOT_PANEL::SIM_PLOT_PANEL ( const wxString &  aCommand,
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 301 of file sim_plot_panel.cpp.

304 : SIM_PANEL_BASE( aCommand, parent, id, pos, size, style, name ),
305 m_axis_x( nullptr ),
306 m_axis_y1( nullptr ),
307 m_axis_y2( nullptr ),
308 m_dotted_cp( false ),
309 m_masterFrame( aMainFrame )
310{
311 m_sizer = new wxBoxSizer( wxVERTICAL );
312 m_plotWin = new mpWindow( this, wxID_ANY, pos, size, style );
313
314 m_plotWin->LimitView( true );
315 m_plotWin->SetMargins( 50, 80, 50, 80 );
316
318
319 updateAxes();
320
321 // a mpInfoLegend displays le name of traces on the left top panel corner:
322 m_legend = new mpInfoLegend( wxRect( 0, 40, 200, 40 ), wxTRANSPARENT_BRUSH );
323 m_legend->SetVisible( false );
325
328
329 m_sizer->Add( m_plotWin, 1, wxALL | wxEXPAND, 1 );
330 SetSizer( m_sizer );
331}
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:2682
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:2403
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:2256
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 334 of file sim_plot_panel.cpp.

335{
336 // ~mpWindow destroys all the added layers, so there is no need to destroy m_traces contents
337}

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 472 of file sim_plot_panel.cpp.

474{
475 TRACE* trace = nullptr;
476 wxString name = aTitle;
477
478 updateAxes();
479
480 // Find previous entry, if there is one
481 auto prev = m_traces.find( name );
482 bool addedNewEntry = ( prev == m_traces.end() );
483
484 if( addedNewEntry )
485 {
486 if( GetType() == ST_TRANSIENT )
487 {
488 bool hasVoltageTraces = false;
489
490 for( const auto& tr : m_traces )
491 {
492 if( !( tr.second->GetType() & SPT_CURRENT ) )
493 {
494 hasVoltageTraces = true;
495 break;
496 }
497 }
498
499 if( !hasVoltageTraces )
500 m_axis_y2->SetMasterScale( nullptr );
501 else
503 }
504
505 // New entry
506 trace = new TRACE( aName, aType );
508 UpdateTraceStyle( trace );
509 m_traces[name] = trace;
510
511 // It is a trick to keep legend & coords always on the top
512 for( mpLayer* l : m_topLevel )
513 m_plotWin->DelLayer( l );
514
515 m_plotWin->AddLayer( (mpLayer*) trace );
516
517 for( mpLayer* l : m_topLevel )
518 m_plotWin->AddLayer( l );
519 }
520 else
521 {
522 trace = prev->second;
523 }
524
525 std::vector<double> tmp( aY, aY + aPoints );
526
527 if( GetType() == ST_AC )
528 {
529 if( aType & SPT_AC_PHASE )
530 {
531 for( int i = 0; i < aPoints; i++ )
532 tmp[i] = tmp[i] * 180.0 / M_PI; // convert to degrees
533 }
534 else
535 {
536 for( int i = 0; i < aPoints; i++ )
537 {
538 // log( 0 ) is not valid.
539 if( tmp[i] != 0 )
540 tmp[i] = 20 * log( tmp[i] ) / log( 10.0 ); // convert to dB
541 }
542 }
543 }
544
545 trace->SetData( std::vector<double>( aX, aX + aPoints ), tmp );
546
547 if( ( aType & SPT_AC_PHASE ) || ( aType & SPT_CURRENT ) )
548 trace->SetScale( m_axis_x, m_axis_y2 );
549 else
550 trace->SetScale( m_axis_x, m_axis_y1 );
551
553
554 return addedNewEntry;
555}
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:2273
@ 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, name, 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().

◆ deleteAllTraces()

void SIM_PLOT_PANEL::deleteAllTraces ( )
protected

Definition at line 580 of file sim_plot_panel.cpp.

581{
582 for( auto& t : m_traces )
583 {
584 deleteTrace( t.first );
585 }
586
587 m_traces.clear();
588}
bool deleteTrace(const wxString &aName)

References deleteTrace(), and m_traces.

◆ deleteTrace()

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

Definition at line 558 of file sim_plot_panel.cpp.

559{
560 auto it = m_traces.find( aName );
561
562 if( it != m_traces.end() )
563 {
564 TRACE* trace = it->second;
565 m_traces.erase( it );
566
567 if( CURSOR* cursor = trace->GetCursor() )
568 m_plotWin->DelLayer( cursor, true );
569
570 m_plotWin->DelLayer( trace, true, true );
571 ResetScales();
572
573 return true;
574 }
575
576 return false;
577}
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 deleteAllTraces(), and 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 599 of file sim_plot_panel.cpp.

600{
601 TRACE* t = GetTrace( aName );
602
603 if( t == nullptr || t->HasCursor() == aEnable )
604 return;
605
606 if( aEnable )
607 {
608 CURSOR* c = new CURSOR( t, this );
609 int plotCenter = GetPlotWin()->GetMarginLeft()
612 / 2;
613 c->SetX( plotCenter );
615 t->SetCursor( c );
616 m_plotWin->AddLayer( c );
617 }
618 else
619 {
620 CURSOR* c = t->GetCursor();
621 t->SetCursor( nullptr );
622 m_plotWin->DelLayer( c, true );
623 }
624
625 // Notify the parent window about the changes
626 wxQueueEvent( GetParent(), new wxCommandEvent( EVT_SIM_CURSOR_UPDATE ) );
627}
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

Returns true if the trace has cursor shown.

Definition at line 266 of file sim_plot_panel.h.

References m_dotted_cp.

◆ GetLabelX()

wxString SIM_PLOT_PANEL::GetLabelX ( ) const
inline

Definition at line 194 of file sim_plot_panel.h.

195 {
196 return m_axis_x ? m_axis_x->GetName() : "";
197 }
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 199 of file sim_plot_panel.h.

200 {
201 return m_axis_y1 ? m_axis_y1->GetName() : "";
202 }

References mpLayer::GetName(), and m_axis_y1.

Referenced by SIM_PLOT_FRAME::onCursorUpdate().

◆ GetLabelY2()

wxString SIM_PLOT_PANEL::GetLabelY2 ( ) const
inline

Definition at line 204 of file sim_plot_panel.h.

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

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 57 of file sim_panel_base.h.

57{ return m_simCommand; }
wxString m_simCommand

References SIM_PANEL_BASE::m_simCommand.

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

◆ GetTrace()

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

Definition at line 219 of file sim_plot_panel.h.

220 {
221 auto trace = m_traces.find( aName );
222
223 return trace == m_traces.end() ? nullptr : trace->second;
224 }

References m_traces.

Referenced by EnableCursor(), and HasCursorEnabled().

◆ GetTraces()

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

◆ GetType()

◆ HasCursorEnabled()

bool SIM_PLOT_PANEL::HasCursorEnabled ( const wxString &  aName) const

Toggle cursor for a particular trace.

Definition at line 591 of file sim_plot_panel.cpp.

592{
593 TRACE* t = GetTrace( aName );
594
595 return t ? t->HasCursor() : false;
596}

References GetTrace(), and TRACE::HasCursor().

◆ IsGridShown()

bool SIM_PLOT_PANEL::IsGridShown ( ) const
inline

Definition at line 234 of file sim_plot_panel.h.

235 {
236 if( !m_axis_x || !m_axis_y1 )
237 return false;
238
239 assert( m_axis_x->GetTicks() == m_axis_y1->GetTicks() );
240 return !m_axis_x->GetTicks();
241 }
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 249 of file sim_plot_panel.h.

250 {
251 return m_legend->IsVisible();
252 }
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 57 of file sim_panel_base.cpp.

58{
59 switch( aSimType )
60 {
61 case ST_AC:
62 case ST_DC:
63 case ST_TRANSIENT:
64 return true;
65
66 default:
67 return false;
68 }
69}
@ 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 399 of file sim_plot_panel.cpp.

400{
401 wxString sim_cmd = getSimCommand().Lower();
402 wxString rem;
403
404 if( sim_cmd.StartsWith( ".dc", &rem ) )
405 {
406 wxChar ch;
407
408 rem.Trim( false );
409
410 try
411 {
412 ch = rem.GetChar( 0 );
413 }
414 catch( ... )
415 {;}
416
417 switch( ch )
418 {
419 // Make sure that we have a reliable default (even if incorrectly labeled)
420 default:
421 case 'v':
422 m_axis_x =
423 new LIN_SCALE<mpScaleX>( _( "Voltage (swept)" ), wxT( "V" ), mpALIGN_BOTTOM );
424 break;
425 case 'i':
426 m_axis_x =
427 new LIN_SCALE<mpScaleX>( _( "Current (swept)" ), wxT( "A" ), mpALIGN_BOTTOM );
428 break;
429 case 'r':
430 m_axis_x = new LIN_SCALE<mpScaleX>( _( "Resistance (swept)" ), wxT( "\u03A9" ),
432 break;
433 case 't':
434 m_axis_x = new LIN_SCALE<mpScaleX>( _( "Temperature (swept)" ), wxT( "\u00B0C" ),
436 break;
437 }
438
439 m_axis_y1 = new LIN_SCALE<mpScaleY>( _( "Voltage (measured)" ), wxT( "V" ), mpALIGN_LEFT );
440 m_axis_y2 = new LIN_SCALE<mpScaleY>( _( "Current" ), wxT( "A" ), mpALIGN_RIGHT );
441 }
442}
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 630 of file sim_plot_panel.cpp.

631{
632 if( m_axis_x )
634
635 if( m_axis_y1 )
637
638 if( m_axis_y2 )
640
641 for( auto t : m_traces )
642 t.second->UpdateScales();
643}
void ResetDataRange()
Definition: mathplot.h:759

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

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

◆ SetDottedCurrentPhase()

void SIM_PLOT_PANEL::SetDottedCurrentPhase ( bool  aEnable)
inline

Definition at line 254 of file sim_plot_panel.h.

255 {
256 m_dotted_cp = aEnable;
257
258 for( const auto& tr : m_traces )
259 {
260 UpdateTraceStyle( tr.second );
261 }
262
264 }

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 189 of file sim_plot_panel.h.

190 {
191 m_masterFrame = aFrame;
192 }

References m_masterFrame.

◆ setSimCommand()

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

Definition at line 59 of file sim_panel_base.h.

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

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

Referenced by SIM_WORKBOOK::SetSimCommand().

◆ ShowGrid()

void SIM_PLOT_PANEL::ShowGrid ( bool  aEnable)
inline

Definition at line 226 of file sim_plot_panel.h.

227 {
228 m_axis_x->SetTicks( !aEnable );
229 m_axis_y1->SetTicks( !aEnable );
230 m_axis_y2->SetTicks( !aEnable );
232 }
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 243 of file sim_plot_panel.h.

244 {
245 m_legend->SetVisible( aEnable );
247 }

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

◆ TraceShown()

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

Definition at line 209 of file sim_plot_panel.h.

210 {
211 return m_traces.count( aName ) > 0;
212 }

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 340 of file sim_plot_panel.cpp.

341{
342 if( m_axis_x )
343 return;
344
345 switch( GetType() )
346 {
347 case ST_AC:
348 m_axis_x = new LOG_SCALE<mpScaleXLog>( _( "Frequency" ), wxT( "Hz" ), mpALIGN_BOTTOM );
349 m_axis_y1 = new LIN_SCALE<mpScaleY>( _( "Gain" ), wxT( "dBV" ), mpALIGN_LEFT );
350 m_axis_y2 = new LIN_SCALE<mpScaleY>( _( "Phase" ), wxT( "\u00B0" ),
351 mpALIGN_RIGHT ); // degree sign
353 break;
354
355 case ST_DC:
357 break;
358
359 case ST_NOISE:
360 m_axis_x = new LOG_SCALE<mpScaleXLog>( _( "Frequency" ), wxT( "Hz" ), mpALIGN_BOTTOM );
361 m_axis_y1 = new mpScaleY( _( "noise [(V or A)^2/Hz]" ), mpALIGN_LEFT );
362 break;
363
364 case ST_TRANSIENT:
365 m_axis_x = new LIN_SCALE<mpScaleX>( _( "Time" ), wxT( "s" ), mpALIGN_BOTTOM );
366 m_axis_y1 = new LIN_SCALE<mpScaleY>( _( "Voltage" ), wxT( "V" ), mpALIGN_LEFT );
367 m_axis_y2 = new LIN_SCALE<mpScaleY>( _( "Current" ), wxT( "A" ), mpALIGN_RIGHT );
369 break;
370
371 default:
372 // suppress warnings
373 break;
374 }
375
376 if( m_axis_x )
377 {
378 m_axis_x->SetTicks( false );
380
382 }
383
384 if( m_axis_y1 )
385 {
386 m_axis_y1->SetTicks( false );
389 }
390
391 if( m_axis_y2 )
392 {
393 m_axis_y2->SetTicks( false );
396 }
397}
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 445 of file sim_plot_panel.cpp.

446{
447 // Update bg and fg colors:
451
452 // Update color of all traces
453 for( auto& t : m_traces )
454 if( t.second->GetCursor() )
455 t.second->GetCursor()->SetPen(
457
459}
void SetColourTheme(const wxColour &bgColour, const wxColour &drawColour, const wxColour &axesColour)
Set Color theme.
Definition: mathplot.cpp:2748

References SIM_PLOT_COLORS::AXIS, SIM_PLOT_COLORS::BACKGROUND, SIM_PLOT_COLORS::CURSOR, SIM_PLOT_COLORS::FOREGROUND, SIM_PLOT_COLORS::GetPlotColor(), m_colors, m_plotWin, m_traces, 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 462 of file sim_plot_panel.cpp.

463{
464 int type = trace->GetType();
465 wxPenStyle penStyle = ( ( ( type & SPT_AC_PHASE ) || ( type & SPT_CURRENT ) ) && m_dotted_cp )
466 ? wxPENSTYLE_DOT
467 : wxPENSTYLE_SOLID;
468 trace->SetPen( wxPen( trace->GetTraceColour(), 2, penStyle ) );
469}
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 178 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_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: