Clean up co-linear tracks after finishing routing

This involved adding some extra infrastructure to be able
to handle the case where a track that is sitting in the
router's commit waiting to be added to the board actually
needs to be deleted instead.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/8419
This commit is contained in:
Jon Evans
2021-05-31 17:36:38 -04:00
parent 0b4075e3a9
commit 1a102f03c0
7 changed files with 125 additions and 34 deletions
+28
View File
@@ -144,6 +144,21 @@ void eraseIf( Container& c, F&& f )
}
COMMIT& COMMIT::Unstage( EDA_ITEM* aItem )
{
if( m_changedItems.find( aItem ) != m_changedItems.end() )
{
eraseIf( m_changes,
[aItem] ( const COMMIT_LINE& aEnt )
{
return aEnt.m_item == aItem;
} );
}
return *this;
}
COMMIT& COMMIT::createModified( EDA_ITEM* aItem, EDA_ITEM* aCopy, int aExtraFlags )
{
EDA_ITEM* parent = parentObject( aItem );
@@ -215,3 +230,16 @@ CHANGE_TYPE COMMIT::convert( UNDO_REDO aType ) const
}
}
std::vector<EDA_ITEM*> COMMIT::GetAddedItems() const
{
std::vector<EDA_ITEM*> ret;
for( const COMMIT_LINE& change : m_changes )
{
if( change.m_type == CHT_ADD )
ret.emplace_back( change.m_item );
}
return ret;
}