Merge PAD::addPadPrimitivesToPolygon() into PAD::MergePrimitivesAsPolygon().

It was only used in MergePrimitivesAsPolygon() and it was only a few lines
long.
This commit is contained in:
Wayne Stambaugh 2025-03-31 14:25:01 -04:00
parent c8b57c50dc
commit ef5cd6bb28
2 changed files with 17 additions and 26 deletions

View File

@ -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<PCB_SHAPE>& 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<PCB_SHAPE>& 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();
}
}

View File

@ -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<void( int aErrorCode,
const wxString& aMsg )>& aErrorHandler ) const;