From 70ed5c1ae82322fe06d5bb370f16667e050792f7 Mon Sep 17 00:00:00 2001 From: Tomasz Wlostowski Date: Thu, 3 Jun 2021 22:30:00 +0200 Subject: [PATCH] router: introduce concept of 'virtual' vias as a base for shoving/dragging joints of lines of different widths. --- pcbnew/router/pns_item.h | 8 ++++++++ pcbnew/router/pns_via.cpp | 1 + pcbnew/router/pns_via.h | 16 ++++++++++++++++ 3 files changed, 25 insertions(+) diff --git a/pcbnew/router/pns_item.h b/pcbnew/router/pns_item.h index f59ccb8892..cbcca0b7b1 100644 --- a/pcbnew/router/pns_item.h +++ b/pcbnew/router/pns_item.h @@ -80,6 +80,7 @@ public: m_marker = 0; m_rank = -1; m_routable = true; + m_isVirtual = false; } ITEM( const ITEM& aOther ) @@ -93,6 +94,7 @@ public: m_marker = aOther.m_marker; m_rank = aOther.m_rank; m_routable = aOther.m_routable; + m_isVirtual = aOther.m_isVirtual; } virtual ~ITEM(); @@ -228,6 +230,11 @@ public: void SetRoutable( bool aRoutable ) { m_routable = aRoutable; } bool IsRoutable() const { return m_routable; } + bool IsVirtual() const + { + return m_isVirtual; + } + private: bool collideSimple( const ITEM* aOther, const NODE* aNode, bool aDifferentNetsOnly ) const; @@ -243,6 +250,7 @@ protected: mutable int m_marker; int m_rank; bool m_routable; + bool m_isVirtual; }; template diff --git a/pcbnew/router/pns_via.cpp b/pcbnew/router/pns_via.cpp index 45d141919a..a11f601ef9 100644 --- a/pcbnew/router/pns_via.cpp +++ b/pcbnew/router/pns_via.cpp @@ -100,6 +100,7 @@ VIA* VIA::Clone() const v->m_viaType = m_viaType; v->m_parent = m_parent; v->m_isFree = m_isFree; + v->m_isVirtual = m_isVirtual; return v; } diff --git a/pcbnew/router/pns_via.h b/pcbnew/router/pns_via.h index 116dfb492c..5f214ca011 100644 --- a/pcbnew/router/pns_via.h +++ b/pcbnew/router/pns_via.h @@ -55,6 +55,7 @@ public: m_drill = 0; m_viaType = VIATYPE::THROUGH; m_isFree = false; + m_isVirtual = false; } VIA( const VECTOR2I& aPos, const LAYER_RANGE& aLayers, int aDiameter, int aDrill, @@ -70,6 +71,7 @@ public: m_hole = SHAPE_CIRCLE( m_pos, aDrill / 2 ); m_viaType = aViaType; m_isFree = false; + m_isVirtual = false; } VIA( const VIA& aB ) : @@ -86,6 +88,7 @@ public: m_drill = aB.m_drill; m_viaType = aB.m_viaType; m_isFree = aB.m_isFree; + m_isVirtual = aB.m_isVirtual; } static inline bool ClassOf( const ITEM* aItem ) @@ -154,6 +157,19 @@ private: SHAPE_CIRCLE m_hole; VIATYPE m_viaType; bool m_isFree; + +}; + + +class VVIA : public VIA +{ +public: + VVIA( const VECTOR2I& aPos, int aLayer, int aDiameter, int aNet ) : + VIA( aPos, LAYER_RANGE( aLayer, aLayer ), aDiameter, aDiameter / 2, aNet ) + { + m_isVirtual = true; + SetHole( SHAPE_CIRCLE( Pos(), 1 ) ); + } }; }