Fix PNS_KICAD_IFACE_BASE::IsFlashedOnLayer() to be able to handle multi-layer queries.
This commit is contained in:
parent
0be01f3c24
commit
2d13ddc70c
|
@ -125,11 +125,11 @@ bool ITEM::collideSimple( const ITEM* aHead, const NODE* aNode,
|
||||||
{
|
{
|
||||||
clearance = 0; // keepouts are exact boundary; no clearance
|
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;
|
clearance = -1;
|
||||||
}
|
}
|
||||||
else if( iface && !iface->IsFlashedOnLayer( aHead, Layer() ) )
|
else if( iface && !iface->IsFlashedOnLayer( aHead, Layers() ) )
|
||||||
{
|
{
|
||||||
clearance = -1;
|
clearance = -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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<const PCB_VIA*>( 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<const PAD*>( 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
|
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
|
// by default, all items are visible (new ones created by the router have parent == NULL
|
||||||
|
|
|
@ -58,6 +58,7 @@ public:
|
||||||
void SyncWorld( PNS::NODE* aWorld ) override;
|
void SyncWorld( PNS::NODE* aWorld ) override;
|
||||||
bool IsAnyLayerVisible( const LAYER_RANGE& aLayer ) const override { return true; };
|
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, 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; };
|
bool IsItemVisible( const PNS::ITEM* aItem ) const override { return true; };
|
||||||
void HideItem( PNS::ITEM* aItem ) override {}
|
void HideItem( PNS::ITEM* aItem ) override {}
|
||||||
void DisplayItem( const PNS::ITEM* aItem, int aClearance, bool aEdit = false,
|
void DisplayItem( const PNS::ITEM* aItem, int aClearance, bool aEdit = false,
|
||||||
|
|
|
@ -96,6 +96,7 @@ enum DRAG_MODE
|
||||||
virtual bool IsAnyLayerVisible( const LAYER_RANGE& aLayer ) const = 0;
|
virtual bool IsAnyLayerVisible( const LAYER_RANGE& aLayer ) const = 0;
|
||||||
virtual bool IsItemVisible( const PNS::ITEM* aItem ) 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, 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 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 DisplayPathLine( const SHAPE_LINE_CHAIN& aLine, int aImportance ) = 0;
|
||||||
virtual void DisplayRatline( const SHAPE_LINE_CHAIN& aRatline, int aNetCode ) = 0;
|
virtual void DisplayRatline( const SHAPE_LINE_CHAIN& aRatline, int aNetCode ) = 0;
|
||||||
|
|
Loading…
Reference in New Issue