本文整理汇总了C++中PNS_SEGMENT::Width方法的典型用法代码示例。如果您正苦于以下问题:C++ PNS_SEGMENT::Width方法的具体用法?C++ PNS_SEGMENT::Width怎么用?C++ PNS_SEGMENT::Width使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PNS_SEGMENT
的用法示例。
在下文中一共展示了PNS_SEGMENT::Width方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
void ROUTER_PREVIEW_ITEM::Update( const PNS_ITEM* aItem )
{
m_originLayer = aItem->Layers().Start();
if( aItem->OfKind ( PNS_ITEM::LINE ) )
{
const PNS_LINE* l=static_cast<const PNS_LINE*>( aItem );
if( !l->SegmentCount() )
return;
}
assert( m_originLayer >= 0 );
m_layer = m_originLayer;
m_color = getLayerColor( m_originLayer );
m_color.a = 0.8;
m_depth = BaseOverlayDepth - aItem->Layers().Start();
m_shape = aItem->Shape()->Clone();
switch( aItem->Kind() )
{
case PNS_ITEM::LINE:
m_type = PR_SHAPE;
m_width = ( (PNS_LINE*) aItem )->Width();
break;
case PNS_ITEM::SEGMENT:
{
PNS_SEGMENT* seg = (PNS_SEGMENT*) aItem;
m_type = PR_SHAPE;
m_width = seg->Width();
break;
}
case PNS_ITEM::VIA:
m_originLayer = m_layer = ITEM_GAL_LAYER( VIAS_VISIBLE );
m_type = PR_SHAPE;
m_width = 0;
m_color = COLOR4D( 0.7, 0.7, 0.7, 0.8 );
m_depth = ViaOverlayDepth;
break;
case PNS_ITEM::SOLID:
m_type = PR_SHAPE;
m_width = 0;
break;
default:
break;
}
if( aItem->Marker() & MK_VIOLATION )
m_color = COLOR4D( 0, 1, 0, 1 );
if( aItem->Marker() & MK_HEAD )
m_color.Brighten( 0.7 );
ViewSetVisible( true );
ViewUpdate( GEOMETRY | APPEARANCE );
}
示例2: if
const VECTOR2I PNS_TOOL_BASE::snapToItem( PNS_ITEM* aItem, VECTOR2I aP, bool& aSplitsSegment )
{
VECTOR2I anchor;
if( !aItem )
{
aSplitsSegment = false;
return aP;
}
switch( aItem->Kind() )
{
case PNS_ITEM::SOLID:
anchor = static_cast<PNS_SOLID*>( aItem )->Pos();
aSplitsSegment = false;
break;
case PNS_ITEM::VIA:
anchor = static_cast<PNS_VIA*>( aItem )->Pos();
aSplitsSegment = false;
break;
case PNS_ITEM::SEGMENT:
{
PNS_SEGMENT* seg = static_cast<PNS_SEGMENT*>( aItem );
const SEG& s = seg->Seg();
int w = seg->Width();
aSplitsSegment = false;
if( ( aP - s.A ).EuclideanNorm() < w / 2 )
anchor = s.A;
else if( ( aP - s.B ).EuclideanNorm() < w / 2 )
anchor = s.B;
else
{
anchor = s.NearestPoint( aP );
aSplitsSegment = true;
anchor = m_gridHelper->AlignToSegment( aP, s );
aSplitsSegment = ( anchor != s.A && anchor != s.B );
}
break;
}
default:
break;
}
return anchor;
}
示例3: 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;
}
}
示例4: CommitRouting
void PNS_ROUTER::CommitRouting( PNS_NODE* aNode )
{
PNS_NODE::ITEM_VECTOR removed, added;
aNode->GetUpdatedItems( removed, added );
for( unsigned int i = 0; i < removed.size(); i++ )
{
BOARD_CONNECTED_ITEM* parent = removed[i]->Parent();
if( parent )
{
m_view->Remove( parent );
m_board->Remove( parent );
m_undoBuffer.PushItem( ITEM_PICKER( parent, UR_DELETED ) );
}
}
for( PNS_ITEM* item : added )
{
BOARD_CONNECTED_ITEM* newBI = NULL;
switch( item->Kind() )
{
case PNS_ITEM::SEGMENT:
{
PNS_SEGMENT* seg = static_cast<PNS_SEGMENT*>( item );
TRACK* track = new TRACK( m_board );
const SEG& s = seg->Seg();
track->SetStart( wxPoint( s.A.x, s.A.y ) );
track->SetEnd( wxPoint( s.B.x, s.B.y ) );
track->SetWidth( seg->Width() );
track->SetLayer( ToLAYER_ID( seg->Layers().Start() ) );
track->SetNetCode( seg->Net() > 0 ? seg->Net() : 0 );
newBI = track;
break;
}
case PNS_ITEM::VIA:
{
VIA* via_board = new VIA( m_board );
PNS_VIA* via = static_cast<PNS_VIA*>( item );
via_board->SetPosition( wxPoint( via->Pos().x, via->Pos().y ) );
via_board->SetWidth( via->Diameter() );
via_board->SetDrill( via->Drill() );
via_board->SetNetCode( via->Net() > 0 ? via->Net() : 0 );
via_board->SetViaType( via->ViaType() ); // MUST be before SetLayerPair()
via_board->SetLayerPair( ToLAYER_ID( via->Layers().Start() ),
ToLAYER_ID( via->Layers().End() ) );
newBI = via_board;
break;
}
default:
break;
}
if( newBI )
{
item->SetParent( newBI );
newBI->ClearFlags();
m_view->Add( newBI );
m_board->Add( newBI );
m_undoBuffer.PushItem( ITEM_PICKER( newBI, UR_NEW ) );
newBI->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
}
}
m_board->GetRatsnest()->Recalculate();
m_world->Commit( aNode );
}