Fix FOOTPRINT copy constructor so it maintains ordering of containers

This commit is contained in:
Roberto Fernandez Bautista 2021-04-10 19:11:28 +01:00
parent 45409ec314
commit 2eb96279a2
1 changed files with 4 additions and 4 deletions

View File

@ -123,7 +123,7 @@ FOOTPRINT::FOOTPRINT( const FOOTPRINT& aFootprint ) :
{ {
PAD* newPad = static_cast<PAD*>( pad->Clone() ); PAD* newPad = static_cast<PAD*>( pad->Clone() );
ptrMap[ pad ] = newPad; ptrMap[ pad ] = newPad;
Add( newPad ); Add( newPad, ADD_MODE::APPEND ); // Append to ensure indexes are identical
} }
// Copy zones // Copy zones
@ -131,7 +131,7 @@ FOOTPRINT::FOOTPRINT( const FOOTPRINT& aFootprint ) :
{ {
FP_ZONE* newZone = static_cast<FP_ZONE*>( zone->Clone() ); FP_ZONE* newZone = static_cast<FP_ZONE*>( zone->Clone() );
ptrMap[ zone ] = newZone; ptrMap[ zone ] = newZone;
Add( newZone ); Add( newZone, ADD_MODE::APPEND ); // Append to ensure indexes are identical
// Ensure the net info is OK and especially uses the net info list // Ensure the net info is OK and especially uses the net info list
// living in the current board // living in the current board
@ -145,7 +145,7 @@ FOOTPRINT::FOOTPRINT( const FOOTPRINT& aFootprint ) :
{ {
BOARD_ITEM* newItem = static_cast<BOARD_ITEM*>( item->Clone() ); BOARD_ITEM* newItem = static_cast<BOARD_ITEM*>( item->Clone() );
ptrMap[ item ] = newItem; ptrMap[ item ] = newItem;
Add( newItem ); Add( newItem, ADD_MODE::APPEND ); // Append to ensure indexes are identical
} }
// Copy groups // Copy groups
@ -153,7 +153,7 @@ FOOTPRINT::FOOTPRINT( const FOOTPRINT& aFootprint ) :
{ {
PCB_GROUP* newGroup = static_cast<PCB_GROUP*>( group->Clone() ); PCB_GROUP* newGroup = static_cast<PCB_GROUP*>( group->Clone() );
ptrMap[ group ] = newGroup; ptrMap[ group ] = newGroup;
Add( newGroup ); Add( newGroup, ADD_MODE::APPEND ); // Append to ensure indexes are identical
} }
// Rebuild groups // Rebuild groups