Push multi-sweep traces down into MathPlot.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17215
This commit is contained in:
Jeff Young
2024-05-23 12:24:56 +01:00
parent 0bcd5e5795
commit edae328ca6
5 changed files with 35 additions and 41 deletions
+9 -5
View File
@@ -518,8 +518,10 @@ void mpFXY::Plot( wxDC& dc, mpWindow& w )
ys.insert( w.y2p( py ) );
}
}
else
else for( int sweep = 0; sweep < GetSweepCount(); ++sweep )
{
SetSweepWindow( sweep );
int count = 0;
int x0 = 0; // X position of merged current vertical line
int ymin0 = 0; // y min coord of merged current vertical line
@@ -2590,18 +2592,20 @@ double mpScaleXLog::TransformFromPlot( double xplot ) const
void mpFXYVector::Rewind()
{
m_index = 0;
m_sweepWindow = std::numeric_limits<size_t>::max();
}
size_t mpFXYVector::GetCount() const
void mpFXYVector::SetSweepWindow( int aSweepIdx )
{
return m_xs.size();
m_index = aSweepIdx * m_sweepSize;
m_sweepWindow = ( aSweepIdx + 1 ) * m_sweepSize;
}
bool mpFXYVector::GetNextXY( double& x, double& y )
{
if( m_index >= m_xs.size() )
if( m_index >= m_xs.size() || m_index >= m_sweepWindow )
{
return false;
}
@@ -2609,7 +2613,7 @@ bool mpFXYVector::GetNextXY( double& x, double& y )
{
x = m_xs[m_index];
y = m_ys[m_index++];
return m_index <= m_xs.size();
return m_index <= m_xs.size() && m_index <= m_sweepWindow;
}
}