本文整理汇总了C++中PNS_LINE::AppendVia方法的典型用法代码示例。如果您正苦于以下问题:C++ PNS_LINE::AppendVia方法的具体用法?C++ PNS_LINE::AppendVia怎么用?C++ PNS_LINE::AppendVia使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PNS_LINE
的用法示例。
在下文中一共展示了PNS_LINE::AppendVia方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: buildInitialLine
bool PNS_LINE_PLACER::buildInitialLine( const VECTOR2I& aP, PNS_LINE& aHead )
{
SHAPE_LINE_CHAIN l;
if( m_p_start == aP )
{
l.Clear();
}
else
{
if( Settings().GetFreeAngleMode() && Settings().Mode() == RM_MarkObstacles )
{
l = SHAPE_LINE_CHAIN( m_p_start, aP );
}
else
{
l = m_direction.BuildInitialTrace( m_p_start, aP );
}
if( l.SegmentCount() > 1 && m_orthoMode )
{
VECTOR2I newLast = l.CSegment( 0 ).LineProject( l.CPoint( -1 ) );
l.Remove( -1, -1 );
l.Point( 1 ) = newLast;
}
}
aHead.SetShape( l );
if( !m_placingVia )
return true;
PNS_VIA v( makeVia( aP ) );
v.SetNet( aHead.Net() );
if( m_currentMode == RM_MarkObstacles )
{
aHead.AppendVia( v );
return true;
}
VECTOR2I force;
VECTOR2I lead = aP - m_p_start;
bool solidsOnly = ( m_currentMode != RM_Walkaround );
if( v.PushoutForce( m_currentNode, lead, force, solidsOnly, 40 ) )
{
SHAPE_LINE_CHAIN line = m_direction.BuildInitialTrace( m_p_start, aP + force );
aHead = PNS_LINE( aHead, line );
v.SetPos( v.Pos() + force );
return true;
}
return false; // via placement unsuccessful
}
示例2: rhWalkOnly
bool PNS_LINE_PLACER::rhWalkOnly( const VECTOR2I& aP, PNS_LINE& aNewHead )
{
PNS_LINE initTrack( m_head );
PNS_LINE walkFull;
int effort = 0;
bool rv = true, viaOk;
viaOk = buildInitialLine( aP, initTrack );
PNS_WALKAROUND walkaround( m_currentNode, Router() );
walkaround.SetSolidsOnly( false );
walkaround.SetIterationLimit( Settings().WalkaroundIterationLimit() );
PNS_WALKAROUND::WALKAROUND_STATUS wf = walkaround.Route( initTrack, walkFull, false );
switch( Settings().OptimizerEffort() )
{
case OE_LOW:
effort = 0;
break;
case OE_MEDIUM:
case OE_FULL:
effort = PNS_OPTIMIZER::MERGE_SEGMENTS;
break;
}
if( Settings().SmartPads() )
effort |= PNS_OPTIMIZER::SMART_PADS;
if( wf == PNS_WALKAROUND::STUCK )
{
walkFull = walkFull.ClipToNearestObstacle( m_currentNode );
rv = true;
}
else if( m_placingVia && viaOk )
{
walkFull.AppendVia( makeVia( walkFull.CPoint( -1 ) ) );
}
PNS_OPTIMIZER::Optimize( &walkFull, effort, m_currentNode );
if( m_currentNode->CheckColliding( &walkFull ) )
{
aNewHead = m_head;
return false;
}
m_head = walkFull;
aNewHead = walkFull;
return rv;
}