mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-20 21:31:42 +00:00
Cleanup.
This commit is contained in:
parent
1748c3c893
commit
9ca9d7120a
@ -393,12 +393,7 @@ bool PAD::FlashLayer( int aLayer, bool aOnlyCheckIfPermitted ) const
|
||||
|
||||
if( const BOARD* board = GetBoard() )
|
||||
{
|
||||
// Must be static to keep from raising its ugly head in performance profiles
|
||||
static std::initializer_list<KICAD_T> types = { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T,
|
||||
PCB_PAD_T };
|
||||
|
||||
if( auto it = m_zoneLayerOverrides.find( static_cast<PCB_LAYER_ID>( aLayer ) );
|
||||
it != m_zoneLayerOverrides.end() && it->second == ZLO_FORCE_FLASHED )
|
||||
if( GetZoneLayerOverride( layer ) == ZLO_FORCE_FLASHED )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -408,7 +403,11 @@ bool PAD::FlashLayer( int aLayer, bool aOnlyCheckIfPermitted ) const
|
||||
}
|
||||
else
|
||||
{
|
||||
return board->GetConnectivity()->IsConnectedOnLayer( this, aLayer, types );
|
||||
// Must be static to keep from raising its ugly head in performance profiles
|
||||
static std::initializer_list<KICAD_T> nonZoneTypes = { PCB_TRACE_T, PCB_ARC_T,
|
||||
PCB_VIA_T, PCB_PAD_T };
|
||||
|
||||
return board->GetConnectivity()->IsConnectedOnLayer( this, aLayer, nonZoneTypes );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1229,14 +1229,15 @@ bool PCB_VIA::FlashLayer( int aLayer ) const
|
||||
return true;
|
||||
|
||||
const BOARD* board = GetBoard();
|
||||
PCB_LAYER_ID layer = static_cast<PCB_LAYER_ID>( aLayer );
|
||||
|
||||
if( !board )
|
||||
return true;
|
||||
|
||||
if( !IsOnLayer( static_cast<PCB_LAYER_ID>( aLayer ) ) )
|
||||
if( !IsOnLayer( layer ) )
|
||||
return false;
|
||||
|
||||
if( !IsCopperLayer( aLayer ) )
|
||||
if( !IsCopperLayer( layer ) )
|
||||
return true;
|
||||
|
||||
switch( Padstack().UnconnectedLayerMode() )
|
||||
@ -1246,7 +1247,7 @@ bool PCB_VIA::FlashLayer( int aLayer ) const
|
||||
|
||||
case PADSTACK::UNCONNECTED_LAYER_MODE::REMOVE_EXCEPT_START_AND_END:
|
||||
{
|
||||
if( aLayer == Padstack().Drill().start || aLayer == Padstack().Drill().end )
|
||||
if( layer == Padstack().Drill().start || layer == Padstack().Drill().end )
|
||||
return true;
|
||||
|
||||
// Check for removal below
|
||||
@ -1258,14 +1259,18 @@ bool PCB_VIA::FlashLayer( int aLayer ) const
|
||||
break;
|
||||
}
|
||||
|
||||
// Must be static to keep from raising its ugly head in performance profiles
|
||||
static std::initializer_list<KICAD_T> connectedTypes = { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T,
|
||||
PCB_PAD_T };
|
||||
|
||||
if( GetZoneLayerOverride( static_cast<PCB_LAYER_ID>( aLayer ) ) == ZLO_FORCE_FLASHED )
|
||||
if( GetZoneLayerOverride( layer ) == ZLO_FORCE_FLASHED )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return board->GetConnectivity()->IsConnectedOnLayer( this, static_cast<PCB_LAYER_ID>( aLayer ), connectedTypes );
|
||||
{
|
||||
// Must be static to keep from raising its ugly head in performance profiles
|
||||
static std::initializer_list<KICAD_T> nonZoneTypes = { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T,
|
||||
PCB_PAD_T };
|
||||
|
||||
return board->GetConnectivity()->IsConnectedOnLayer( this, layer, nonZoneTypes );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1299,17 +1304,21 @@ void PCB_VIA::GetOutermostConnectedLayers( PCB_LAYER_ID* aTopmost,
|
||||
*aTopmost = UNDEFINED_LAYER;
|
||||
*aBottommost = UNDEFINED_LAYER;
|
||||
|
||||
static std::initializer_list<KICAD_T> connectedTypes = { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T,
|
||||
PCB_PAD_T };
|
||||
static std::initializer_list<KICAD_T> nonZoneTypes = { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T,
|
||||
PCB_PAD_T };
|
||||
|
||||
for( int layer = TopLayer(); layer <= BottomLayer(); ++layer )
|
||||
{
|
||||
bool connected = false;
|
||||
|
||||
if( GetZoneLayerOverride( static_cast<PCB_LAYER_ID>( layer ) ) == ZLO_FORCE_FLASHED )
|
||||
{
|
||||
connected = true;
|
||||
else if( GetBoard()->GetConnectivity()->IsConnectedOnLayer( this, layer, connectedTypes ) )
|
||||
}
|
||||
else if( GetBoard()->GetConnectivity()->IsConnectedOnLayer( this, layer, nonZoneTypes ) )
|
||||
{
|
||||
connected = true;
|
||||
}
|
||||
|
||||
if( connected )
|
||||
{
|
||||
|
@ -358,6 +358,8 @@ bool ZONE_FILLER::Fill( const std::vector<ZONE*>& aZones, bool aCheck, wxWindow*
|
||||
};
|
||||
|
||||
// Determine state of conditional via flashing
|
||||
// This is now done completely deterministically prior to filling due to the pathological
|
||||
// case presented in https://gitlab.com/kicad/code/kicad/-/issues/12964.
|
||||
for( PCB_TRACK* track : m_board->Tracks() )
|
||||
{
|
||||
if( track->Type() == PCB_VIA_T )
|
||||
@ -371,15 +373,15 @@ bool ZONE_FILLER::Fill( const std::vector<ZONE*>& aZones, bool aCheck, wxWindow*
|
||||
|
||||
BOX2I bbox = via->GetBoundingBox();
|
||||
VECTOR2I center = via->GetPosition();
|
||||
int testRadius = via->GetDrillValue() / 2 + 1;
|
||||
unsigned netcode = via->GetNetCode();
|
||||
int holeRadius = via->GetDrillValue() / 2 + 1;
|
||||
int netcode = via->GetNetCode();
|
||||
LSET layers = via->GetLayerSet() & boardCuMask;
|
||||
|
||||
// Checking if the via hole touches the zone outline
|
||||
auto viaTestFn =
|
||||
[&]( const ZONE* aZone ) -> bool
|
||||
{
|
||||
return aZone->Outline()->Contains( center, -1, testRadius );
|
||||
return aZone->Outline()->Contains( center, -1, holeRadius );
|
||||
};
|
||||
|
||||
for( PCB_LAYER_ID layer : layers.Seq() )
|
||||
@ -416,13 +418,14 @@ bool ZONE_FILLER::Fill( const std::vector<ZONE*>& aZones, bool aCheck, wxWindow*
|
||||
|
||||
BOX2I bbox = pad->GetBoundingBox();
|
||||
VECTOR2I center = pad->GetPosition();
|
||||
unsigned netcode = pad->GetNetCode();
|
||||
int netcode = pad->GetNetCode();
|
||||
LSET layers = pad->GetLayerSet() & boardCuMask;
|
||||
|
||||
auto padTestFn = [&]( const ZONE* aZone ) -> bool
|
||||
{
|
||||
return aZone->Outline()->Contains( center );
|
||||
};
|
||||
auto padTestFn =
|
||||
[&]( const ZONE* aZone ) -> bool
|
||||
{
|
||||
return aZone->Outline()->Contains( center );
|
||||
};
|
||||
|
||||
for( PCB_LAYER_ID layer : layers.Seq() )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user