diff --git a/pcbnew/router/pns_joint.h b/pcbnew/router/pns_joint.h index 21b1707868..df06458f65 100644 --- a/pcbnew/router/pns_joint.h +++ b/pcbnew/router/pns_joint.h @@ -71,7 +71,7 @@ public: m_tag.net = aB.m_tag.net; m_linkedItems = aB.m_linkedItems; m_layers = aB.m_layers; - m_locked = false; + m_locked = aB.m_locked; } PNS_ITEM* Clone( ) const @@ -194,6 +194,9 @@ public: m_layers.Merge( aJoint.m_layers ); + if( aJoint.IsLocked() ) + m_locked = true; + BOOST_FOREACH( PNS_ITEM* item, aJoint.LinkList() ) { m_linkedItems.Add( item ); diff --git a/pcbnew/router/pns_line_placer.cpp b/pcbnew/router/pns_line_placer.cpp index 2622903a2c..b51a50ac55 100644 --- a/pcbnew/router/pns_line_placer.cpp +++ b/pcbnew/router/pns_line_placer.cpp @@ -871,6 +871,10 @@ bool PNS_LINE_PLACER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem ) { m_lastNode->Add( pl.Via().Clone() ); Router()->CommitRouting( m_lastNode ); + + m_lastNode = NULL; + m_currentNode = NULL; + m_idle = true; } @@ -913,6 +917,7 @@ bool PNS_LINE_PLACER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem ) Router()->CommitRouting( m_lastNode ); m_lastNode = NULL; + m_currentNode = NULL; if( !realEnd ) { diff --git a/pcbnew/router/pns_node.cpp b/pcbnew/router/pns_node.cpp index 8cf2441b09..fa99dd82a2 100644 --- a/pcbnew/router/pns_node.cpp +++ b/pcbnew/router/pns_node.cpp @@ -111,7 +111,7 @@ PNS_NODE* PNS_NODE::Branch() TRACE( 0, "PNS_NODE::branch %p (parent %p)", child % this ); - m_children.push_back( child ); + m_children.insert( child ); child->m_depth = m_depth + 1; child->m_parent = this; @@ -145,15 +145,7 @@ void PNS_NODE::unlinkParent() if( isRoot() ) return; - for( std::vector::iterator i = m_parent->m_children.begin(); - i != m_parent->m_children.end(); ++i ) - { - if( *i == this ) - { - m_parent->m_children.erase( i ); - return; - } - } + m_parent->m_children.erase( this ); } @@ -1125,7 +1117,7 @@ void PNS_NODE::GetUpdatedItems( ITEM_VECTOR& aRemoved, ITEM_VECTOR& aAdded ) void PNS_NODE::releaseChildren() { // copy the kids as the PNS_NODE destructor erases the item from the parent node. - std::vector kids = m_children; + std::set kids = m_children; BOOST_FOREACH( PNS_NODE* node, kids ) { diff --git a/pcbnew/router/pns_node.h b/pcbnew/router/pns_node.h index 2ded9b5939..2c52f6aee4 100644 --- a/pcbnew/router/pns_node.h +++ b/pcbnew/router/pns_node.h @@ -383,6 +383,11 @@ public: PNS_ITEM* FindItemByParent( const BOARD_CONNECTED_ITEM *aParent ); + bool HasChildren() const + { + return !m_children.empty(); + } + private: struct OBSTACLE_VISITOR; typedef boost::unordered_multimap JOINT_MAP; @@ -454,7 +459,7 @@ private: PNS_NODE* m_root; ///> list of nodes branched from this one - std::vector m_children; + std::set m_children; ///> hash of root's items that have been changed in this node boost::unordered_set m_override; diff --git a/pcbnew/router/pns_shove.cpp b/pcbnew/router/pns_shove.cpp index a2f513567d..07b977915c 100644 --- a/pcbnew/router/pns_shove.cpp +++ b/pcbnew/router/pns_shove.cpp @@ -963,7 +963,7 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::shoveIteration( int aIter ) } } else - { // "forward" collisoins + { // "forward" collisions switch( ni->Kind() ) { case PNS_ITEM::SEGMENT: @@ -1098,17 +1098,23 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::ShoveLines( const PNS_LINE& aCurrentHead ) } if( !pushLine( head ) ) + { + delete m_currentNode; + m_currentNode = parent; + return SH_INCOMPLETE; + } st = shoveMainLoop(); - - if( ( st == SH_OK || st == SH_HEAD_MODIFIED ) ) + if( st == SH_OK ) + { runOptimizer( m_currentNode ); - if( m_newHead && st == SH_OK ) - { - st = SH_HEAD_MODIFIED; + if( m_newHead ) + st = m_currentNode->CheckColliding( &(*m_newHead) ) ? SH_INCOMPLETE : SH_HEAD_MODIFIED; + else + st = m_currentNode->CheckColliding( &head ) ? SH_INCOMPLETE : SH_OK; } m_currentNode->RemoveByMarker( MK_HEAD );