diff --git a/pcbnew/router/pns_item.cpp b/pcbnew/router/pns_item.cpp index 6bb07b8258..b4be3c5d04 100644 --- a/pcbnew/router/pns_item.cpp +++ b/pcbnew/router/pns_item.cpp @@ -125,11 +125,11 @@ bool ITEM::collideSimple( const ITEM* aHead, const NODE* aNode, { clearance = 0; // keepouts are exact boundary; no clearance } - else if( iface && !iface->IsFlashedOnLayer( this, aHead->Layer() ) ) + else if( iface && !iface->IsFlashedOnLayer( this, aHead->Layers() ) ) { clearance = -1; } - else if( iface && !iface->IsFlashedOnLayer( aHead, Layer() ) ) + else if( iface && !iface->IsFlashedOnLayer( aHead, Layers() ) ) { clearance = -1; } diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp index 93c4123e0c..d67a5da1d3 100644 --- a/pcbnew/router/pns_kicad_iface.cpp +++ b/pcbnew/router/pns_kicad_iface.cpp @@ -1418,6 +1418,50 @@ bool PNS_KICAD_IFACE_BASE::IsFlashedOnLayer( const PNS::ITEM* aItem, int aLayer } +bool PNS_KICAD_IFACE_BASE::IsFlashedOnLayer( const PNS::ITEM* aItem, + const LAYER_RANGE& aLayer ) const +{ + LAYER_RANGE test = aItem->Layers().Intersection( aLayer ); + + if( aItem->Parent() ) + { + switch( aItem->Parent()->Type() ) + { + case PCB_VIA_T: + { + const PCB_VIA* via = static_cast( aItem->Parent() ); + + for( int layer = test.Start(); layer <= test.End(); ++layer ) + { + if( via->FlashLayer( ToLAYER_ID( layer ) ) ) + return true; + } + + return false; + } + + case PCB_PAD_T: + { + const PAD* pad = static_cast( aItem->Parent() ); + + for( int layer = test.Start(); layer <= test.End(); ++layer ) + { + if( pad->FlashLayer( ToLAYER_ID( layer ) ) ) + return true; + } + + return false; + } + + default: + break; + } + } + + return test.Start() <= test.End(); +} + + bool PNS_KICAD_IFACE::IsItemVisible( const PNS::ITEM* aItem ) const { // by default, all items are visible (new ones created by the router have parent == NULL diff --git a/pcbnew/router/pns_kicad_iface.h b/pcbnew/router/pns_kicad_iface.h index 16b0151ee5..9ab09ba01e 100644 --- a/pcbnew/router/pns_kicad_iface.h +++ b/pcbnew/router/pns_kicad_iface.h @@ -59,6 +59,7 @@ public: void SyncWorld( PNS::NODE* aWorld ) override; bool IsAnyLayerVisible( const LAYER_RANGE& aLayer ) const override { return true; }; bool IsFlashedOnLayer( const PNS::ITEM* aItem, int aLayer ) const override; + bool IsFlashedOnLayer( const PNS::ITEM* aItem, const LAYER_RANGE& aLayer ) const override; bool IsItemVisible( const PNS::ITEM* aItem ) const override { return true; }; void HideItem( PNS::ITEM* aItem ) override {} void DisplayItem( const PNS::ITEM* aItem, int aClearance, bool aEdit = false, diff --git a/pcbnew/router/pns_router.h b/pcbnew/router/pns_router.h index 4aba9f2d3a..1c2b2928a0 100644 --- a/pcbnew/router/pns_router.h +++ b/pcbnew/router/pns_router.h @@ -96,6 +96,7 @@ enum DRAG_MODE virtual bool IsAnyLayerVisible( const LAYER_RANGE& aLayer ) const = 0; virtual bool IsItemVisible( const PNS::ITEM* aItem ) const = 0; virtual bool IsFlashedOnLayer( const PNS::ITEM* aItem, int aLayer ) const = 0; + virtual bool IsFlashedOnLayer( const PNS::ITEM* aItem, const LAYER_RANGE& aLayer ) const = 0; virtual void DisplayItem( const ITEM* aItem, int aClearance, bool aEdit = false, bool aIsHeadTrace = false ) = 0; virtual void DisplayPathLine( const SHAPE_LINE_CHAIN& aLine, int aImportance ) = 0; virtual void DisplayRatline( const SHAPE_LINE_CHAIN& aRatline, int aNetCode ) = 0;