From 6989af7904272372b09515637d9c0dab948daa24 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Wed, 12 Aug 2015 21:12:13 +0200 Subject: [PATCH] Minor fixes (PNS). --- pcbnew/router/pns_item.h | 2 +- pcbnew/router/pns_itemset.cpp | 39 +++++++++++++++++++++++++++++++++-- pcbnew/router/pns_line.cpp | 4 ++-- 3 files changed, 40 insertions(+), 5 deletions(-) diff --git a/pcbnew/router/pns_item.h b/pcbnew/router/pns_item.h index eac581437f..8fefbe94ea 100644 --- a/pcbnew/router/pns_item.h +++ b/pcbnew/router/pns_item.h @@ -53,7 +53,7 @@ public: PNS_OBJECT(): m_owner( NULL ) {} - ~PNS_OBJECT() {}; + virtual ~PNS_OBJECT() {} /** * Functon SetOwner() diff --git a/pcbnew/router/pns_itemset.cpp b/pcbnew/router/pns_itemset.cpp index 65ce45a7b0..e31ad8ae68 100644 --- a/pcbnew/router/pns_itemset.cpp +++ b/pcbnew/router/pns_itemset.cpp @@ -71,7 +71,14 @@ PNS_ITEMSET& PNS_ITEMSET::FilterLayers( int aStart, int aEnd, bool aInvert ) BOOST_FOREACH( PNS_ITEM* item, m_items ) if( item->Layers().Overlaps( l ) ^ aInvert ) + { newItems.push_back( item ); + } + else + { + if( item->BelongsTo( this ) ) + item->SetOwner( NULL ); + } m_items = newItems; @@ -86,7 +93,14 @@ PNS_ITEMSET& PNS_ITEMSET::FilterKinds( int aKindMask, bool aInvert ) BOOST_FOREACH( PNS_ITEM* item, m_items ) { if( item->OfKind( aKindMask ) ^ aInvert ) + { newItems.push_back( item ); + } + else + { + if( item->BelongsTo( this ) ) + item->SetOwner( NULL ); + } } m_items = newItems; @@ -102,7 +116,14 @@ PNS_ITEMSET& PNS_ITEMSET::FilterMarker( int aMarker, bool aInvert ) BOOST_FOREACH( PNS_ITEM* item, m_items ) { if( item->Marker() & aMarker ) + { newItems.push_back( item ); + } + else + { + if( item->BelongsTo( this ) ) + item->SetOwner( NULL ); + } } m_items = newItems; @@ -118,7 +139,14 @@ PNS_ITEMSET& PNS_ITEMSET::FilterNet( int aNet, bool aInvert ) BOOST_FOREACH( PNS_ITEM* item, m_items ) { if( ( item->Net() == aNet ) ^ aInvert ) + { newItems.push_back( item ); + } + else + { + if( item->BelongsTo( this ) ) + item->SetOwner( NULL ); + } } m_items = newItems; @@ -133,8 +161,15 @@ PNS_ITEMSET& PNS_ITEMSET::ExcludeItem( const PNS_ITEM* aItem ) BOOST_FOREACH( PNS_ITEM* item, m_items ) { - if( item != aItem ) - newItems.push_back( item ); + if( item == aItem ) + { + if( item->BelongsTo( this ) ) + item->SetOwner( NULL ); + + break; + } + + newItems.push_back( item ); } m_items = newItems; diff --git a/pcbnew/router/pns_line.cpp b/pcbnew/router/pns_line.cpp index f6f7ec3043..80c175ebfe 100644 --- a/pcbnew/router/pns_line.cpp +++ b/pcbnew/router/pns_line.cpp @@ -41,7 +41,7 @@ PNS_LINE::PNS_LINE( const PNS_LINE& aOther ) : m_net = aOther.m_net; m_movable = aOther.m_movable; m_layers = aOther.m_layers; - m_owner = NULL; + m_owner = aOther.m_owner; m_via = aOther.m_via; m_hasVia = aOther.m_hasVia; m_marker = aOther.m_marker; @@ -146,7 +146,7 @@ PNS_SEGMENT* PNS_SEGMENT::Clone() const s->m_layers = m_layers; s->m_marker = m_marker; s->m_rank = m_rank; - s->m_owner = m_owner; + s->m_owner = NULL; return s; }