24#ifndef __SIM_PLOT_PANEL_H
25#define __SIM_PLOT_PANEL_H
84 Move( wxPoint( aX, 0 ) );
92 bool Inside(
const wxPoint& aPoint )
const override;
94 void Move( wxPoint aDelta )
override;
140 void SetName(
const wxString& aName )
override
164 void SetData(
const std::vector<double>& aX,
const std::vector<double>& aY )
override
212 bool HasBBox()
const override {
return false; }
232 TRACE( aName, aType )
239 bool HasBBox()
const override {
return false; }
259 CURSOR( aTrace, aPlotTab ),
269 bool Inside(
const wxPoint& aPoint )
const override;
271 void Move( wxPoint aDelta )
override;
275 void SetCoordX(
double aValue )
override;
312 SIM_PLOT_TAB(
const wxString& aSimCommand, wxWindow* parent );
344 return m_axis_y1->GetAxisMinMax( aMin, aMax );
352 return m_axis_y2->GetAxisMinMax( aMin, aMax );
360 return m_axis_y3->GetAxisMinMax( aMin, aMax );
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 );
383 return trace ==
m_traces.end() ? nullptr : trace->second;
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;
475 void SmithZoomAt(
const wxPoint& aPos,
double aFactor );
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 = {} );
506 bool DeleteTrace(
const wxString& aVectorName,
int aTraceType );
522 "mpWindow::MouseWheelAction enum must match SIM_MOUSE_WHEEL_ACTION" );
535 wxString
getTraceId(
const wxString& aVectorName,
int aType )
const
537 return wxString::Format( wxS(
"%s%d" ), aVectorName, aType &
SPT_Y_AXIS_MASK );
The SIMULATOR_FRAME holds the main user-interface for running simulations.
CURSOR(TRACE *aTrace, SIM_PLOT_TAB *aPlotTab)
const wxRealPoint & GetCoords() const
void Move(wxPoint aDelta) override
Moves the layer rectangle of given pixel deltas.
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)
bool OnDoubleClick(const wxPoint &aPoint, mpWindow &aWindow) override
virtual void SetCoordX(double aValue)
void UpdateReference() override
Updates the rectangle reference point.
void Plot(wxDC &aDC, mpWindow &aWindow) override
Plot method.
The SIMULATOR_FRAME holds the main user-interface for running simulations.
bool DeleteTrace(const wxString &aVectorName, int aTraceType)
double GetSmithZoom() const
void UpdateSmithReferenceImpedance()
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
void SetY2Scale(bool aLock, double aMin, double aMax)
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)
wxString GetLabelX() 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
std::vector< std::pair< wxString, wxString > > m_measurements
void onSmithRightDown(wxMouseEvent &aEvent)
void UpdateAxisVisibility()
void SetY3Scale(bool aLock, double aMin, double aMax)
std::map< wxString, TRACE * > m_traces
bool IsLegendShown() const
std::vector< SMITH_STASHED_TRACE > m_smithStashedTraces
std::vector< std::pair< wxString, wxString > > & Measurements()
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)
std::vector< SMITH_STASHED_TRACE > & SmithStashedTraces()
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.
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.
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)
void SmithPanBy(const wxPoint &aDelta)
Traces and cursors set aside while in Smith mode, restored when leaving it.
wxPoint m_LastLegendPosition
void onSmithDClick(wxMouseEvent &aEvent)
void onSmithRightUp(wxMouseEvent &aEvent)
void onSmithMouseWheel(wxMouseEvent &aEvent)
wxString GetUnitsY1() const
std::map< wxString, wxColour > m_sessionTraceColors
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
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)
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 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.
void SetMultiRunLabels(const std::vector< wxString > &aLabels)
std::map< int, CURSOR * > & GetCursors()
SIM_TRACE_TYPE GetType() const
std::map< int, CURSOR * > m_cursors
bool HasCursor(int aCursorId)
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)
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
std::vector< double > m_xs
The internal copy of the set of data to draw.
virtual void SetData(const std::vector< double > &xs, const std::vector< double > &ys)
Changes the internal data: the set of points to draw.
mpInfoLayer()
Default constructor.
Implements the legend to be added to the plot This layer allows you to add a legend to describe the p...
void SetContinuity(bool continuity)
Set the 'continuity' property of the layer (true:draws a continuous line, false:draws separate points...
void ShowName(bool show)
Shows or hides the text label with the name of the layer (default is visible).
virtual void SetName(const wxString &name)
Set layer name.
Plot layer implementing a y-scale ruler.
Canvas for plotting mpLayer implementations.
MouseWheelAction
Enumerates the possible mouse wheel actions that can be performed on the plot.
Class is responsible for providing colors for traces on simulation plot.
wxDECLARE_EVENT(EVT_SIM_CURSOR_UPDATE, wxCommandEvent)
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.
Contains the set of modified mouse wheel actions that can be performed on the plot.
MouseWheelAction horizontal
MouseWheelAction verticalWithShift
MouseWheelAction verticalWithCtrl
MouseWheelAction verticalWithAlt
MouseWheelAction verticalUnmodified