本文整理汇总了C++中TRACK::GetTrace方法的典型用法代码示例。如果您正苦于以下问题:C++ TRACK::GetTrace方法的具体用法?C++ TRACK::GetTrace怎么用?C++ TRACK::GetTrace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TRACK
的用法示例。
在下文中一共展示了TRACK::GetTrace方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RemoveMisConnectedTracks
bool PCB_EDIT_FRAME::RemoveMisConnectedTracks()
{
/* finds all track segments which are mis-connected (to more than one net).
* When such a bad segment is found, it is flagged to be removed.
* All tracks having at least one flagged segment are removed.
*/
TRACK* segment;
TRACK* other;
TRACK* next;
int net_code_s, net_code_e;
bool isModified = false;
for( segment = GetBoard()->m_Track; segment; segment = (TRACK*) segment->Next() )
{
segment->SetState( FLAG0, false );
// find the netcode for segment using anything connected to the "start" of "segment"
net_code_s = -1;
if( segment->start && segment->start->Type()==PCB_PAD_T )
{
// get the netcode of the pad to propagate.
net_code_s = ((D_PAD*)(segment->start))->GetNetCode();
}
else
{
other = segment->GetTrace( GetBoard()->m_Track, NULL, FLG_START );
if( other )
net_code_s = other->GetNetCode();
}
if( net_code_s < 0 )
continue; // the "start" of segment is not connected
// find the netcode for segment using anything connected to the "end" of "segment"
net_code_e = -1;
if( segment->end && segment->end->Type()==PCB_PAD_T )
{
net_code_e = ((D_PAD*)(segment->end))->GetNetCode();
}
else
{
other = segment->GetTrace( GetBoard()->m_Track, NULL, FLG_END );
if( other )
net_code_e = other->GetNetCode();
}
if( net_code_e < 0 )
continue; // the "end" of segment is not connected
// Netcodes do not agree, so mark the segment as "to be removed"
if( net_code_s != net_code_e )
{
segment->SetState( FLAG0, true );
}
}
// Remove tracks having a flagged segment
for( segment = GetBoard()->m_Track; segment; segment = next )
{
next = (TRACK*) segment->Next();
if( segment->GetState( FLAG0 ) ) // Segment is flagged to be removed
{
segment->SetState( FLAG0, false );
isModified = true;
GetBoard()->m_Status_Pcb = 0;
Remove_One_Track( NULL, segment );
// the current segment is deleted,
// we do not know the next "not yet tested" segment,
// so restart to the beginning
next = GetBoard()->m_Track;
}
}
return isModified;
}
示例2: deleteUnconnectedTracks
/*
* Delete dangling tracks
* Vias:
* If a via is only connected to a dangling track, it also will be removed
*/
bool TRACKS_CLEANER::deleteUnconnectedTracks()
{
if( m_Brd->m_Track == NULL )
return false;
bool modified = false;
bool item_erased = true;
while( item_erased ) // Iterate when at least one track is deleted
{
item_erased = false;
TRACK* next_track;
for( TRACK * track = m_Brd->m_Track; track ; track = next_track )
{
next_track = track->Next();
int flag_erase = 0; //Not connected indicator
int type_end = 0;
if( track->GetState( START_ON_PAD ) )
type_end |= START_ON_PAD;
if( track->GetState( END_ON_PAD ) )
type_end |= END_ON_PAD;
// if the track start point is not connected to a pad,
// test if this track start point is connected to another track
// For via test, an enhancement could be to test if connected
// to 2 items on different layers.
// Currently a via must be connected to 2 items, that can be on the same layer
LAYER_NUM top_layer, bottom_layer;
ZONE_CONTAINER* zone;
if( (type_end & START_ON_PAD ) == 0 )
{
TRACK* other = track->GetTrace( m_Brd->m_Track, NULL, FLG_START );
if( other == NULL ) // Test a connection to zones
{
if( track->Type() != PCB_VIA_T )
{
zone = m_Brd->HitTestForAnyFilledArea( track->GetStart(),
track->GetLayer(),
track->GetLayer(),
track->GetNetCode() );
}
else
{
((SEGVIA*)track)->LayerPair( &top_layer, &bottom_layer );
zone = m_Brd->HitTestForAnyFilledArea( track->GetStart(),
top_layer, bottom_layer,
track->GetNetCode() );
}
}
if( (other == NULL) && (zone == NULL) )
{
flag_erase |= 1;
}
else // segment, via or zone connected to this end
{
track->start = other;
// If a via is connected to this end,
// test if this via has a second item connected.
// If no, remove it with the current segment
if( other && other->Type() == PCB_VIA_T )
{
// search for another segment following the via
track->SetState( BUSY, true );
SEGVIA* via = (SEGVIA*) other;
other = via->GetTrace( m_Brd->m_Track, NULL, FLG_START );
if( other == NULL )
{
via->LayerPair( &top_layer, &bottom_layer );
zone = m_Brd->HitTestForAnyFilledArea( via->GetStart(),
bottom_layer,
top_layer,
via->GetNetCode() );
}
if( (other == NULL) && (zone == NULL) )
flag_erase |= 2;
track->SetState( BUSY, false );
}
}
}
// if track end point is not connected to a pad,
// test if this track end point is connected to an other track
if( (type_end & END_ON_PAD ) == 0 )
{
TRACK* other = track->GetTrace( m_Brd->m_Track, NULL, FLG_END );
//.........这里部分代码省略.........