From 03a5bd53194a242d389059b674c34f1db7a74479 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 25 Dec 2021 13:41:10 +0000 Subject: [PATCH] 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 --- pcbnew/drc/drc_test_provider_library_parity.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pcbnew/drc/drc_test_provider_library_parity.cpp b/pcbnew/drc/drc_test_provider_library_parity.cpp index 6c88b989f1..8bcf089dfb 100644 --- a/pcbnew/drc/drc_test_provider_library_parity.cpp +++ b/pcbnew/drc/drc_test_provider_library_parity.cpp @@ -116,7 +116,7 @@ bool primitivesNeedUpdate( const std::shared_ptr& a, UNIMPLEMENTED_FOR( a->SHAPE_T_asString() ); } - TEST( a->GetWidth(), b->GetWidth() ); + TEST( a->GetStroke(), b->GetStroke() ); TEST( a->IsFilled(), b->IsFilled() ); return false; @@ -219,7 +219,7 @@ bool shapesNeedUpdate( const FP_SHAPE* a, const FP_SHAPE* b ) UNIMPLEMENTED_FOR( a->SHAPE_T_asString() ); } - TEST( a->GetWidth(), b->GetWidth() ); + TEST( a->GetStroke(), b->GetStroke() ); TEST( a->IsFilled(), b->IsFilled() ); 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 ) { + if( IsFlipped() ) + { + std::unique_ptr temp( static_cast( Clone() ) ); + temp->Flip( {0,0}, false ); + return temp->FootprintNeedsUpdate( aLibFootprint ); + } + TEST( GetDescription(), aLibFootprint->GetDescription() ); TEST( GetKeywords(), aLibFootprint->GetKeywords() ); TEST( GetAttributes(), aLibFootprint->GetAttributes() ); @@ -339,7 +346,7 @@ bool FOOTPRINT::FootprintNeedsUpdate( const FOOTPRINT* aLibFootprint ) // 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 - // 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. std::set aShapes;