A more discerning un-flashed-connectivity test.

(cherry picked from commit aa2c8e9b0c)
This commit is contained in:
Jeff Young 2022-02-20 23:49:02 +00:00
parent 680163f8a8
commit a5305aa235
3 changed files with 29 additions and 7 deletions

View File

@ -35,6 +35,8 @@
#include <connectivity/connectivity_algo.h>
#include <connectivity/from_to_cache.h>
#include <geometry/shape_segment.h>
#include <geometry/shape_circle.h>
#include <ratsnest/ratsnest_data.h>
#include <progress_reporter.h>
#include <trigo.h>
@ -378,7 +380,8 @@ void CONNECTIVITY_DATA::PropagateNets( BOARD_COMMIT* aCommit, PROPAGATE_MODE aMo
bool CONNECTIVITY_DATA::IsConnectedOnLayer( const BOARD_CONNECTED_ITEM *aItem, int aLayer,
std::vector<KICAD_T> aTypes, bool aIgnoreNets ) const
std::vector<KICAD_T> aTypes,
bool aCheckOptionalFlashing ) const
{
CN_CONNECTIVITY_ALGO::ITEM_MAP_ENTRY &entry = m_connAlgo->ItemEntry( aItem );
@ -397,11 +400,29 @@ bool CONNECTIVITY_DATA::IsConnectedOnLayer( const BOARD_CONNECTED_ITEM *aItem, i
{
if( connected->Valid()
&& connected->Layers().Overlaps( aLayer )
&& ( connected->Net() == aItem->GetNetCode() || aIgnoreNets )
&& matchType( connected->Parent()->Type() ) )
{
if( connected->Net() == aItem->GetNetCode() )
{
return true;
}
else if( aCheckOptionalFlashing && aItem->Type() == PCB_PAD_T )
{
const PAD* pad = static_cast<const PAD*>( aItem );
SHAPE_SEGMENT hole( *pad->GetEffectiveHoleShape() );
PCB_LAYER_ID layer = ToLAYER_ID( aLayer );
return connected->Parent()->GetEffectiveShape( layer )->Collide( &hole );
}
else if( aCheckOptionalFlashing && aItem->Type() == PCB_VIA_T )
{
const PCB_VIA* via = static_cast<const PCB_VIA*>( aItem );
SHAPE_CIRCLE hole( via->GetCenter(), via->GetDrillValue() / 2 );
PCB_LAYER_ID layer = ToLAYER_ID( aLayer );
return connected->Parent()->GetEffectiveShape( layer )->Collide( &hole );
}
}
}
}

View File

@ -202,7 +202,7 @@ public:
bool IsConnectedOnLayer( const BOARD_CONNECTED_ITEM* aItem,
int aLayer, std::vector<KICAD_T> aTypes = {},
bool aIgnoreNets = false ) const;
bool aCheckOptionalFlashing = false ) const;
unsigned int GetNodeCount( int aNet = -1 ) const;

View File

@ -492,9 +492,6 @@ bool PCB_VIA::FlashLayer( LSET aLayers ) const
bool PCB_VIA::FlashLayer( int aLayer ) const
{
std::vector<KICAD_T> types
{ PCB_TRACE_T, PCB_ARC_T, PCB_PAD_T, PCB_ZONE_T, PCB_FP_ZONE_T };
// Return the "normal" shape if the caller doesn't specify a particular layer
if( aLayer == UNDEFINED_LAYER )
return true;
@ -513,7 +510,11 @@ bool PCB_VIA::FlashLayer( int aLayer ) const
if( m_keepTopBottomLayer && ( aLayer == m_layer || aLayer == m_bottomLayer ) )
return true;
return board->GetConnectivity()->IsConnectedOnLayer( this, static_cast<int>( aLayer ), types );
// Must be static to keep from raising its ugly head in performance profiles
static std::vector<KICAD_T> connectedTypes = { PCB_TRACE_T, PCB_ARC_T, PCB_PAD_T,
PCB_ZONE_T, PCB_FP_ZONE_T };
return board->GetConnectivity()->IsConnectedOnLayer( this, aLayer, connectedTypes, true );
}