本文整理汇总了C++中PNS_LINE::Width方法的典型用法代码示例。如果您正苦于以下问题:C++ PNS_LINE::Width方法的具体用法?C++ PNS_LINE::Width怎么用?C++ PNS_LINE::Width使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PNS_LINE
的用法示例。
在下文中一共展示了PNS_LINE::Width方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Log
void PNS_LOGGER::Log ( const PNS_ITEM* aItem, int aKind, const std::string aName )
{
m_theLog << "aItem " << aKind << " " << aName << " ";
m_theLog << aItem->Net() << " " << aItem->Layers().Start() << " " <<
aItem->Layers().End() << " " << aItem->Marker() << " " << aItem->Rank();
switch( aItem->Kind() )
{
case PNS_ITEM::LINE:
{
PNS_LINE* l = (PNS_LINE*) aItem;
m_theLog << " line ";
m_theLog << l->Width() << " " << ( l->EndsWithVia() ? 1 : 0 ) << " ";
dumpShape ( l->Shape() );
m_theLog << std::endl;
break;
}
case PNS_ITEM::VIA:
{
m_theLog << " via 0 0 ";
dumpShape ( aItem->Shape() );
m_theLog << std::endl;
break;
}
case PNS_ITEM::SEGMENT:
{
PNS_SEGMENT* s =(PNS_SEGMENT*) aItem;
m_theLog << " line ";
m_theLog << s->Width() << " 0 linechain 2 0 " << s->Seg().A.x << " " <<
s->Seg().A.y << " " << s->Seg().B.x << " " <<s->Seg().B.y << std::endl;
break;
}
case PNS_ITEM::SOLID:
{
PNS_SOLID* s = (PNS_SOLID*) aItem;
m_theLog << " solid 0 0 ";
dumpShape( s->Shape() );
m_theLog << std::endl;
break;
}
default:
break;
}
}
示例2: AssembleDiffPair
bool PNS_TOPOLOGY::AssembleDiffPair( PNS_ITEM* aStart, PNS_DIFF_PAIR& aPair )
{
int refNet = aStart->Net();
int coupledNet = DpCoupledNet( refNet );
if( coupledNet < 0 )
return false;
std::set<PNS_ITEM*> coupledItems;
m_world->AllItemsInNet( coupledNet, coupledItems );
PNS_SEGMENT* coupledSeg = NULL, *refSeg;
int minDist = std::numeric_limits<int>::max();
if( ( refSeg = dyn_cast<PNS_SEGMENT*>( aStart ) ) != NULL )
{
for( PNS_ITEM* item : coupledItems )
{
if( PNS_SEGMENT* s = dyn_cast<PNS_SEGMENT*>( item ) )
{
if( s->Layers().Start() == refSeg->Layers().Start() && s->Width() == refSeg->Width() )
{
int dist = s->Seg().Distance( refSeg->Seg() );
bool isParallel = refSeg->Seg().ApproxParallel( s->Seg() );
SEG p_clip, n_clip;
bool isCoupled = commonParallelProjection( refSeg->Seg(), s->Seg(), p_clip, n_clip );
if( isParallel && isCoupled && dist < minDist )
{
minDist = dist;
coupledSeg = s;
}
}
}
}
}
else
{
return false;
}
if( !coupledSeg )
return false;
PNS_LINE lp = m_world->AssembleLine( refSeg );
PNS_LINE ln = m_world->AssembleLine( coupledSeg );
if( DpNetPolarity( refNet ) < 0 )
{
std::swap( lp, ln );
}
int gap = -1;
if( refSeg->Seg().ApproxParallel( coupledSeg->Seg() ) )
{
// Segments are parallel -> compute pair gap
const VECTOR2I refDir = refSeg->Anchor( 1 ) - refSeg->Anchor( 0 );
const VECTOR2I displacement = refSeg->Anchor( 1 ) - coupledSeg->Anchor( 1 );
gap = (int) std::abs( refDir.Cross( displacement ) / refDir.EuclideanNorm() ) - lp.Width();
}
aPair = PNS_DIFF_PAIR( lp, ln );
aPair.SetWidth( lp.Width() );
aPair.SetLayers( lp.Layers() );
aPair.SetGap( gap );
return true;
}
示例3: FixRoute
bool PNS_LINE_PLACER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem )
{
bool realEnd = false;
int lastV;
PNS_LINE pl = Trace();
if( m_currentMode == RM_MarkObstacles &&
!Settings().CanViolateDRC() &&
m_world->CheckColliding( &pl ) )
return false;
const SHAPE_LINE_CHAIN& l = pl.CLine();
if( !l.SegmentCount() )
{
if( pl.EndsWithVia() )
{
m_lastNode->Add( pl.Via().Clone() );
Router()->CommitRouting( m_lastNode );
m_lastNode = NULL;
m_currentNode = NULL;
m_idle = true;
}
return true;
}
VECTOR2I p_pre_last = l.CPoint( -1 );
const VECTOR2I p_last = l.CPoint( -1 );
DIRECTION_45 d_last( l.CSegment( -1 ) );
if( l.PointCount() > 2 )
p_pre_last = l.CPoint( -2 );
if( aEndItem && m_currentNet >= 0 && m_currentNet == aEndItem->Net() )
realEnd = true;
if( realEnd || m_placingVia )
lastV = l.SegmentCount();
else
lastV = std::max( 1, l.SegmentCount() - 1 );
PNS_SEGMENT* lastSeg = NULL;
for( int i = 0; i < lastV; i++ )
{
const SEG& s = pl.CSegment( i );
PNS_SEGMENT* seg = new PNS_SEGMENT( s, m_currentNet );
seg->SetWidth( pl.Width() );
seg->SetLayer( m_currentLayer );
m_lastNode->Add( seg );
lastSeg = seg;
}
if( pl.EndsWithVia() )
m_lastNode->Add( pl.Via().Clone() );
if( realEnd )
simplifyNewLine( m_lastNode, lastSeg );
Router()->CommitRouting( m_lastNode );
m_lastNode = NULL;
m_currentNode = NULL;
if( !realEnd )
{
setInitialDirection( d_last );
m_currentStart = m_placingVia ? p_last : p_pre_last;
m_startItem = NULL;
m_placingVia = false;
m_chainedPlacement = !pl.EndsWithVia();
m_splitSeg = false;
initPlacement();
}
else
{
m_idle = true;
}
return realEnd;
}