KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sim_plot_tab.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2016-2023 CERN
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * @author Tomasz Wlostowski <[email protected]>
8 * @author Maciej Suminski <[email protected]>
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 3
13 * of the License, or (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22 */
23
24#ifndef __SIM_PLOT_PANEL_H
25#define __SIM_PLOT_PANEL_H
26
27#include "sim_types.h"
28#include <map>
29#include <limits>
30#include <widgets/mathplot.h>
31#include <math/util.h>
32#include <wx/colour.h>
33#include <wx/sizer.h>
34#include "sim_tab.h"
35#include "smith_math.h"
36#include "sim_plot_colors.h"
37
38class SIMULATOR_FRAME;
39class SIM_PLOT_TAB;
40class TRACE;
41
59
60
62class CURSOR : public mpInfoLayer
63{
64public:
65 CURSOR( TRACE* aTrace, SIM_PLOT_TAB* aPlotTab ) :
66 mpInfoLayer( wxRect( 0, 0, DRAG_MARGIN, DRAG_MARGIN ), wxTRANSPARENT_BRUSH ),
67 m_trace( aTrace ),
68 m_updateRequired( true ),
69 m_updateRef( false ),
70 m_coords( 0.0, 0.0 ),
71 m_window( nullptr ),
72 m_sweepIndex( 0 ),
73 m_snapToNearest( false ),
74 m_snapTargetY( 0.0 )
75 {
76 }
77
78 void Plot( wxDC& aDC, mpWindow& aWindow ) override;
79
80 void SetX( int aX )
81 {
82 m_reference.x = 0;
83 m_updateRef = true;
84 Move( wxPoint( aX, 0 ) );
85 }
86
87 void Update()
88 {
89 m_updateRequired = true;
90 }
91
92 bool Inside( const wxPoint& aPoint ) const override;
93
94 void Move( wxPoint aDelta ) override;
95
96 void UpdateReference() override;
97
98 bool OnDoubleClick( const wxPoint& aPoint, mpWindow& aWindow ) override;
99
100 const wxRealPoint& GetCoords() const
101 {
102 return m_coords;
103 }
104
105 virtual void SetCoordX( double aValue );
106
107private:
108 void doSetCoordX( double aValue );
109
110protected:
111 wxString getID();
112
113protected:
117 wxRealPoint m_coords;
122
123 static constexpr int DRAG_MARGIN = 10;
124};
125
126
127class TRACE : public mpFXYVector
128{
129public:
130 TRACE( const wxString& aName, SIM_TRACE_TYPE aType ) :
131 mpFXYVector( aName ),
132 m_type( aType ),
133 m_isMultiRun( false )
134 {
135 SetContinuity( true );
136 ShowName( false );
137 SetName( aName );
138 }
139
140 void SetName( const wxString& aName ) override
141 {
142 for( auto& [ idx, cursor ] : m_cursors )
143 {
144 if( cursor )
145 cursor->SetName( aName );
146 }
147
148 mpFXYVector::SetName( aName );
149
150 if( m_type & SPT_AC_GAIN )
151 m_displayName = aName + _( " (gain)" );
152 else if( m_type & SPT_AC_PHASE )
153 m_displayName = aName + _( " (phase)" );
154 else
155 m_displayName = aName;
156 }
157
164 void SetData( const std::vector<double>& aX, const std::vector<double>& aY ) override
165 {
166 for( auto& [ idx, cursor ] : m_cursors )
167 {
168 if( cursor )
169 cursor->Update();
170 }
171
172 mpFXYVector::SetData( aX, aY );
173 }
174
175 const std::vector<double>& GetDataX() const { return m_xs; }
176 const std::vector<double>& GetDataY() const { return m_ys; }
177
178 bool HasCursor( int aCursorId ) { return m_cursors[ aCursorId ] != nullptr; }
179
180 void SetCursor( int aCursorId, CURSOR* aCursor ) { m_cursors[ aCursorId ] = aCursor; }
181 CURSOR* GetCursor( int aCursorId ) { return m_cursors[ aCursorId ]; }
182 std::map<int, CURSOR*>& GetCursors() { return m_cursors; }
183
184 SIM_TRACE_TYPE GetType() const { return m_type; }
185
186 void SetTraceColour( const wxColour& aColour ) { m_traceColour = aColour; }
187 wxColour GetTraceColour() const { return m_traceColour; }
188
189 void SetIsMultiRun( bool aIsMultiRun ) { m_isMultiRun = aIsMultiRun; }
190 bool IsMultiRun() const { return m_isMultiRun; }
191
192 void SetMultiRunLabels( const std::vector<wxString>& aLabels ) { m_multiRunLabels = aLabels; }
193 const std::vector<wxString>& GetMultiRunLabels() const { return m_multiRunLabels; }
194
195protected:
196 std::map<int, CURSOR*> m_cursors; // No ownership; the mpWindow owns the CURSORs
200 std::vector<wxString> m_multiRunLabels;
201};
202
203
205class SMITH_GRID : public mpLayer
206{
207public:
209
210 void Plot( wxDC& aDC, mpWindow& aWindow ) override;
211
212 bool HasBBox() const override { return false; }
213
214 void SetReferenceImpedance( double aZ0 ) { m_z0 = aZ0; }
215
216 void SetNormalizedLabels( bool aNormalized ) { m_normalized = aNormalized; }
217
219 static bool GetChartView( mpWindow& aWindow, double aZoom, const wxRealPoint& aPan, SMITH_VIEW& aView );
220
221private:
222 double m_z0 = 50.0;
223 bool m_normalized = false;
224};
225
226
228class SMITH_TRACE : public TRACE
229{
230public:
231 SMITH_TRACE( const wxString& aName, SIM_TRACE_TYPE aType ) :
232 TRACE( aName, aType )
233 {
234 }
235
236 void Plot( wxDC& aDC, mpWindow& aWindow ) override;
237
238 // drawn directly, keep the locus out of the axis auto-fit
239 bool HasBBox() const override { return false; }
240
241 void SetFrequencies( const std::vector<double>& aFreqs ) { m_frequencies = aFreqs; }
242 const std::vector<double>& GetFrequencies() const { return m_frequencies; }
243
244 void SetReferenceImpedance( double aZ0 ) { m_z0 = aZ0; }
245 double GetReferenceImpedance() const { return m_z0; }
246
247private:
248 std::vector<double> m_frequencies;
249 double m_z0 = 50.0;
250};
251
252
255class SMITH_CURSOR : public CURSOR
256{
257public:
258 SMITH_CURSOR( SMITH_TRACE* aTrace, SIM_PLOT_TAB* aPlotTab ) :
259 CURSOR( aTrace, aPlotTab ),
260 m_index( -1 ),
261 m_gamma( 0.0, 0.0 ),
262 m_pendingFreq( false ),
263 m_dragging( false )
264 {
265 }
266
267 void Plot( wxDC& aDC, mpWindow& aWindow ) override;
268
269 bool Inside( const wxPoint& aPoint ) const override;
270
271 void Move( wxPoint aDelta ) override;
272
273 void UpdateReference() override;
274
275 void SetCoordX( double aValue ) override;
276
277private:
278 void snapToIndex( int aIndex );
279 void snapToFrequency( double aFreq );
280
281private:
283 wxRealPoint m_gamma;
284 bool m_pendingFreq; // a saved frequency waiting for the sim data to load
285 bool m_dragging; // the pending update comes from a drag, not a data refresh
286};
287
288
291{
292 wxString vectorName;
293 wxString displayName;
295};
296
297
300{
301 int id;
302 wxString vectorName;
304 int subType; // the SP subtype bit the cursor lived on before Smith mode
305 double frequency;
306};
307
308
309class SIM_PLOT_TAB : public SIM_TAB
310{
311public:
312 SIM_PLOT_TAB( const wxString& aSimCommand, wxWindow* parent );
313
314 virtual ~SIM_PLOT_TAB();
315
316 void ApplyPreferences( const SIM_PREFERENCES& aPrefs ) override
317 {
318 m_plotWin->SetMouseWheelActions( convertMouseWheelActions( aPrefs.mouse_wheel_actions ) );
319 }
320
321 wxString GetLabelX() const
322 {
323 return m_axis_x ? m_axis_x->GetName() : wxString( wxS( "" ) );
324 }
325
326 wxString GetLabelY1() const
327 {
328 return m_axis_y1 ? m_axis_y1->GetName() : wxString( wxS( "" ) );
329 }
330
331 wxString GetLabelY2() const
332 {
333 return m_axis_y2 ? m_axis_y2->GetName() : wxString( wxS( "" ) );
334 }
335
336 wxString GetLabelY3() const
337 {
338 return m_axis_y3 ? m_axis_y3->GetName() : wxString( wxS( "" ) );
339 }
340
341 bool GetY1Scale( double* aMin, double* aMax ) const
342 {
343 if( m_axis_y1 )
344 return m_axis_y1->GetAxisMinMax( aMin, aMax );
345
346 return false;
347 }
348
349 bool GetY2Scale( double* aMin, double* aMax ) const
350 {
351 if( m_axis_y2 )
352 return m_axis_y2->GetAxisMinMax( aMin, aMax );
353
354 return false;
355 }
356
357 bool GetY3Scale( double* aMin, double* aMax ) const
358 {
359 if( m_axis_y3 )
360 return m_axis_y3->GetAxisMinMax( aMin, aMax );
361
362 return false;
363 }
364
365 void SetY1Scale( bool aLock, double aMin, double aMax );
366 void SetY2Scale( bool aLock, double aMin, double aMax );
367 void SetY3Scale( bool aLock, double aMin, double aMax );
368
369 wxString GetUnitsX() const;
370 wxString GetUnitsY1() const;
371 wxString GetUnitsY2() const;
372 wxString GetUnitsY3() const;
373
374 const std::map<wxString, TRACE*>& GetTraces() const
375 {
376 return m_traces;
377 }
378
379 TRACE* GetTrace( const wxString& aVecName, int aType ) const
380 {
381 auto trace = m_traces.find( getTraceId( aVecName, aType ) );
382
383 return trace == m_traces.end() ? nullptr : trace->second;
384 }
385
386 void ShowGrid( bool aEnable )
387 {
388 if( m_axis_x )
389 m_axis_x->SetTicks( !aEnable );
390
391 if( m_axis_y1 )
392 m_axis_y1->SetTicks( !aEnable );
393
394 if( m_axis_y2 )
395 m_axis_y2->SetTicks( !aEnable );
396
397 if( m_axis_y3 )
398 m_axis_y3->SetTicks( !aEnable );
399
400 m_plotWin->UpdateAll();
401 }
402
403 bool IsGridShown() const
404 {
405 if( !m_axis_x || !m_axis_y1 )
406 return false;
407
408 return !m_axis_x->GetTicks();
409 }
410
411 void ShowLegend( bool aEnable )
412 {
413 m_legend->SetVisible( aEnable );
414 m_plotWin->UpdateAll();
415 }
416
417 bool IsLegendShown() const
418 {
419 return m_legend->IsVisible();
420 }
421
422 wxPoint GetLegendPosition() const
423 {
424 return m_legend->GetPosition();
425 }
426
427 void SetLegendPosition( const wxPoint& aPosition )
428 {
429 m_legend->Move( aPosition );
430 m_legend->UpdateReference();
431 m_LastLegendPosition = aPosition;
432 }
433
437 void SetDottedSecondary( bool aEnable )
438 {
439 m_dotted_cp = aEnable;
440
441 for( const auto& [ name, trace ] : m_traces )
442 UpdateTraceStyle( trace );
443
444 m_plotWin->UpdateAll();
445 }
446
448 {
449 return m_dotted_cp;
450 }
451
452 void SetSmithMode( bool aEnable );
453 bool IsSmithMode() const { return m_smithMode; }
454
457
458 double GetSmithZoom() const { return m_smithZoom; }
459 const wxRealPoint& GetSmithPan() const { return m_smithPan; }
460
462 {
463 m_smithZoom = 1.0;
464 m_smithPan = wxRealPoint( 0.0, 0.0 );
465 }
466
468 void SetSmithView( double aZoom, double aPanX, double aPanY )
469 {
470 m_smithZoom = std::isfinite( aZoom ) ? std::clamp( aZoom, 1.0, 50.0 ) : 1.0;
471 m_smithPan.x = std::isfinite( aPanX ) ? std::clamp( aPanX, -100.0, 100.0 ) : 0.0;
472 m_smithPan.y = std::isfinite( aPanY ) ? std::clamp( aPanY, -100.0, 100.0 ) : 0.0;
473 }
474
475 void SmithZoomAt( const wxPoint& aPos, double aFactor );
476 void SmithPanBy( const wxPoint& aDelta );
477
479 std::vector<SMITH_STASHED_TRACE>& SmithStashedTraces() { return m_smithStashedTraces; }
480 std::vector<SMITH_STASHED_CURSOR>& SmithStashedCursors() { return m_smithStashedCursors; }
481
483 void EnableCursor( TRACE* aTrace, int aCursorId, const wxString& aSignalName );
484 void DisableCursor( TRACE* aTrace, int aCursorId );
485
487 void ResetScales( bool aIncludeX );
488
490 void UpdateTraceStyle( TRACE* trace );
491
493 void UpdatePlotColors();
494
495 void OnLanguageChanged() override;
496
498 mpWindow* GetPlotWin() const { return m_plotWin; }
499
500 TRACE* GetOrAddTrace( const wxString& aVectorName, int aType );
501
502 void SetTraceData( TRACE* aTrace, std::vector<double>& aX, std::vector<double>& aY,
503 int aSweepCount, size_t aSweepSize, bool aIsMultiRun = false,
504 const std::vector<wxString>& aMultiRunLabels = {} );
505
506 bool DeleteTrace( const wxString& aVectorName, int aTraceType );
507 void DeleteTrace( TRACE* aTrace );
508
509 std::vector<std::pair<wxString, wxString>>& Measurements() { return m_measurements; }
510
512
513public:
515
516private:
519 {
520 static_assert( static_cast<unsigned>( mpWindow::MouseWheelAction::COUNT )
521 == static_cast<unsigned>( SIM_MOUSE_WHEEL_ACTION::COUNT ),
522 "mpWindow::MouseWheelAction enum must match SIM_MOUSE_WHEEL_ACTION" );
523
526 m.verticalUnmodified = static_cast<A>( s.vertical_unmodified );
527 m.verticalWithCtrl = static_cast<A>( s.vertical_with_ctrl );
528 m.verticalWithShift = static_cast<A>( s.vertical_with_shift );
529 m.verticalWithAlt = static_cast<A>( s.vertical_with_alt );
530 m.horizontal = static_cast<A>( s.horizontal );
531
532 return m;
533 }
534
535 wxString getTraceId( const wxString& aVectorName, int aType ) const
536 {
537 return wxString::Format( wxS( "%s%d" ), aVectorName, aType & SPT_Y_AXIS_MASK );
538 }
539
541 void prepareDCAxes( int aNewTraceType );
542
544 void updateAxes( int aNewTraceType = SIM_TRACE_TYPE::SPT_UNKNOWN );
545
547
548 void onSmithMouseWheel( wxMouseEvent& aEvent );
549 void onSmithMagnify( wxMouseEvent& aEvent );
550 void onSmithMiddleDown( wxMouseEvent& aEvent );
551 void onSmithLeftDown( wxMouseEvent& aEvent );
552 void onSmithMotion( wxMouseEvent& aEvent );
553 void onSmithLeftUp( wxMouseEvent& aEvent );
554 void onSmithDClick( wxMouseEvent& aEvent );
555 void onSmithRightDown( wxMouseEvent& aEvent );
556 void onSmithRightUp( wxMouseEvent& aEvent );
557 void onSmithMenuCommand( wxCommandEvent& aEvent );
558
559 bool getSmithView( SMITH_VIEW& aView ) const;
560
561private:
563 std::map<wxString, wxColour> m_sessionTraceColors;
564
565 // Top-level plot window
567 wxBoxSizer* m_sizer;
568
569 // Traces to be plotted
570 std::map<wxString, TRACE*> m_traces;
571
578
582 wxRealPoint m_smithPan;
587
588 std::vector<SMITH_STASHED_TRACE> m_smithStashedTraces;
589 std::vector<SMITH_STASHED_CURSOR> m_smithStashedCursors;
590
591 // Measurements (and their format strings)
592 std::vector<std::pair<wxString, wxString>> m_measurements;
593};
594
595wxDECLARE_EVENT( EVT_SIM_CURSOR_UPDATE, wxCommandEvent );
596
597#endif
const char * name
The SIMULATOR_FRAME holds the main user-interface for running simulations.
CURSOR(TRACE *aTrace, SIM_PLOT_TAB *aPlotTab)
mpWindow * m_window
const wxRealPoint & GetCoords() const
void Move(wxPoint aDelta) override
Moves the layer rectangle of given pixel deltas.
void SetX(int aX)
wxString getID()
wxRealPoint m_coords
bool m_updateRef
static constexpr int DRAG_MARGIN
bool Inside(const wxPoint &aPoint) const override
Checks whether a point is inside the info box rectangle.
void doSetCoordX(double aValue)
int m_sweepIndex
bool OnDoubleClick(const wxPoint &aPoint, mpWindow &aWindow) override
virtual void SetCoordX(double aValue)
void UpdateReference() override
Updates the rectangle reference point.
bool m_updateRequired
double m_snapTargetY
TRACE * m_trace
void Plot(wxDC &aDC, mpWindow &aWindow) override
Plot method.
bool m_snapToNearest
void Update()
The SIMULATOR_FRAME holds the main user-interface for running simulations.
bool DeleteTrace(const wxString &aVectorName, int aTraceType)
wxPoint m_smithMenuPos
double GetSmithZoom() const
wxPoint m_smithPanLast
void UpdateSmithReferenceImpedance()
mpScaleXBase * m_axis_x
void onSmithMotion(wxMouseEvent &aEvent)
wxString GetLabelY1() const
mpWindow * GetPlotWin() const
void prepareDCAxes(int aNewTraceType)
Create/Ensure axes are available for plotting.
void SetSmithView(double aZoom, double aPanX, double aPanY)
void ShowGrid(bool aEnable)
void SetTraceData(TRACE *aTrace, std::vector< double > &aX, std::vector< double > &aY, int aSweepCount, size_t aSweepSize, bool aIsMultiRun=false, const std::vector< wxString > &aMultiRunLabels={})
wxString GetUnitsY2() const
SMITH_GRID * m_smithGrid
void SetY2Scale(bool aLock, double aMin, double aMax)
bool m_smithLeftSkipped
void SmithZoomAt(const wxPoint &aPos, double aFactor)
TRACE * GetTrace(const wxString &aVecName, int aType) const
std::vector< SMITH_STASHED_CURSOR > m_smithStashedCursors
void SetSmithMode(bool aEnable)
virtual ~SIM_PLOT_TAB()
wxString GetLabelX() const
bool IsGridShown() const
const std::map< wxString, TRACE * > & GetTraces() const
wxString GetLabelY3() const
void SetY1Scale(bool aLock, double aMin, double aMax)
bool GetDottedSecondary() const
wxPoint GetLegendPosition() const
mpInfoLegend * m_legend
std::vector< std::pair< wxString, wxString > > m_measurements
void onSmithRightDown(wxMouseEvent &aEvent)
void UpdateAxisVisibility()
void SetY3Scale(bool aLock, double aMin, double aMax)
wxBoxSizer * m_sizer
std::map< wxString, TRACE * > m_traces
bool IsLegendShown() const
std::vector< SMITH_STASHED_TRACE > m_smithStashedTraces
std::vector< std::pair< wxString, wxString > > & Measurements()
SIM_PLOT_COLORS m_colors
void UpdateTraceStyle(TRACE *trace)
Update plot colors.
void SetLegendPosition(const wxPoint &aPosition)
void ResetScales(bool aIncludeX)
Update trace line style.
void onSmithMiddleDown(wxMouseEvent &aEvent)
void onSmithMenuCommand(wxCommandEvent &aEvent)
void UpdatePlotColors()
std::vector< SMITH_STASHED_TRACE > & SmithStashedTraces()
mpScaleY * m_axis_y2
void ShowLegend(bool aEnable)
bool GetY3Scale(double *aMin, double *aMax) const
SIM_PLOT_TAB(const wxString &aSimCommand, wxWindow *parent)
wxString GetLabelY2() const
void EnableCursor(TRACE *aTrace, int aCursorId, const wxString &aSignalName)
bool IsSmithMode() const
Refresh the grid z0 from the shown Smith traces.
wxString GetUnitsX() const
void OnLanguageChanged() override
Getter for math plot window.
wxRealPoint m_smithPan
void EnsureThirdYAxisExists()
wxString getTraceId(const wxString &aVectorName, int aType) const
Construct the plot axes for DC simulation plot.
TRACE * GetOrAddTrace(const wxString &aVectorName, int aType)
std::vector< SMITH_STASHED_CURSOR > & SmithStashedCursors()
Turn on/off the cursor for a particular trace.
mpScaleY * m_axis_y1
void SetDottedSecondary(bool aEnable)
Draw secondary signal traces (current or phase) with dotted lines.
void ApplyPreferences(const SIM_PREFERENCES &aPrefs) override
void onSmithLeftUp(wxMouseEvent &aEvent)
double m_smithZoom
void SmithPanBy(const wxPoint &aDelta)
Traces and cursors set aside while in Smith mode, restored when leaving it.
mpScaleY * m_axis_y3
wxPoint m_LastLegendPosition
void onSmithDClick(wxMouseEvent &aEvent)
void onSmithRightUp(wxMouseEvent &aEvent)
void onSmithMouseWheel(wxMouseEvent &aEvent)
wxString GetUnitsY1() const
std::map< wxString, wxColour > m_sessionTraceColors
mpWindow * m_plotWin
static mpWindow::MouseWheelActionSet convertMouseWheelActions(const SIM_MOUSE_WHEEL_ACTION_SET &s)
void DisableCursor(TRACE *aTrace, int aCursorId)
Reset scale ranges to fit the current traces.
bool GetY2Scale(double *aMin, double *aMax) const
const wxRealPoint & GetSmithPan() const
void onSmithLeftDown(wxMouseEvent &aEvent)
void ResetSmithView()
Restore a saved view, values are validated and clamped.
bool getSmithView(SMITH_VIEW &aView) const
void updateAxes(int aNewTraceType=SIM_TRACE_TYPE::SPT_UNKNOWN)
bool GetY1Scale(double *aMin, double *aMax) const
void onSmithMagnify(wxMouseEvent &aEvent)
wxString GetUnitsY3() const
SIM_TAB()
Definition sim_tab.cpp:29
void UpdateReference() override
Updates the rectangle reference point.
void Plot(wxDC &aDC, mpWindow &aWindow) override
Plot method.
bool Inside(const wxPoint &aPoint) const override
Checks whether a point is inside the info box rectangle.
void SetCoordX(double aValue) override
void snapToIndex(int aIndex)
void snapToFrequency(double aFreq)
wxRealPoint m_gamma
SMITH_CURSOR(SMITH_TRACE *aTrace, SIM_PLOT_TAB *aPlotTab)
void Move(wxPoint aDelta) override
Moves the layer rectangle of given pixel deltas.
Reflection coefficient locus, Re in X and Im in Y, drawn on the Smith chart.
static bool GetChartView(mpWindow &aWindow, double aZoom, const wxRealPoint &aPan, SMITH_VIEW &aView)
void Plot(wxDC &aDC, mpWindow &aWindow) override
Plot given view of layer to the given device context.
void SetNormalizedLabels(bool aNormalized)
Chart placement including pan/zoom.
void SetReferenceImpedance(double aZ0)
bool m_normalized
bool HasBBox() const override
Check whether this layer has a bounding box.
Cursor that snaps along a Smith chart locus, keyed by frequency.
void Plot(wxDC &aDC, mpWindow &aWindow) override
Layer plot handler.
bool HasBBox() const override
Check whether this layer has a bounding box.
void SetReferenceImpedance(double aZ0)
SMITH_TRACE(const wxString &aName, SIM_TRACE_TYPE aType)
const std::vector< double > & GetFrequencies() const
void SetFrequencies(const std::vector< double > &aFreqs)
std::vector< double > m_frequencies
double GetReferenceImpedance() const
Overlay layer drawing the Smith chart grid (constant resistance and reactance circles)
std::vector< wxString > m_multiRunLabels
void SetIsMultiRun(bool aIsMultiRun)
void SetTraceColour(const wxColour &aColour)
void SetName(const wxString &aName) override
Set layer name.
wxColour m_traceColour
void SetMultiRunLabels(const std::vector< wxString > &aLabels)
std::map< int, CURSOR * > & GetCursors()
SIM_TRACE_TYPE m_type
SIM_TRACE_TYPE GetType() const
std::map< int, CURSOR * > m_cursors
bool HasCursor(int aCursorId)
bool m_isMultiRun
TRACE(const wxString &aName, SIM_TRACE_TYPE aType)
void SetData(const std::vector< double > &aX, const std::vector< double > &aY) override
Assigns new data set for the trace.
const std::vector< wxString > & GetMultiRunLabels() const
void SetCursor(int aCursorId, CURSOR *aCursor)
bool IsMultiRun() const
const std::vector< double > & GetDataY() const
wxColour GetTraceColour() const
const std::vector< double > & GetDataX() const
CURSOR * GetCursor(int aCursorId)
mpFXYVector(const wxString &name=wxEmptyString, int flags=mpALIGN_NE)
std::vector< double > m_ys
Definition mathplot.h:1468
std::vector< double > m_xs
The internal copy of the set of data to draw.
Definition mathplot.h:1468
virtual void SetData(const std::vector< double > &xs, const std::vector< double > &ys)
Changes the internal data: the set of points to draw.
wxPoint m_reference
Definition mathplot.h:393
mpInfoLayer()
Default constructor.
Definition mathplot.cpp:106
Implements the legend to be added to the plot This layer allows you to add a legend to describe the p...
Definition mathplot.h:405
void SetContinuity(bool continuity)
Set the 'continuity' property of the layer (true:draws a continuous line, false:draws separate points...
Definition mathplot.h:269
void ShowName(bool show)
Shows or hides the text label with the name of the layer (default is visible).
Definition mathplot.h:278
virtual void SetName(const wxString &name)
Set layer name.
Definition mathplot.h:283
mpLayerType m_type
Definition mathplot.h:324
wxString m_displayName
Definition mathplot.h:321
Plot layer implementing a y-scale ruler.
Definition mathplot.h:840
Canvas for plotting mpLayer implementations.
Definition mathplot.h:920
MouseWheelAction
Enumerates the possible mouse wheel actions that can be performed on the plot.
Definition mathplot.h:926
#define _(s)
@ mpLAYER_AXIS
Definition mathplot.h:140
Class is responsible for providing colors for traces on simulation plot.
wxDECLARE_EVENT(EVT_SIM_CURSOR_UPDATE, wxCommandEvent)
SIM_TRACE_TYPE
Definition sim_types.h:49
@ SPT_AC_PHASE
Definition sim_types.h:53
@ SPT_UNKNOWN
Definition sim_types.h:68
@ SPT_AC_GAIN
Definition sim_types.h:54
@ SPT_Y_AXIS_MASK
Definition sim_types.h:59
Contains the set of modified mouse wheel actions that can be performed on a simulator plot.
SIM_MOUSE_WHEEL_ACTION vertical_unmodified
SIM_MOUSE_WHEEL_ACTION vertical_with_alt
SIM_MOUSE_WHEEL_ACTION horizontal
SIM_MOUSE_WHEEL_ACTION vertical_with_ctrl
SIM_MOUSE_WHEEL_ACTION vertical_with_shift
Contains preferences pertaining to the simulator.
SIM_MOUSE_WHEEL_ACTION_SET mouse_wheel_actions
Cursor recorded when entering Smith mode, so leaving restores it to its original trace.
< Smith chart placement plus pan/zoom, maps a gamma point to a screen pixel and back.
Definition smith_math.h:32
Contains the set of modified mouse wheel actions that can be performed on the plot.
Definition mathplot.h:941
MouseWheelAction horizontal
Definition mathplot.h:951
MouseWheelAction verticalWithShift
Definition mathplot.h:949
MouseWheelAction verticalWithCtrl
Definition mathplot.h:948
MouseWheelAction verticalWithAlt
Definition mathplot.h:950
MouseWheelAction verticalUnmodified
Definition mathplot.h:947