Handle holes when building outlines for copper sliver checker.

Fixes https://gitlab.com/kicad/code/kicad/issues/12797
This commit is contained in:
Jeff Young 2022-11-01 13:19:33 +00:00
parent 1f4e51b008
commit 619c340d92
2 changed files with 15 additions and 12 deletions

View File

@ -111,11 +111,11 @@ bool DRC_TEST_PROVIDER_SLIVER_CHECKER::Run()
std::vector<SHAPE_POLY_SET> layerPolys( layerCount );
auto sliver_checker =
[&]( int aItem ) -> size_t
auto build_layer_polys =
[&]( int layerIdx ) -> size_t
{
PCB_LAYER_ID layer = copperLayers[aItem];
SHAPE_POLY_SET& poly = layerPolys[aItem];
PCB_LAYER_ID layer = copperLayers[layerIdx];
SHAPE_POLY_SET& poly = layerPolys[layerIdx];
if( m_drcEngine->IsCancelled() )
return 0;
@ -125,17 +125,13 @@ bool DRC_TEST_PROVIDER_SLIVER_CHECKER::Run()
forEachGeometryItem( s_allBasicItems, LSET().set( layer ),
[&]( BOARD_ITEM* item ) -> bool
{
if( dynamic_cast<ZONE*>( item) )
if( ZONE* zone = dynamic_cast<ZONE*>( item) )
{
ZONE* zone = static_cast<ZONE*>( item );
if( !zone->GetIsRuleArea() )
{
fill = zone->GetFill( layer )->CloneDropTriangulation();
fill.Unfracture( SHAPE_POLY_SET::PM_FAST );
for( int jj = 0; jj < fill.OutlineCount(); ++jj )
poly.AddOutline( fill.Outline( jj ) );
poly.Append( fill );
// Report progress on board zones only. Everything else is
// in the noise.
@ -173,7 +169,7 @@ bool DRC_TEST_PROVIDER_SLIVER_CHECKER::Run()
returns.reserve( copperLayers.size() );
for( size_t ii = 0; ii < copperLayers.size(); ++ii )
returns.emplace_back( tp.submit( sliver_checker, ii ) );
returns.emplace_back( tp.submit( build_layer_polys, ii ) );
for( const std::future<size_t>& ret : returns )
{

View File

@ -236,7 +236,7 @@ public:
return m_fillFlags.test( aLayer );
}
void SetFillFlag( PCB_LAYER_ID aLayer, bool aFlag ) { m_fillFlags.set( aLayer, aFlag); }
void SetFillFlag( PCB_LAYER_ID aLayer, bool aFlag ) { m_fillFlags.set( aLayer, aFlag ); }
bool IsFilled() const { return m_isFilled; }
void SetIsFilled( bool isFilled ) { m_isFilled = isFilled; }
@ -772,6 +772,13 @@ public:
#if defined(DEBUG)
virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
void SetFillPoly( PCB_LAYER_ID aLayer, SHAPE_POLY_SET* aPoly )
{
m_FilledPolysList[ aLayer ] = std::make_shared<SHAPE_POLY_SET>( *aPoly );
SetFillFlag( aLayer, true );
}
#endif
virtual void SwapData( BOARD_ITEM* aImage ) override;