28#ifndef __SIM_PLOT_PANEL_H
29#define __SIM_PLOT_PANEL_H
82 Move( wxPoint( aX, 0 ) );
90 bool Inside(
const wxPoint& aPoint )
const override;
92 void Move( wxPoint aDelta )
override
135 void SetName(
const wxString& aName )
override
159 void SetData(
const std::vector<double>& aX,
const std::vector<double>& aY )
override
194 SIM_PLOT_TAB(
const wxString& aSimCommand, wxWindow* parent );
247 void SetY1Scale(
bool aLock,
double aMin,
double aMax );
248 void SetY2Scale(
bool aLock,
double aMin,
double aMax );
249 void SetY3Scale(
bool aLock,
double aMin,
double aMax );
265 return trace ==
m_traces.end() ? nullptr : trace->second;
335 void EnableCursor(
const wxString& aVectorName,
int aType,
int aCursorId,
bool aEnable,
336 const wxString& aSignalName );
354 void SetTraceData(
TRACE* aTrace, std::vector<double>& aX, std::vector<double>& aY,
355 int aSweepCount,
size_t aSweepSize );
357 bool DeleteTrace(
const wxString& aVectorName,
int aTraceType );
372 ==
static_cast<unsigned>( SIM_MOUSE_WHEEL_ACTION::COUNT ),
373 "mpWindow::MouseWheelAction enum must match SIM_MOUSE_WHEEL_ACTION" );
384 wxString
getTraceId(
const wxString& aVectorName,
int aType )
const
386 return wxString::Format( wxS(
"%s%d" ), aVectorName, aType &
SPT_Y_AXIS_MASK );
393 void updateAxes(
int aNewTraceType = SIM_TRACE_TYPE::SPT_UNKNOWN );
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)
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)
void EnableCursor(const wxString &aVectorName, int aType, int aCursorId, bool aEnable, const wxString &aSignalName)
Reset scale ranges to fit the current traces.
wxString GetLabelY1() const
mpWindow * GetPlotWin() const
void prepareDCAxes(int aNewTraceType)
Create/Ensure axes are available for plotting.
void ShowGrid(bool aEnable)
wxString GetUnitsY2() const
void SetY2Scale(bool aLock, double aMin, double aMax)
TRACE * GetTrace(const wxString &aVecName, int aType) const
wxString GetLabelX() const
const std::map< wxString, TRACE * > & GetTraces() const
wxString GetLabelY3() const
void SetY1Scale(bool aLock, double aMin, double aMax)
bool GetDottedSecondary() const
Toggle cursor for a particular trace.
wxPoint GetLegendPosition() const
std::vector< std::pair< wxString, wxString > > m_measurements
void SetY3Scale(bool aLock, double aMin, double aMax)
std::map< wxString, TRACE * > m_traces
bool IsLegendShown() const
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 ShowLegend(bool aEnable)
bool GetY3Scale(double *aMin, double *aMax) const
wxString GetLabelY2() const
void SetTraceData(TRACE *aTrace, std::vector< double > &aX, std::vector< double > &aY, int aSweepCount, size_t aSweepSize)
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)
void SetDottedSecondary(bool aEnable)
Draw secondary signal traces (current or phase) with dotted lines.
void ApplyPreferences(const SIM_PREFERENCES &aPrefs) override
wxPoint m_LastLegendPosition
wxString GetUnitsY1() const
std::map< wxString, wxColour > m_sessionTraceColors
static mpWindow::MouseWheelActionSet convertMouseWheelActions(const SIM_MOUSE_WHEEL_ACTION_SET &s)
bool GetY2Scale(double *aMin, double *aMax) const
void updateAxes(int aNewTraceType=SIM_TRACE_TYPE::SPT_UNKNOWN)
bool GetY1Scale(double *aMin, double *aMax) const
wxString GetUnitsY3() const
void SetTraceColour(const wxColour &aColour)
void SetName(const wxString &aName) override
Set layer name.
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.
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)
A class providing graphs functionality for a 2D plot (either continuous or a set of points),...
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.
Base class to create small rectangular info boxes mpInfoLayer is the base class to create a small rec...
wxPoint GetPosition() const
Returns the position of the upper left corner of the box (in pixels)
virtual void UpdateReference()
Updates the rectangle reference point.
virtual void Move(wxPoint delta)
Moves the layer rectangle of given pixel deltas.
Implements the legend to be added to the plot This layer allows you to add a legend to describe the p...
bool IsVisible() const
Checks whether the layer is visible or not.
const wxString & GetName() const
Get layer name.
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.
void SetVisible(bool show)
Sets layer visibility.
void SetTicks(bool enable)
Set X axis ticks or grid.
bool GetTicks() const
Get X axis ticks or grid.
bool GetAxisMinMax(double *minV, double *maxV)
Plot layer implementing a y-scale ruler.
Canvas for plotting mpLayer implementations.
void SetMouseWheelActions(const MouseWheelActionSet &s)
Set the pan/zoom actions corresponding to mousewheel/trackpad events.
MouseWheelAction
Enumerates the possible mouse wheel actions that can be performed on the plot.
void UpdateAll()
Refresh display.
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 vertical_with_ctrl
SIM_MOUSE_WHEEL_ACTION vertical_with_shift
Contains preferences pertaining to the simulator.
SIM_MOUSE_WHEEL_ACTION_SET mouse_wheel_actions
Contains the set of modified mouse wheel actions that can be performed on the plot.
MouseWheelAction verticalWithShift
MouseWheelAction verticalWithCtrl
MouseWheelAction verticalWithAlt
MouseWheelAction verticalUnmodified