A more discerning un-flashed-connectivity test.

This commit is contained in:
Jeff Young 2022-02-20 23:49:02 +00:00
parent 78ae3d286a
commit aa2c8e9b0c
3 changed files with 25 additions and 4 deletions

View File

@ -35,6 +35,8 @@
#include <connectivity/connectivity_algo.h> #include <connectivity/connectivity_algo.h>
#include <connectivity/from_to_cache.h> #include <connectivity/from_to_cache.h>
#include <geometry/shape_segment.h>
#include <geometry/shape_circle.h>
#include <ratsnest/ratsnest_data.h> #include <ratsnest/ratsnest_data.h>
#include <progress_reporter.h> #include <progress_reporter.h>
#include <trigo.h> #include <trigo.h>
@ -388,7 +390,8 @@ void CONNECTIVITY_DATA::PropagateNets( BOARD_COMMIT* aCommit, PROPAGATE_MODE aMo
bool CONNECTIVITY_DATA::IsConnectedOnLayer( const BOARD_CONNECTED_ITEM *aItem, int aLayer, 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 ); CN_CONNECTIVITY_ALGO::ITEM_MAP_ENTRY &entry = m_connAlgo->ItemEntry( aItem );
@ -407,10 +410,28 @@ bool CONNECTIVITY_DATA::IsConnectedOnLayer( const BOARD_CONNECTED_ITEM *aItem, i
{ {
if( connected->Valid() if( connected->Valid()
&& connected->Layers().Overlaps( aLayer ) && connected->Layers().Overlaps( aLayer )
&& ( connected->Net() == aItem->GetNetCode() || aIgnoreNets )
&& matchType( connected->Parent()->Type() ) ) && matchType( connected->Parent()->Type() ) )
{ {
if( connected->Net() == aItem->GetNetCode() )
{
return true; 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, bool IsConnectedOnLayer( const BOARD_CONNECTED_ITEM* aItem,
int aLayer, std::vector<KICAD_T> aTypes = {}, int aLayer, std::vector<KICAD_T> aTypes = {},
bool aIgnoreNets = false ) const; bool aCheckOptionalFlashing = false ) const;
unsigned int GetNodeCount( int aNet = -1 ) const; unsigned int GetNodeCount( int aNet = -1 ) const;

View File

@ -548,7 +548,7 @@ bool PCB_VIA::FlashLayer( int aLayer ) const
static std::vector<KICAD_T> connectedTypes = { PCB_TRACE_T, PCB_ARC_T, PCB_PAD_T, static std::vector<KICAD_T> connectedTypes = { PCB_TRACE_T, PCB_ARC_T, PCB_PAD_T,
PCB_ZONE_T, PCB_FP_ZONE_T }; PCB_ZONE_T, PCB_FP_ZONE_T };
return board->GetConnectivity()->IsConnectedOnLayer( this, aLayer, connectedTypes ); return board->GetConnectivity()->IsConnectedOnLayer( this, aLayer, connectedTypes, true );
} }