void PNS_LINE_PLACER::simplifyNewLine( PNS_NODE* aNode, PNS_SEGMENT* aLatest ) { PNS_LINE l = aNode->AssembleLine( aLatest ); SHAPE_LINE_CHAIN simplified( l.CLine() ); simplified.Simplify(); if( simplified.PointCount() != l.PointCount() ) { PNS_LINE lnew( l ); aNode->Remove( &l ); lnew.SetShape( simplified ); aNode->Add( &lnew ); } }
bool PNS_TOPOLOGY::SimplifyLine( PNS_LINE* aLine ) { if( !aLine->LinkedSegments() || !aLine->SegmentCount() ) return false; PNS_SEGMENT* root = ( *aLine->LinkedSegments() )[0]; PNS_LINE l = m_world->AssembleLine( root ); SHAPE_LINE_CHAIN simplified( l.CLine() ); simplified.Simplify(); if( simplified.PointCount() != l.PointCount() ) { PNS_LINE lnew( l ); m_world->Remove( &l ); lnew.SetShape( simplified ); m_world->Add( &lnew ); return true; } return false; }
bool PNS_LINE_PLACER::Move( const VECTOR2I& aP, PNS_ITEM* aEndItem ) { PNS_LINE current; VECTOR2I p = aP; int eiDepth = -1; if( aEndItem && aEndItem->Owner() ) eiDepth = aEndItem->Owner()->Depth(); if( m_lastNode ) { delete m_lastNode; m_lastNode = NULL; } route( p ); current = Trace(); if( !current.PointCount() ) m_currentEnd = m_p_start; else m_currentEnd = current.CLine().CPoint( -1 ); PNS_NODE* latestNode = m_currentNode; m_lastNode = latestNode->Branch(); if( eiDepth >= 0 && aEndItem && latestNode->Depth() > eiDepth && current.SegmentCount() ) { splitAdjacentSegments( m_lastNode, aEndItem, current.CPoint( -1 ) ); if( Settings().RemoveLoops() ) removeLoops( m_lastNode, ¤t ); } updateLeadingRatLine(); return true; }