kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #33312
[PATCH] Filter via selection based on render settings
Fixes: https://bugs.launchpad.net/kicad/+bug/1743894
-Jon
From 990b0696f7e325959010b9caacf7675ce3508cfc Mon Sep 17 00:00:00 2001
From: Jon Evans <jon@xxxxxxxxxxxxx>
Date: Wed, 17 Jan 2018 21:12:51 -0500
Subject: [PATCH] Filter via selection based on render settings
Fixes: lp:1743894
* https://bugs.launchpad.net/kicad/+bug/1743894
---
pcbnew/basepcbframe.cpp | 3 +++
pcbnew/collectors.cpp | 12 ++++++++++++
pcbnew/collectors.h | 31 +++++++++++++++++++++++++++++++
pcbnew/tools/selection_tool.cpp | 3 +++
4 files changed, 49 insertions(+)
diff --git a/pcbnew/basepcbframe.cpp b/pcbnew/basepcbframe.cpp
index a096852ae..7ab39de56 100644
--- a/pcbnew/basepcbframe.cpp
+++ b/pcbnew/basepcbframe.cpp
@@ -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;
}
diff --git a/pcbnew/collectors.cpp b/pcbnew/collectors.cpp
index e3dcb5425..ba1e509af 100644
--- a/pcbnew/collectors.cpp
+++ b/pcbnew/collectors.cpp
@@ -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() )
{
diff --git a/pcbnew/collectors.h b/pcbnew/collectors.h
index 7ca12d0fa..1a75b9a99 100644
--- a/pcbnew/collectors.h
+++ b/pcbnew/collectors.h
@@ -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; }
};
diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp
index 230a023de..5e1db9b23 100644
--- a/pcbnew/tools/selection_tool.cpp
+++ b/pcbnew/tools/selection_tool.cpp
@@ -431,6 +431,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;
}
--
2.14.1
Follow ups