Filter via selection based on render settings

Fixes: lp:1743894
* https://bugs.launchpad.net/kicad/+bug/1743894
This commit is contained in:
Jon Evans 2018-01-17 21:12:51 -05:00 committed by Maciej Suminski
parent 08b15a6990
commit 2b2612120c
4 changed files with 49 additions and 0 deletions

View File

@ -621,6 +621,9 @@ GENERAL_COLLECTORS_GUIDE PCB_BASE_FRAME::GetCollectorsGuide()
guide.SetIgnorePadsOnFront( ! m_Pcb->IsElementVisible( LAYER_PAD_FR ) );
guide.SetIgnoreModulesVals( ! m_Pcb->IsElementVisible( LAYER_MOD_VALUES ) );
guide.SetIgnoreModulesRefs( ! m_Pcb->IsElementVisible( LAYER_MOD_REFERENCES ) );
guide.SetIgnoreThroughVias( ! m_Pcb->IsElementVisible( LAYER_VIA_THROUGH ) );
guide.SetIgnoreBlindBuriedVias( ! m_Pcb->IsElementVisible( LAYER_VIA_BBLIND ) );
guide.SetIgnoreMicroVias( ! m_Pcb->IsElementVisible( LAYER_VIA_MICROVIA ) );
return guide;
}

View File

@ -366,6 +366,18 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
goto exit;
}
if( via )
{
auto type = via->GetViaType();
if( ( m_Guide->IgnoreThroughVias() && type == VIA_THROUGH ) ||
( m_Guide->IgnoreBlindBuriedVias() && type == VIA_BLIND_BURIED ) ||
( m_Guide->IgnoreMicroVias() && type == VIA_MICROVIA ) )
{
goto exit;
}
}
if( item->IsOnLayer( m_Guide->GetPreferredLayer() ) ||
m_Guide->IgnorePreferredLayer() )
{

View File

@ -163,6 +163,21 @@ public:
*/
virtual bool IgnoreModulesRefs() const = 0;
/**
* @return true if should ignore through-hole vias
*/
virtual bool IgnoreThroughVias() const = 0;
/**
* @return true if should ignore blind/buried vias
*/
virtual bool IgnoreBlindBuriedVias() const = 0;
/**
* @return true if should ignore micro vias
*/
virtual bool IgnoreMicroVias() const = 0;
/**
* @return bool - true if Inspect() should use BOARD_ITEM::HitTest()
* or false if Inspect() should use BOARD_ITEM::BoundsTest().
@ -375,6 +390,9 @@ private:
bool m_IgnorePadsOnBack;
bool m_IgnoreModulesVals;
bool m_IgnoreModulesRefs;
bool m_IgnoreThroughVias;
bool m_IgnoreBlindBuriedVias;
bool m_IgnoreMicroVias;
public:
@ -412,6 +430,10 @@ public:
m_IgnoreModulesVals = false;
m_IgnoreModulesRefs = false;
m_IgnoreThroughVias = false;
m_IgnoreBlindBuriedVias = false;
m_IgnoreMicroVias = false;
}
/**
@ -533,6 +555,15 @@ public:
*/
bool IgnoreModulesRefs() const override { return m_IgnoreModulesRefs; }
void SetIgnoreModulesRefs(bool ignore) { m_IgnoreModulesRefs = ignore; }
bool IgnoreThroughVias() const override { return m_IgnoreThroughVias; }
void SetIgnoreThroughVias( bool ignore ) { m_IgnoreThroughVias = ignore; }
bool IgnoreBlindBuriedVias() const override { return m_IgnoreBlindBuriedVias; }
void SetIgnoreBlindBuriedVias( bool ignore ) { m_IgnoreBlindBuriedVias = ignore; }
bool IgnoreMicroVias() const override { return m_IgnoreMicroVias; }
void SetIgnoreMicroVias( bool ignore ) { m_IgnoreMicroVias = ignore; }
};

View File

@ -434,6 +434,9 @@ const GENERAL_COLLECTORS_GUIDE SELECTION_TOOL::getCollectorsGuide() const
guide.SetIgnorePadsOnFront( ! board()->IsElementVisible( LAYER_PAD_FR ) );
guide.SetIgnoreModulesVals( ! board()->IsElementVisible( LAYER_MOD_VALUES ) );
guide.SetIgnoreModulesRefs( ! board()->IsElementVisible( LAYER_MOD_REFERENCES ) );
guide.SetIgnoreThroughVias( ! board()->IsElementVisible( LAYER_VIA_THROUGH ) );
guide.SetIgnoreBlindBuriedVias( ! board()->IsElementVisible( LAYER_VIA_BBLIND ) );
guide.SetIgnoreMicroVias( ! board()->IsElementVisible( LAYER_VIA_MICROVIA ) );
return guide;
}