pcbnew: Handle edge cuts in footprints for bbox
The Board bounding box calculation has two modes: edges only and everything. While the everything mode works as expected, the edges only calculation (and everything that depends on it) was seeing only the edge cuts on the board drawings layer and not the footprint edge cuts. Fixes: lp:1839768 * https://bugs.launchpad.net/kicad/+bug/1839768
This commit is contained in:
parent
59ed9f086f
commit
99859727e8
|
@ -778,70 +778,53 @@ unsigned BOARD::GetUnconnectedNetCount() const
|
|||
|
||||
EDA_RECT BOARD::ComputeBoundingBox( bool aBoardEdgesOnly ) const
|
||||
{
|
||||
bool hasItems = false;
|
||||
EDA_RECT area;
|
||||
LSET visible = GetVisibleLayers();
|
||||
|
||||
// Check segments, dimensions, texts, and fiducials
|
||||
for( auto item : m_drawings )
|
||||
{
|
||||
if( aBoardEdgesOnly && (item->Type() != PCB_LINE_T || item->GetLayer() != Edge_Cuts ) )
|
||||
if( aBoardEdgesOnly && ( item->GetLayer() != Edge_Cuts ) )
|
||||
continue;
|
||||
|
||||
if( !( item->GetLayerSet() & visible ).any() )
|
||||
continue;
|
||||
|
||||
if( !hasItems )
|
||||
area = item->GetBoundingBox();
|
||||
else
|
||||
if( ( item->GetLayerSet() & visible ).any() )
|
||||
area.Merge( item->GetBoundingBox() );
|
||||
}
|
||||
|
||||
hasItems = true;
|
||||
// Check modules
|
||||
for( auto module : m_modules )
|
||||
{
|
||||
if( !( module->GetLayerSet() & visible ).any() )
|
||||
continue;
|
||||
|
||||
if( aBoardEdgesOnly )
|
||||
{
|
||||
for( const auto edge : module->GraphicalItems() )
|
||||
{
|
||||
if( edge->GetLayer() == Edge_Cuts )
|
||||
area.Merge( edge->GetBoundingBox() );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
area.Merge( module->GetBoundingBox() );
|
||||
}
|
||||
}
|
||||
|
||||
if( !aBoardEdgesOnly )
|
||||
{
|
||||
// Check modules
|
||||
for( auto module : m_modules )
|
||||
{
|
||||
if( !( module->GetLayerSet() & visible ).any() )
|
||||
continue;
|
||||
|
||||
if( !hasItems )
|
||||
area = module->GetBoundingBox();
|
||||
else
|
||||
area.Merge( module->GetBoundingBox() );
|
||||
|
||||
hasItems = true;
|
||||
}
|
||||
|
||||
// Check tracks
|
||||
for( auto track : m_tracks )
|
||||
{
|
||||
if( !( track->GetLayerSet() & visible ).any() )
|
||||
continue;
|
||||
|
||||
if( !hasItems )
|
||||
area = track->GetBoundingBox();
|
||||
else
|
||||
if( ( track->GetLayerSet() & visible ).any() )
|
||||
area.Merge( track->GetBoundingBox() );
|
||||
|
||||
hasItems = true;
|
||||
}
|
||||
|
||||
// Check zones
|
||||
for( auto aZone : m_ZoneDescriptorList )
|
||||
{
|
||||
if( !( aZone->GetLayerSet() & visible ).any() )
|
||||
continue;
|
||||
|
||||
if( !hasItems )
|
||||
area = aZone->GetBoundingBox();
|
||||
else
|
||||
if( ( aZone->GetLayerSet() & visible ).any() )
|
||||
area.Merge( aZone->GetBoundingBox() );
|
||||
|
||||
area.Merge( aZone->GetBoundingBox() );
|
||||
hasItems = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue