Renamed BOARD_CONNECTED_ITEM::GetNet() -> GetNetCode()

Renamed BOARD_CONNECTED_ITEM::SetNet() -> SetNetCode()
Added BOARD_CONNECTED_ITEM::GetNet() for accessing NETINFO_ITEM* of a given item.
Fixed module editor crash when launched to edit a module from a PCB.
Replaced some BOARD::FindNet( item->GetNet() ) calls with BOARD_CONNECTED_ITEM::GetNet().
This commit is contained in:
Maciej Suminski 2014-02-25 11:40:34 +01:00
parent 151826b206
commit 75026d8754
58 changed files with 310 additions and 319 deletions

View File

@ -103,7 +103,7 @@ void PCB_EDIT_FRAME::Attribut_net( wxDC* DC, int net_code, bool Flag_On )
{ {
for( ; Track != NULL; Track = Track->Next() ) for( ; Track != NULL; Track = Track->Next() )
{ {
if( net_code == Track->GetNet() ) if( net_code == Track->GetNetCode() )
break; break;
} }
} }
@ -112,7 +112,7 @@ void PCB_EDIT_FRAME::Attribut_net( wxDC* DC, int net_code, bool Flag_On )
while( Track ) /* Flag change */ while( Track ) /* Flag change */
{ {
if( (net_code >= 0 ) && (net_code != Track->GetNet()) ) if( ( net_code >= 0 ) && ( net_code != Track->GetNetCode() ) )
break; break;
OnModify(); OnModify();

View File

@ -499,7 +499,7 @@ int genPlacementRoutingMatrix( BOARD* aBrd, EDA_MSG_PANEL* messagePanel )
TRACK TmpSegm( NULL ); TRACK TmpSegm( NULL );
TmpSegm.SetLayer( UNDEFINED_LAYER ); TmpSegm.SetLayer( UNDEFINED_LAYER );
TmpSegm.SetNet( -1 ); TmpSegm.SetNetCode( -1 );
TmpSegm.SetWidth( RoutingMatrix.m_GridRouting / 2 ); TmpSegm.SetWidth( RoutingMatrix.m_GridRouting / 2 );
EDA_ITEM* PtStruct = aBrd->m_Drawings; EDA_ITEM* PtStruct = aBrd->m_Drawings;

View File

@ -78,7 +78,7 @@ void PCB_EDIT_FRAME::Autoroute( wxDC* DC, int mode )
{ {
case PCB_PAD_T: case PCB_PAD_T:
Pad = (D_PAD*) GetScreen()->GetCurItem(); Pad = (D_PAD*) GetScreen()->GetCurItem();
autoroute_net_code = Pad->GetNet(); autoroute_net_code = Pad->GetNetCode();
break; break;
default: default:

View File

@ -215,7 +215,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
{ {
D_PAD* pad = aPcb->GetPad( i ); D_PAD* pad = aPcb->GetPad( i );
if( net_code != pad->GetNet() || (flag & FORCE_PADS) ) if( net_code != pad->GetNetCode() || (flag & FORCE_PADS) )
{ {
::PlacePad( pad, HOLE, marge, WRITE_CELL ); ::PlacePad( pad, HOLE, marge, WRITE_CELL );
} }
@ -247,7 +247,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
tmpSegm.SetShape( edge->GetShape() ); tmpSegm.SetShape( edge->GetShape() );
tmpSegm.SetWidth( edge->GetWidth() ); tmpSegm.SetWidth( edge->GetWidth() );
tmpSegm.m_Param = edge->GetAngle(); tmpSegm.m_Param = edge->GetAngle();
tmpSegm.SetNet( -1 ); tmpSegm.SetNetCode( -1 );
TraceSegmentPcb( &tmpSegm, HOLE, marge, WRITE_CELL ); TraceSegmentPcb( &tmpSegm, HOLE, marge, WRITE_CELL );
TraceSegmentPcb( &tmpSegm, VIA_IMPOSSIBLE, via_marge, WRITE_OR_CELL ); TraceSegmentPcb( &tmpSegm, VIA_IMPOSSIBLE, via_marge, WRITE_OR_CELL );
@ -284,7 +284,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
tmpSegm.SetShape( DrawSegm->GetShape() ); tmpSegm.SetShape( DrawSegm->GetShape() );
tmpSegm.SetWidth( DrawSegm->GetWidth() ); tmpSegm.SetWidth( DrawSegm->GetWidth() );
tmpSegm.m_Param = DrawSegm->GetAngle(); tmpSegm.m_Param = DrawSegm->GetAngle();
tmpSegm.SetNet( -1 ); tmpSegm.SetNetCode( -1 );
TraceSegmentPcb( &tmpSegm, type_cell, marge, WRITE_CELL ); TraceSegmentPcb( &tmpSegm, type_cell, marge, WRITE_CELL );
} }
@ -335,7 +335,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
/* Put tracks and vias on matrix */ /* Put tracks and vias on matrix */
for( TRACK* track = aPcb->m_Track; track; track = track->Next() ) for( TRACK* track = aPcb->m_Track; track; track = track->Next() )
{ {
if( net_code == track->GetNet() ) if( net_code == track->GetNetCode() )
continue; continue;
TraceSegmentPcb( track, HOLE, marge, WRITE_CELL ); TraceSegmentPcb( track, HOLE, marge, WRITE_CELL );
@ -374,7 +374,7 @@ int Build_Work( BOARD* Pcb )
pt_pad = pt_rats->m_PadStart; pt_pad = pt_rats->m_PadStart;
current_net_code = pt_pad->GetNet(); current_net_code = pt_pad->GetNetCode();
pt_ch = pt_rats; pt_ch = pt_rats;
r1 = ( pt_pad->GetPosition().y - RoutingMatrix.m_BrdBox.GetY() + demi_pas ) r1 = ( pt_pad->GetPosition().y - RoutingMatrix.m_BrdBox.GetY() + demi_pas )

View File

@ -1180,7 +1180,7 @@ static void OrCell_Trace( BOARD* pcb, int col, int row,
g_CurrentTrackSegment->SetWidth( pcb->GetCurrentViaSize() ); g_CurrentTrackSegment->SetWidth( pcb->GetCurrentViaSize() );
g_CurrentTrackSegment->SetShape( pcb->GetDesignSettings().m_CurrentViaType ); g_CurrentTrackSegment->SetShape( pcb->GetDesignSettings().m_CurrentViaType );
g_CurrentTrackSegment->SetNet( current_net_code ); g_CurrentTrackSegment->SetNetCode( current_net_code );
} }
else // placement of a standard segment else // placement of a standard segment
{ {
@ -1198,7 +1198,7 @@ static void OrCell_Trace( BOARD* pcb, int col, int row,
( RoutingMatrix.m_GridRouting * row ), ( RoutingMatrix.m_GridRouting * row ),
pcb->GetBoundingBox().GetY() + pcb->GetBoundingBox().GetY() +
( RoutingMatrix.m_GridRouting * col ))); ( RoutingMatrix.m_GridRouting * col )));
g_CurrentTrackSegment->SetNet( current_net_code ); g_CurrentTrackSegment->SetNetCode( current_net_code );
if( g_CurrentTrackSegment->Back() == NULL ) /* Start trace. */ if( g_CurrentTrackSegment->Back() == NULL ) /* Start trace. */
{ {
@ -1319,7 +1319,7 @@ static void AddNewTrace( PCB_EDIT_FRAME* pcbframe, wxDC* DC )
} }
// Insert new segments in real board // Insert new segments in real board
int netcode = g_FirstTrackSegment->GetNet(); int netcode = g_FirstTrackSegment->GetNetCode();
TRACK* firstTrack = g_FirstTrackSegment; TRACK* firstTrack = g_FirstTrackSegment;
int newCount = g_CurrentTrackList.GetCount(); int newCount = g_CurrentTrackList.GetCount();

View File

@ -1345,14 +1345,6 @@ NETINFO_ITEM* BOARD::FindNet( int aNetcode ) const
// NULL is returned for non valid netcodes // NULL is returned for non valid netcodes
NETINFO_ITEM* net = m_NetInfo.GetNetItem( aNetcode ); NETINFO_ITEM* net = m_NetInfo.GetNetItem( aNetcode );
#if defined(DEBUG)
if( net && aNetcode != net->GetNet()) // item can be NULL if anetcode is not valid
{
wxLogError( wxT( "FindNet() anetcode %d != GetNet() %d (net: %s)\n" ),
aNetcode, net->GetNet(), TO_UTF8( net->GetNetname() ) );
}
#endif
return net; return net;
} }
@ -1515,7 +1507,7 @@ ZONE_CONTAINER* BOARD::HitTestForAnyFilledArea( const wxPoint& aRefPos,
if( area->GetState( BUSY ) ) if( area->GetState( BUSY ) )
continue; continue;
if( aNetCode >= 0 && area->GetNet() != aNetCode ) if( aNetCode >= 0 && area->GetNetCode() != aNetCode )
continue; continue;
if( area->HitTestFilledArea( aRefPos ) ) if( area->HitTestFilledArea( aRefPos ) )
@ -1534,24 +1526,24 @@ int BOARD::SetAreasNetCodesFromNetNames( void )
{ {
if( !GetArea( ii )->IsOnCopperLayer() ) if( !GetArea( ii )->IsOnCopperLayer() )
{ {
GetArea( ii )->SetNet( NETINFO_LIST::UNCONNECTED ); GetArea( ii )->SetNetCode( NETINFO_LIST::UNCONNECTED );
continue; continue;
} }
if( GetArea( ii )->GetNet() != 0 ) // i.e. if this zone is connected to a net if( GetArea( ii )->GetNetCode() != 0 ) // i.e. if this zone is connected to a net
{ {
const NETINFO_ITEM* net = FindNet( GetArea( ii )->GetNetname() ); const NETINFO_ITEM* net = GetArea( ii )->GetNet();
if( net ) if( net )
{ {
GetArea( ii )->SetNet( net->GetNet() ); GetArea( ii )->SetNetCode( net->GetNet() );
} }
else else
{ {
error_count++; error_count++;
// keep Net Name and set m_NetCode to -1 : error flag. // keep Net Name and set m_NetCode to -1 : error flag.
GetArea( ii )->SetNet( -1 ); GetArea( ii )->SetNetCode( -1 );
} }
} }
} }
@ -2271,7 +2263,7 @@ ZONE_CONTAINER* BOARD::InsertArea( int netcode, int iarea, LAYER_NUM layer, int
{ {
ZONE_CONTAINER* new_area = new ZONE_CONTAINER( this ); ZONE_CONTAINER* new_area = new ZONE_CONTAINER( this );
new_area->SetNet( netcode ); new_area->SetNetCode( netcode );
new_area->SetLayer( layer ); new_area->SetLayer( layer );
new_area->SetTimeStamp( GetNewTimeStamp() ); new_area->SetTimeStamp( GetNewTimeStamp() );
@ -2310,7 +2302,7 @@ bool BOARD::NormalizeAreaPolygon( PICKED_ITEMS_LIST * aNewZonesList, ZONE_CONTAI
{ {
// create new copper area and copy poly into it // create new copper area and copy poly into it
CPolyLine* new_p = (*pa)[ip - 1]; CPolyLine* new_p = (*pa)[ip - 1];
NewArea = AddArea( aNewZonesList, aCurrArea->GetNet(), aCurrArea->GetLayer(), NewArea = AddArea( aNewZonesList, aCurrArea->GetNetCode(), aCurrArea->GetLayer(),
wxPoint(0, 0), CPolyLine::NO_HATCH ); wxPoint(0, 0), CPolyLine::NO_HATCH );
// remove the poly that was automatically created for the new area // remove the poly that was automatically created for the new area
@ -2551,7 +2543,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
} }
if( !aNetlist.IsDryRun() ) if( !aNetlist.IsDryRun() )
pad->SetNet( NETINFO_LIST::UNCONNECTED ); pad->SetNetCode( NETINFO_LIST::UNCONNECTED );
} }
} }
else // Footprint pad has a net. else // Footprint pad has a net.
@ -2580,7 +2572,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
m_NetInfo.AppendNet( netinfo ); m_NetInfo.AppendNet( netinfo );
} }
pad->SetNet( netinfo->GetNet() ); pad->SetNetCode( netinfo->GetNet() );
} }
} }
} }
@ -2654,7 +2646,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
aReporter->Report( msg ); aReporter->Report( msg );
} }
previouspad->SetNet( NETINFO_LIST::UNCONNECTED ); previouspad->SetNetCode( NETINFO_LIST::UNCONNECTED );
} }
netname = pad->GetNetname(); netname = pad->GetNetname();
count = 1; count = 1;
@ -2667,7 +2659,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
// Examine last pad // Examine last pad
if( pad && count == 1 ) if( pad && count == 1 )
pad->SetNet( NETINFO_LIST::UNCONNECTED ); pad->SetNetCode( NETINFO_LIST::UNCONNECTED );
} }
// Last step: Some tests: // Last step: Some tests:

View File

@ -35,28 +35,28 @@
#include <class_board_item.h> #include <class_board_item.h>
BOARD_CONNECTED_ITEM::BOARD_CONNECTED_ITEM( BOARD_ITEM* aParent, KICAD_T idtype ) : BOARD_CONNECTED_ITEM::BOARD_CONNECTED_ITEM( BOARD_ITEM* aParent, KICAD_T idtype ) :
BOARD_ITEM( aParent, idtype ), m_Subnet( 0 ), m_ZoneSubnet( 0 ), BOARD_ITEM( aParent, idtype ), m_netinfo( &NETINFO_LIST::ORPHANED ),
m_netinfo( &NETINFO_LIST::ORPHANED ) m_Subnet( 0 ), m_ZoneSubnet( 0 )
{ {
// The unconnected is set only in case the item belongs to a BOARD // The unconnected net is set only in case the item belongs to a BOARD
SetNet( NETINFO_LIST::UNCONNECTED ); SetNetCode( NETINFO_LIST::UNCONNECTED );
} }
BOARD_CONNECTED_ITEM::BOARD_CONNECTED_ITEM( const BOARD_CONNECTED_ITEM& aItem ) : BOARD_CONNECTED_ITEM::BOARD_CONNECTED_ITEM( const BOARD_CONNECTED_ITEM& aItem ) :
BOARD_ITEM( aItem ), m_Subnet( aItem.m_Subnet ), m_ZoneSubnet( aItem.m_ZoneSubnet ), BOARD_ITEM( aItem ), m_netinfo( aItem.m_netinfo ), m_Subnet( aItem.m_Subnet ),
m_netinfo( aItem.m_netinfo ) m_ZoneSubnet( aItem.m_ZoneSubnet )
{ {
} }
int BOARD_CONNECTED_ITEM::GetNet() const int BOARD_CONNECTED_ITEM::GetNetCode() const
{ {
return m_netinfo->GetNet(); return m_netinfo->GetNet();
} }
void BOARD_CONNECTED_ITEM::SetNet( int aNetCode ) void BOARD_CONNECTED_ITEM::SetNetCode( int aNetCode )
{ {
BOARD* board = GetBoard(); BOARD* board = GetBoard();
if( board ) if( board )
@ -136,8 +136,7 @@ NETCLASS* BOARD_CONNECTED_ITEM::GetNetClass() const
} }
NETCLASS* netclass = NULL; NETCLASS* netclass = NULL;
int netcode = GetNet(); NETINFO_ITEM* net = board->FindNet( GetNetCode() );
NETINFO_ITEM* net = board->FindNet( netcode );
if( net ) if( net )
{ {

View File

@ -54,18 +54,6 @@ public:
std::vector<TRACK*> m_TracksConnected; // list of other tracks connected to me std::vector<TRACK*> m_TracksConnected; // list of other tracks connected to me
std::vector<D_PAD*> m_PadsConnected; // list of other pads connected to me std::vector<D_PAD*> m_PadsConnected; // list of other pads connected to me
private:
int m_Subnet; /* In rastnest routines : for the current net, block number
* (number common to the current connected items found)
*/
int m_ZoneSubnet; // used in rastnest computations : for the current net,
// handle cluster number in zone connection
/// Stores all informations about the net that item belongs to
const NETINFO_ITEM* m_netinfo;
public:
BOARD_CONNECTED_ITEM( BOARD_ITEM* aParent, KICAD_T idtype ); BOARD_CONNECTED_ITEM( BOARD_ITEM* aParent, KICAD_T idtype );
BOARD_CONNECTED_ITEM( const BOARD_CONNECTED_ITEM& aItem ); BOARD_CONNECTED_ITEM( const BOARD_CONNECTED_ITEM& aItem );
@ -78,17 +66,26 @@ public:
/** /**
* Function GetNet * Function GetNet
* @return int - the net code. * Returns NET_INFO object for a given item.
*/ */
int GetNet() const; NETINFO_ITEM* GetNet() const
{
return m_netinfo;
}
/** /**
* Function SetNet * Function GetNetCode
* @return int - the net code.
*/
int GetNetCode() const;
/**
* Function SetNetCode
* sets net using a net code. * sets net using a net code.
* @param aNetCode is a net code for the new net. It has to exist in NETINFO_LIST held by BOARD. * @param aNetCode is a net code for the new net. It has to exist in NETINFO_LIST held by BOARD.
* Otherwise, item is assigned to the unconnected net. * Otherwise, item is assigned to the unconnected net.
*/ */
void SetNet( int aNetCode ); void SetNetCode( int aNetCode );
/** /**
* Function GetSubNet * Function GetSubNet
@ -156,6 +153,18 @@ public:
* @return the Net Class name of this item * @return the Net Class name of this item
*/ */
wxString GetNetClassName() const; wxString GetNetClassName() const;
protected:
/// Stores all informations about the net that item belongs to
NETINFO_ITEM* m_netinfo;
private:
int m_Subnet; /* In rastnest routines : for the current net, block number
* (number common to the current connected items found)
*/
int m_ZoneSubnet; // used in rastnest computations : for the current net,
// handle cluster number in zone connection
}; };

View File

@ -320,7 +320,7 @@ public:
///> NETINFO_ITEM meaning that there was no net assigned for an item, as there was no ///> NETINFO_ITEM meaning that there was no net assigned for an item, as there was no
///> board storing net list available. ///> board storing net list available.
static const NETINFO_ITEM ORPHANED; static NETINFO_ITEM ORPHANED;
#if defined(DEBUG) #if defined(DEBUG)
void Show() const; void Show() const;

View File

@ -58,8 +58,7 @@ NETINFO_ITEM::NETINFO_ITEM( BOARD_ITEM* aParent, const wxString& aNetName, int a
m_RatsnestEndIdx = 0; // Ending point of ratsnests of this net m_RatsnestEndIdx = 0; // Ending point of ratsnests of this net
m_NetClassName = NETCLASS::Default; m_NetClassName = NETCLASS::Default;
m_NetClass = NULL;
m_NetClass = 0;
} }
@ -102,7 +101,7 @@ void NETINFO_ITEM::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
{ {
for( pad = module->Pads(); pad != 0; pad = pad->Next() ) for( pad = module->Pads(); pad != 0; pad = pad->Next() )
{ {
if( pad->GetNet() == GetNet() ) if( pad->GetNetCode() == GetNet() )
{ {
count++; count++;
lengthPadToDie += pad->GetPadToDieLength(); lengthPadToDie += pad->GetPadToDieLength();
@ -120,13 +119,13 @@ void NETINFO_ITEM::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
{ {
if( Struct->Type() == PCB_VIA_T ) if( Struct->Type() == PCB_VIA_T )
{ {
if( ( (SEGVIA*) Struct )->GetNet() == GetNet() ) if( ( (SEGVIA*) Struct )->GetNetCode() == GetNet() )
count++; count++;
} }
if( Struct->Type() == PCB_TRACE_T ) if( Struct->Type() == PCB_TRACE_T )
{ {
if( ( (TRACK*) Struct )->GetNet() == GetNet() ) if( ( (TRACK*) Struct )->GetNetCode() == GetNet() )
lengthnet += ( (TRACK*) Struct )->GetLength(); lengthnet += ( (TRACK*) Struct )->GetLength();
} }
} }

View File

@ -125,11 +125,16 @@ void NETINFO_LIST::buildListOfNets()
{ {
pad = m_PadsFullList[ii]; pad = m_PadsFullList[ii];
if( pad->GetNet() == NETINFO_LIST::UNCONNECTED ) // pad not connected if( pad->GetNetCode() == NETINFO_LIST::UNCONNECTED ) // pad not connected
continue; continue;
// Add pad to the appropriate list of pads // Add pad to the appropriate list of pads
GetNetItem( pad->GetNet() )->m_PadInNetList.push_back( pad ); NETINFO_ITEM* net = pad->GetNet();
// it should not be possible for BOARD_CONNECTED_ITEM to return NULL as a result of GetNet()
wxASSERT( net );
if( net )
net->m_PadInNetList.push_back( pad );
++nodes_count; ++nodes_count;
} }
@ -232,24 +237,24 @@ void NETINFO_MAPPING::Update()
// Zones // Zones
for( int i = 0; i < m_board->GetAreaCount(); ++i ) for( int i = 0; i < m_board->GetAreaCount(); ++i )
nets.insert( m_board->GetArea( i )->GetNet() ); nets.insert( m_board->GetArea( i )->GetNetCode() );
// Tracks // Tracks
for( TRACK* track = m_board->m_Track; track; track = track->Next() ) for( TRACK* track = m_board->m_Track; track; track = track->Next() )
nets.insert( track->GetNet() ); nets.insert( track->GetNetCode() );
// Modules/pads // Modules/pads
for( MODULE* module = m_board->m_Modules; module; module = module->Next() ) for( MODULE* module = m_board->m_Modules; module; module = module->Next() )
{ {
for( D_PAD* pad = module->Pads().GetFirst(); pad; pad = pad->Next() ) for( D_PAD* pad = module->Pads().GetFirst(); pad; pad = pad->Next() )
{ {
nets.insert( pad->GetNet() ); nets.insert( pad->GetNetCode() );
} }
} }
// Segzones // Segzones
for( SEGZONE* zone = m_board->m_Zone; zone; zone = zone->Next() ) for( SEGZONE* zone = m_board->m_Zone; zone; zone = zone->Next() )
nets.insert( zone->GetNet() ); nets.insert( zone->GetNetCode() );
// Prepare the new mapping // Prepare the new mapping
m_netMapping.clear(); m_netMapping.clear();
@ -275,5 +280,4 @@ NETINFO_ITEM* NETINFO_MAPPING::iterator::operator->() const
const int NETINFO_LIST::UNCONNECTED = 0; const int NETINFO_LIST::UNCONNECTED = 0;
const NETINFO_ITEM NETINFO_LIST::ORPHANED = NETINFO_ITEM( NULL, wxEmptyString, NETINFO_ITEM NETINFO_LIST::ORPHANED = NETINFO_ITEM( NULL, wxEmptyString, NETINFO_LIST::UNCONNECTED );
NETINFO_LIST::UNCONNECTED );

View File

@ -373,7 +373,7 @@ void D_PAD::Copy( D_PAD* source )
m_layerMask = source->m_layerMask; m_layerMask = source->m_layerMask;
m_NumPadName = source->m_NumPadName; m_NumPadName = source->m_NumPadName;
SetNet( source->GetNet() ); m_netinfo = source->m_netinfo;
m_Drill = source->m_Drill; m_Drill = source->m_Drill;
m_drillShape = source->m_drillShape; m_drillShape = source->m_drillShape;
m_Offset = source->m_Offset; m_Offset = source->m_Offset;
@ -403,7 +403,7 @@ void D_PAD::CopyNetlistSettings( D_PAD* aPad )
// Don't do anything foolish like trying to copy to yourself. // Don't do anything foolish like trying to copy to yourself.
wxCHECK_RET( aPad != NULL && aPad != this, wxT( "Cannot copy to NULL or yourself." ) ); wxCHECK_RET( aPad != NULL && aPad != this, wxT( "Cannot copy to NULL or yourself." ) );
aPad->SetNet( GetNet() ); aPad->SetNetCode( GetNetCode() );
aPad->SetLocalClearance( m_LocalClearance ); aPad->SetLocalClearance( m_LocalClearance );
aPad->SetLocalSolderMaskMargin( m_LocalSolderMaskMargin ); aPad->SetLocalSolderMaskMargin( m_LocalSolderMaskMargin );

View File

@ -473,7 +473,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
GRSetDrawMode( aDC, aDrawInfo.m_DrawMode ); GRSetDrawMode( aDC, aDrawInfo.m_DrawMode );
// Draw "No connect" ( / or \ or cross X ) if necessary // Draw "No connect" ( / or \ or cross X ) if necessary
if( GetNet() == 0 && aDrawInfo.m_ShowNCMark ) if( GetNetCode() == 0 && aDrawInfo.m_ShowNCMark )
{ {
int dx0 = std::min( halfsize.x, halfsize.y ); int dx0 = std::min( halfsize.x, halfsize.y );
EDA_COLOR_T nc_color = BLUE; EDA_COLOR_T nc_color = BLUE;

View File

@ -160,15 +160,11 @@ EDA_ITEM* SEGZONE::Clone() const
wxString SEGZONE::GetSelectMenuText() const wxString SEGZONE::GetSelectMenuText() const
{ {
wxString text, nettxt; wxString text, nettxt;
NETINFO_ITEM* net;
BOARD* board = GetBoard(); BOARD* board = GetBoard();
if( board ) if( board )
{ {
net = board->FindNet( GetNet() ); nettxt = GetNetname();
if( net )
nettxt = net->GetNetname();
} }
else else
{ {
@ -201,7 +197,6 @@ wxString SEGVIA::GetSelectMenuText() const
{ {
wxString text; wxString text;
wxString format; wxString format;
NETINFO_ITEM* net;
BOARD* board = GetBoard(); BOARD* board = GetBoard();
int shape = GetShape(); int shape = GetShape();
@ -215,18 +210,14 @@ wxString SEGVIA::GetSelectMenuText() const
if( board ) if( board )
{ {
net = board->FindNet( GetNet() ); wxString netname = GetNetname();
wxString netname;
if( net )
netname = net->GetNetname();
// say which layers, only two for now // say which layers, only two for now
LAYER_NUM topLayer; LAYER_NUM topLayer;
LAYER_NUM botLayer; LAYER_NUM botLayer;
ReturnLayerPair( &topLayer, &botLayer ); ReturnLayerPair( &topLayer, &botLayer );
text.Printf( format.GetData(), GetChars( ShowWidth() ), text.Printf( format.GetData(), GetChars( ShowWidth() ),
GetChars( netname ), GetNet(), GetChars( netname ), GetNetCode(),
GetChars( board->GetLayerName( topLayer ) ), GetChars( board->GetLayerName( topLayer ) ),
GetChars( board->GetLayerName( botLayer ) ) ); GetChars( board->GetLayerName( botLayer ) ) );
@ -496,7 +487,7 @@ TRACK* TRACK::GetBestInsertPoint( BOARD* aPcb )
for( ; track; track = track->Next() ) for( ; track; track = track->Next() )
{ {
if( GetNet() <= track->GetNet() ) if( GetNetCode() <= track->GetNetCode() )
return track; return track;
} }
@ -510,14 +501,14 @@ TRACK* TRACK::GetStartNetCode( int NetCode )
int ii = 0; int ii = 0;
if( NetCode == -1 ) if( NetCode == -1 )
NetCode = GetNet(); NetCode = GetNetCode();
while( Track != NULL ) while( Track != NULL )
{ {
if( Track->GetNet() > NetCode ) if( Track->GetNetCode() > NetCode )
break; break;
if( Track->GetNet() == NetCode ) if( Track->GetNetCode() == NetCode )
{ {
ii++; ii++;
break; break;
@ -542,19 +533,19 @@ TRACK* TRACK::GetEndNetCode( int NetCode )
return NULL; return NULL;
if( NetCode == -1 ) if( NetCode == -1 )
NetCode = GetNet(); NetCode = GetNetCode();
while( Track != NULL ) while( Track != NULL )
{ {
NextS = (TRACK*) Track->Pnext; NextS = (TRACK*) Track->Pnext;
if( Track->GetNet() == NetCode ) if( Track->GetNetCode() == NetCode )
ii++; ii++;
if( NextS == NULL ) if( NextS == NULL )
break; break;
if( NextS->GetNet() > NetCode ) if( NextS->GetNetCode() > NetCode )
break; break;
Track = NextS; Track = NextS;
@ -690,10 +681,10 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode,
if( aDC->LogicalToDeviceXRel( m_Width ) < MIN_TEXT_SIZE ) if( aDC->LogicalToDeviceXRel( m_Width ) < MIN_TEXT_SIZE )
return; return;
if( GetNet() == NETINFO_LIST::UNCONNECTED ) if( GetNetCode() == NETINFO_LIST::UNCONNECTED )
return; return;
NETINFO_ITEM* net = ( (BOARD*) GetParent() )->FindNet( GetNet() ); NETINFO_ITEM* net = GetNet();
if( net == NULL ) if( net == NULL )
return; return;
@ -952,13 +943,13 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode,
} }
// Display the short netname: // Display the short netname:
if( GetNet() == NETINFO_LIST::UNCONNECTED ) if( GetNetCode() == NETINFO_LIST::UNCONNECTED )
return; return;
if( DisplayOpt.DisplayNetNamesMode == 0 || DisplayOpt.DisplayNetNamesMode == 1 ) if( DisplayOpt.DisplayNetNamesMode == 0 || DisplayOpt.DisplayNetNamesMode == 1 )
return; return;
NETINFO_ITEM* net = ( (BOARD*) GetParent() )->FindNet( GetNet() ); NETINFO_ITEM* net = GetNet();
if( net == NULL ) if( net == NULL )
return; return;
@ -1095,7 +1086,7 @@ void TRACK::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList )
// Display Net Name (in Pcbnew) // Display Net Name (in Pcbnew)
if( board ) if( board )
{ {
NETINFO_ITEM* net = board->FindNet( GetNet() ); NETINFO_ITEM* net = GetNet();
if( net ) if( net )
msg = net->GetNetname(); msg = net->GetNetname();
@ -1105,7 +1096,7 @@ void TRACK::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList )
aList.push_back( MSG_PANEL_ITEM( _( "NetName" ), msg, RED ) ); aList.push_back( MSG_PANEL_ITEM( _( "NetName" ), msg, RED ) );
/* Display net code : (useful in test or debug) */ /* Display net code : (useful in test or debug) */
msg.Printf( wxT( "%d.%d" ), GetNet(), GetSubNet() ); msg.Printf( wxT( "%d.%d" ), GetNetCode(), GetSubNet() );
aList.push_back( MSG_PANEL_ITEM( _( "NetCode" ), msg, RED ) ); aList.push_back( MSG_PANEL_ITEM( _( "NetCode" ), msg, RED ) );
} }
@ -1576,7 +1567,7 @@ wxString TRACK::GetSelectMenuText() const
// disambiguate all the choices under the cursor! // disambiguate all the choices under the cursor!
if( board ) if( board )
{ {
net = board->FindNet( GetNet() ); net = GetNet();
if( net ) if( net )
netname = net->GetNetname(); netname = net->GetNetname();
@ -1591,7 +1582,7 @@ wxString TRACK::GetSelectMenuText() const
text.Printf( _("Track %s, net [%s] (%d) on layer %s, length: %s" ), text.Printf( _("Track %s, net [%s] (%d) on layer %s, length: %s" ),
GetChars( ShowWidth() ), GetChars( netname ), GetChars( ShowWidth() ), GetChars( netname ),
GetNet(), GetChars( GetLayerName() ), GetNetCode(), GetChars( GetLayerName() ),
GetChars( ::LengthDoubleToString( GetLength() ) ) ); GetChars( ::LengthDoubleToString( GetLength() ) ) );
return text; return text;

View File

@ -74,7 +74,7 @@ ZONE_CONTAINER::ZONE_CONTAINER( const ZONE_CONTAINER& aZone ) :
BOARD_CONNECTED_ITEM( aZone ) BOARD_CONNECTED_ITEM( aZone )
{ {
// Should the copy be on the same net? // Should the copy be on the same net?
SetNet( aZone.GetNet() ); SetNetCode( aZone.GetNetCode() );
m_Poly = new CPolyLine( *aZone.m_Poly ); m_Poly = new CPolyLine( *aZone.m_Poly );
// For corner moving, corner index to drag, or -1 if no selection // For corner moving, corner index to drag, or -1 if no selection
@ -620,9 +620,9 @@ void ZONE_CONTAINER::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
} }
else if( IsOnCopperLayer() ) else if( IsOnCopperLayer() )
{ {
if( GetNet() >= 0 ) if( GetNetCode() >= 0 )
{ {
NETINFO_ITEM* equipot = board->FindNet( GetNet() ); NETINFO_ITEM* equipot = GetNet();
if( equipot ) if( equipot )
msg = equipot->GetNetname(); msg = equipot->GetNetname();
@ -640,7 +640,7 @@ void ZONE_CONTAINER::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
#if 1 #if 1
// Display net code : (useful in test or debug) // Display net code : (useful in test or debug)
msg.Printf( wxT( "%d" ), GetNet() ); msg.Printf( wxT( "%d" ), GetNetCode() );
aList.push_back( MSG_PANEL_ITEM( _( "NetCode" ), msg, RED ) ); aList.push_back( MSG_PANEL_ITEM( _( "NetCode" ), msg, RED ) );
#endif #endif
@ -801,7 +801,7 @@ void ZONE_CONTAINER::Copy( ZONE_CONTAINER* src )
{ {
m_Parent = src->m_Parent; m_Parent = src->m_Parent;
m_Layer = src->m_Layer; m_Layer = src->m_Layer;
SetNet( src->GetNet() ); SetNetCode( src->GetNetCode() );
SetTimeStamp( src->m_TimeStamp ); SetTimeStamp( src->m_TimeStamp );
m_Poly->RemoveAllContours(); m_Poly->RemoveAllContours();
m_Poly->Copy( src->m_Poly ); // copy outlines m_Poly->Copy( src->m_Poly ); // copy outlines
@ -869,11 +869,11 @@ wxString ZONE_CONTAINER::GetSelectMenuText() const
// Display net name for copper zones // Display net name for copper zones
if( !GetIsKeepout() ) if( !GetIsKeepout() )
{ {
if( GetNet() >= 0 ) if( GetNetCode() >= 0 )
{ {
if( board ) if( board )
{ {
net = board->FindNet( GetNet() ); net = GetNet();
if( net ) if( net )
{ {

View File

@ -76,7 +76,7 @@ ZONE_SETTINGS& ZONE_SETTINGS::operator << ( const ZONE_CONTAINER& aSource )
m_FillMode = aSource.GetFillMode(); m_FillMode = aSource.GetFillMode();
m_ZoneClearance = aSource.GetClearance(); m_ZoneClearance = aSource.GetClearance();
m_ZoneMinThickness = aSource.GetMinThickness(); m_ZoneMinThickness = aSource.GetMinThickness();
m_NetcodeSelection = aSource.GetNet(); m_NetcodeSelection = aSource.GetNetCode();
m_CurrentZone_Layer = aSource.GetLayer(); m_CurrentZone_Layer = aSource.GetLayer();
m_Zone_HatchingStyle = aSource.GetHatchStyle(); m_Zone_HatchingStyle = aSource.GetHatchStyle();
m_ArcToSegmentsCount = aSource.GetArcSegmentCount(); m_ArcToSegmentsCount = aSource.GetArcSegmentCount();
@ -113,7 +113,7 @@ void ZONE_SETTINGS::ExportSetting( ZONE_CONTAINER& aTarget, bool aFullExport ) c
if( aFullExport ) if( aFullExport )
{ {
aTarget.SetPriority( m_ZonePriority ); aTarget.SetPriority( m_ZonePriority );
aTarget.SetNet( m_NetcodeSelection ); aTarget.SetNetCode( m_NetcodeSelection );
aTarget.SetLayer( m_CurrentZone_Layer ); aTarget.SetLayer( m_CurrentZone_Layer );
aTarget.Outline()->SetLayer( m_CurrentZone_Layer ); aTarget.Outline()->SetLayer( m_CurrentZone_Layer );
} }

View File

@ -323,14 +323,14 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks()
zone = m_Brd->HitTestForAnyFilledArea( track->GetStart(), zone = m_Brd->HitTestForAnyFilledArea( track->GetStart(),
track->GetLayer(), track->GetLayer(),
track->GetLayer(), track->GetLayer(),
track->GetNet() ); track->GetNetCode() );
} }
else else
{ {
((SEGVIA*)track)->ReturnLayerPair( &top_layer, &bottom_layer ); ((SEGVIA*)track)->ReturnLayerPair( &top_layer, &bottom_layer );
zone = m_Brd->HitTestForAnyFilledArea( track->GetStart(), zone = m_Brd->HitTestForAnyFilledArea( track->GetStart(),
top_layer, bottom_layer, top_layer, bottom_layer,
track->GetNet() ); track->GetNetCode() );
} }
} }
@ -359,7 +359,7 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks()
zone = m_Brd->HitTestForAnyFilledArea( via->GetStart(), zone = m_Brd->HitTestForAnyFilledArea( via->GetStart(),
bottom_layer, bottom_layer,
top_layer, top_layer,
via->GetNet() ); via->GetNetCode() );
} }
if( (other == NULL) && (zone == NULL) ) if( (other == NULL) && (zone == NULL) )
@ -383,14 +383,14 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks()
zone = m_Brd->HitTestForAnyFilledArea( track->GetEnd(), zone = m_Brd->HitTestForAnyFilledArea( track->GetEnd(),
track->GetLayer(), track->GetLayer(),
track->GetLayer(), track->GetLayer(),
track->GetNet() ); track->GetNetCode() );
} }
else else
{ {
((SEGVIA*)track)->ReturnLayerPair( &top_layer, &bottom_layer ); ((SEGVIA*)track)->ReturnLayerPair( &top_layer, &bottom_layer );
zone = m_Brd->HitTestForAnyFilledArea( track->GetEnd(), zone = m_Brd->HitTestForAnyFilledArea( track->GetEnd(),
top_layer, bottom_layer, top_layer, bottom_layer,
track->GetNet() ); track->GetNetCode() );
} }
} }
@ -419,7 +419,7 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks()
via->ReturnLayerPair( &top_layer, &bottom_layer ); via->ReturnLayerPair( &top_layer, &bottom_layer );
zone = m_Brd->HitTestForAnyFilledArea( via->GetEnd(), zone = m_Brd->HitTestForAnyFilledArea( via->GetEnd(),
bottom_layer, top_layer, bottom_layer, top_layer,
via->GetNet() ); via->GetNetCode() );
} }
if( (other == NULL) && (zone == NULL) ) if( (other == NULL) && (zone == NULL) )
@ -479,7 +479,7 @@ bool TRACKS_CLEANER::clean_segments()
if( segment->GetLayer() != other->GetLayer() ) if( segment->GetLayer() != other->GetLayer() )
continue; continue;
if( segment->GetNet() != other->GetNet() ) if( segment->GetNetCode() != other->GetNetCode() )
break; break;
if( ( segment->GetStart() == other->GetStart() ) && if( ( segment->GetStart() == other->GetStart() ) &&
@ -748,14 +748,14 @@ bool PCB_EDIT_FRAME::RemoveMisConnectedTracks()
if( segment->start && segment->start->Type()==PCB_PAD_T ) if( segment->start && segment->start->Type()==PCB_PAD_T )
{ {
// get the netcode of the pad to propagate. // get the netcode of the pad to propagate.
net_code_s = ((D_PAD*)(segment->start))->GetNet(); net_code_s = ((D_PAD*)(segment->start))->GetNetCode();
} }
else else
{ {
other = segment->GetTrace( GetBoard()->m_Track, NULL, FLG_START ); other = segment->GetTrace( GetBoard()->m_Track, NULL, FLG_START );
if( other ) if( other )
net_code_s = other->GetNet(); net_code_s = other->GetNetCode();
} }
if( net_code_s < 0 ) if( net_code_s < 0 )
@ -766,14 +766,14 @@ bool PCB_EDIT_FRAME::RemoveMisConnectedTracks()
if( segment->end && segment->end->Type()==PCB_PAD_T ) if( segment->end && segment->end->Type()==PCB_PAD_T )
{ {
net_code_e = ((D_PAD*)(segment->end))->GetNet(); net_code_e = ((D_PAD*)(segment->end))->GetNetCode();
} }
else else
{ {
other = segment->GetTrace( GetBoard()->m_Track, NULL, FLG_END ); other = segment->GetTrace( GetBoard()->m_Track, NULL, FLG_END );
if( other ) if( other )
net_code_e = other->GetNet(); net_code_e = other->GetNetCode();
} }
if( net_code_e < 0 ) if( net_code_e < 0 )

View File

@ -718,7 +718,7 @@ void PCB_BASE_FRAME::TestConnections()