Handle flipped footprints in library compare algorithm.

Also fixes a bug where line styles weren't taken into account.

Fixes https://gitlab.com/kicad/code/kicad/issues/10107
This commit is contained in:
Jeff Young 2021-12-25 13:41:10 +00:00
parent ec104e4ab0
commit 03a5bd5319
1 changed files with 10 additions and 3 deletions

View File

@ -116,7 +116,7 @@ bool primitivesNeedUpdate( const std::shared_ptr<PCB_SHAPE>& a,
UNIMPLEMENTED_FOR( a->SHAPE_T_asString() ); UNIMPLEMENTED_FOR( a->SHAPE_T_asString() );
} }
TEST( a->GetWidth(), b->GetWidth() ); TEST( a->GetStroke(), b->GetStroke() );
TEST( a->IsFilled(), b->IsFilled() ); TEST( a->IsFilled(), b->IsFilled() );
return false; return false;
@ -219,7 +219,7 @@ bool shapesNeedUpdate( const FP_SHAPE* a, const FP_SHAPE* b )
UNIMPLEMENTED_FOR( a->SHAPE_T_asString() ); UNIMPLEMENTED_FOR( a->SHAPE_T_asString() );
} }
TEST( a->GetWidth(), b->GetWidth() ); TEST( a->GetStroke(), b->GetStroke() );
TEST( a->IsFilled(), b->IsFilled() ); TEST( a->IsFilled(), b->IsFilled() );
TEST( a->GetLayer(), b->GetLayer() ); TEST( a->GetLayer(), b->GetLayer() );
@ -321,6 +321,13 @@ bool modelsNeedUpdate( const FP_3DMODEL& a, const FP_3DMODEL& b )
bool FOOTPRINT::FootprintNeedsUpdate( const FOOTPRINT* aLibFootprint ) bool FOOTPRINT::FootprintNeedsUpdate( const FOOTPRINT* aLibFootprint )
{ {
if( IsFlipped() )
{
std::unique_ptr<FOOTPRINT> temp( static_cast<FOOTPRINT*>( Clone() ) );
temp->Flip( {0,0}, false );
return temp->FootprintNeedsUpdate( aLibFootprint );
}
TEST( GetDescription(), aLibFootprint->GetDescription() ); TEST( GetDescription(), aLibFootprint->GetDescription() );
TEST( GetKeywords(), aLibFootprint->GetKeywords() ); TEST( GetKeywords(), aLibFootprint->GetKeywords() );
TEST( GetAttributes(), aLibFootprint->GetAttributes() ); TEST( GetAttributes(), aLibFootprint->GetAttributes() );
@ -339,7 +346,7 @@ bool FOOTPRINT::FootprintNeedsUpdate( const FOOTPRINT* aLibFootprint )
// Currently we punt and ignore all the text items. // Currently we punt and ignore all the text items.
// Drawings and pads are also somewhat problematic as there's no gaurantee that they'll be // Drawings and pads are also somewhat problematic as there's no gaurantee that they'll be
// in the same order in the two footprints. Rather than builds some sophisticated hashing // in the same order in the two footprints. Rather than building some sophisticated hashing
// algorithm we use the footprint sorting functions to attempt to sort them in the same order. // algorithm we use the footprint sorting functions to attempt to sort them in the same order.
std::set<BOARD_ITEM*, FOOTPRINT::cmp_drawings> aShapes; std::set<BOARD_ITEM*, FOOTPRINT::cmp_drawings> aShapes;