Remove plots that are invalid after component removal
This commit is contained in:
parent
672fd76995
commit
ed8f555331
|
@ -316,14 +316,17 @@ void SIM_PLOT_FRAME::addPlot( const wxString& aName, SIM_PLOT_TYPE aType, const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SIM_PLOT_FRAME::removePlot( const wxString& aPlotName )
|
void SIM_PLOT_FRAME::removePlot( const wxString& aPlotName, bool aErase )
|
||||||
{
|
{
|
||||||
SIM_PLOT_PANEL* plotPanel = CurrentPlot();
|
SIM_PLOT_PANEL* plotPanel = CurrentPlot();
|
||||||
auto& traceMap = m_plots[plotPanel].m_traces;
|
|
||||||
auto traceIt = traceMap.find( aPlotName );
|
|
||||||
|
|
||||||
wxASSERT( traceIt != traceMap.end() );
|
if( aErase )
|
||||||
traceMap.erase( traceIt );
|
{
|
||||||
|
auto& traceMap = m_plots[plotPanel].m_traces;
|
||||||
|
auto traceIt = traceMap.find( aPlotName );
|
||||||
|
wxASSERT( traceIt != traceMap.end() );
|
||||||
|
traceMap.erase( traceIt );
|
||||||
|
}
|
||||||
|
|
||||||
wxASSERT( plotPanel->IsShown( aPlotName ) );
|
wxASSERT( plotPanel->IsShown( aPlotName ) );
|
||||||
plotPanel->DeleteTrace( aPlotName );
|
plotPanel->DeleteTrace( aPlotName );
|
||||||
|
@ -799,9 +802,22 @@ void SIM_PLOT_FRAME::onSimFinished( wxCommandEvent& aEvent )
|
||||||
// If there are any signals plotted, update them
|
// If there are any signals plotted, update them
|
||||||
if( SIM_PLOT_PANEL::IsPlottable( simType ) )
|
if( SIM_PLOT_PANEL::IsPlottable( simType ) )
|
||||||
{
|
{
|
||||||
for( const auto& trace : m_plots[plotPanel].m_traces )
|
TRACE_MAP& traceMap = m_plots[plotPanel].m_traces;
|
||||||
updatePlot( trace.second, plotPanel );
|
|
||||||
|
|
||||||
|
for( auto it = traceMap.begin(); it != traceMap.end(); /* iteration occurs in the loop */)
|
||||||
|
{
|
||||||
|
if( !updatePlot( it->second, plotPanel ) )
|
||||||
|
{
|
||||||
|
removePlot( it->first, false );
|
||||||
|
it = traceMap.erase( it ); // remove a plot that does not exist anymore
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
++it;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
updateSignalList();
|
||||||
plotPanel->UpdateAll();
|
plotPanel->UpdateAll();
|
||||||
plotPanel->ResetScales();
|
plotPanel->ResetScales();
|
||||||
}
|
}
|
||||||
|
@ -811,6 +827,7 @@ void SIM_PLOT_FRAME::onSimFinished( wxCommandEvent& aEvent )
|
||||||
for( const auto& net : m_exporter->GetNetIndexMap() )
|
for( const auto& net : m_exporter->GetNetIndexMap() )
|
||||||
{
|
{
|
||||||
int node = net.second;
|
int node = net.second;
|
||||||
|
|
||||||
if( node > 0 )
|
if( node > 0 )
|
||||||
m_simulator->Command( wxString::Format( "print v(%d)", node ).ToStdString() );
|
m_simulator->Command( wxString::Format( "print v(%d)", node ).ToStdString() );
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,8 +148,9 @@ class SIM_PLOT_FRAME : public SIM_PLOT_FRAME_BASE
|
||||||
/**
|
/**
|
||||||
* @brief Removes a plot with a specific title.
|
* @brief Removes a plot with a specific title.
|
||||||
* @param aPlotName is the full plot title (e.g. I(Net-C1-Pad1)).
|
* @param aPlotName is the full plot title (e.g. I(Net-C1-Pad1)).
|
||||||
|
* @param aErase decides if plot should be removed from corresponding TRACE_MAP (see m_plots).
|
||||||
*/
|
*/
|
||||||
void removePlot( const wxString& aPlotName );
|
void removePlot( const wxString& aPlotName, bool aErase = true );
|
||||||
|
|
||||||
void updateNetlistExporter();
|
void updateNetlistExporter();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue