Finish processing last pad in pad group, and trim whitespace from pads.

This commit is contained in:
Jeff Young 2023-01-19 15:44:17 +00:00
parent 67eae77e9d
commit 24dd402e29
1 changed files with 14 additions and 4 deletions

View File

@ -2286,13 +2286,22 @@ std::map<wxString, int> FOOTPRINT::MapPadNumbersToNetTieGroups() const
for( const PAD* pad : m_pads ) for( const PAD* pad : m_pads )
padNumberToGroupIdxMap[ pad->GetNumber() ] = -1; padNumberToGroupIdxMap[ pad->GetNumber() ] = -1;
for( size_t ii = 0; ii < m_netTiePadGroups.size(); ++ii ) auto processPad =
[&]( wxString aPad, int aGroup )
{
aPad.Trim( true ).Trim( false );
if( !aPad.IsEmpty() )
padNumberToGroupIdxMap[ aPad ] = aGroup;
};
for( int ii = 0; ii < (int) m_netTiePadGroups.size(); ++ii )
{ {
wxString group( m_netTiePadGroups[ ii ] ); wxString group( m_netTiePadGroups[ ii ] );
bool esc = false; bool esc = false;
wxString pad; wxString pad;
for( auto ch : group ) for( wxUniCharRef ch : group )
{ {
if( esc ) if( esc )
{ {
@ -2308,7 +2317,7 @@ std::map<wxString, int> FOOTPRINT::MapPadNumbersToNetTieGroups() const
break; break;
case ',': case ',':
padNumberToGroupIdxMap[ pad ] = ii; processPad( pad, ii );
pad.Clear(); pad.Clear();
break; break;
@ -2316,8 +2325,9 @@ std::map<wxString, int> FOOTPRINT::MapPadNumbersToNetTieGroups() const
pad.Append( ch ); pad.Append( ch );
break; break;
} }
} }
processPad( pad, ii );
} }
return padNumberToGroupIdxMap; return padNumberToGroupIdxMap;