From ef5cd6bb28d6d1fcea095fc6d5f38926d358c80b Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Mon, 31 Mar 2025 14:25:01 -0400 Subject: [PATCH] Merge PAD::addPadPrimitivesToPolygon() into PAD::MergePrimitivesAsPolygon(). It was only used in MergePrimitivesAsPolygon() and it was only a few lines long. --- pcbnew/pad.cpp | 40 +++++++++++++++++----------------------- pcbnew/pad.h | 3 --- 2 files changed, 17 insertions(+), 26 deletions(-) diff --git a/pcbnew/pad.cpp b/pcbnew/pad.cpp index defda49a20..828e709760 100644 --- a/pcbnew/pad.cpp +++ b/pcbnew/pad.cpp @@ -2617,27 +2617,6 @@ void PAD::DeletePrimitivesList( PCB_LAYER_ID aLayer ) } -void PAD::addPadPrimitivesToPolygon( PCB_LAYER_ID aLayer, SHAPE_POLY_SET* aMergedPolygon, - int aError, ERROR_LOC aErrorLoc ) const -{ - SHAPE_POLY_SET polyset; - - for( const std::shared_ptr& primitive : m_padStack.Primitives( aLayer ) ) - { - if( !primitive->IsProxyItem() ) - primitive->TransformShapeToPolygon( polyset, UNDEFINED_LAYER, 0, aError, aErrorLoc ); - } - - polyset.Simplify(); - - // Merge all polygons with the initial pad anchor shape - if( polyset.OutlineCount() ) - { - aMergedPolygon->BooleanAdd( polyset ); - aMergedPolygon->Fracture(); - } -} - void PAD::MergePrimitivesAsPolygon( PCB_LAYER_ID aLayer, SHAPE_POLY_SET* aMergedPolygon, ERROR_LOC aErrorLoc ) const { @@ -2656,8 +2635,8 @@ void PAD::MergePrimitivesAsPolygon( PCB_LAYER_ID aLayer, SHAPE_POLY_SET* aMerged { SHAPE_RECT rect( -padSize.x / 2, -padSize.y / 2, padSize.x, padSize.y ); aMergedPolygon->AddOutline( rect.Outline() ); - } break; + } default: case PAD_SHAPE::CIRCLE: @@ -2666,7 +2645,22 @@ void PAD::MergePrimitivesAsPolygon( PCB_LAYER_ID aLayer, SHAPE_POLY_SET* aMerged break; } - addPadPrimitivesToPolygon( aLayer, aMergedPolygon, maxError, aErrorLoc ); + SHAPE_POLY_SET polyset; + + for( const std::shared_ptr& primitive : m_padStack.Primitives( aLayer ) ) + { + if( !primitive->IsProxyItem() ) + primitive->TransformShapeToPolygon( polyset, UNDEFINED_LAYER, 0, maxError, aErrorLoc ); + } + + polyset.Simplify(); + + // Merge all polygons with the initial pad anchor shape + if( polyset.OutlineCount() ) + { + aMergedPolygon->BooleanAdd( polyset ); + aMergedPolygon->Fracture(); + } } diff --git a/pcbnew/pad.h b/pcbnew/pad.h index 9e368f245d..cd9087f314 100644 --- a/pcbnew/pad.h +++ b/pcbnew/pad.h @@ -921,9 +921,6 @@ protected: private: const SHAPE_COMPOUND& buildEffectiveShape( PCB_LAYER_ID aLayer ) const; - void addPadPrimitivesToPolygon( PCB_LAYER_ID aLayer, SHAPE_POLY_SET* aMergedPolygon, int aError, - ERROR_LOC aErrorLoc ) const; - void doCheckPad( PCB_LAYER_ID aLayer, UNITS_PROVIDER* aUnitsProvider, bool aForPadProperties, const std::function& aErrorHandler ) const;