7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-20 23:41:40 +00:00

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

View File

@ -499,7 +499,7 @@ int genPlacementRoutingMatrix( BOARD* aBrd, EDA_MSG_PANEL* messagePanel )
TRACK TmpSegm( NULL );
TmpSegm.SetLayer( UNDEFINED_LAYER );
TmpSegm.SetNet( -1 );
TmpSegm.SetNetCode( -1 );
TmpSegm.SetWidth( RoutingMatrix.m_GridRouting / 2 );
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:
Pad = (D_PAD*) GetScreen()->GetCurItem();
autoroute_net_code = Pad->GetNet();
autoroute_net_code = Pad->GetNetCode();
break;
default:

View File

@ -215,7 +215,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
{
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 );
}
@ -247,7 +247,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
tmpSegm.SetShape( edge->GetShape() );
tmpSegm.SetWidth( edge->GetWidth() );
tmpSegm.m_Param = edge->GetAngle();
tmpSegm.SetNet( -1 );
tmpSegm.SetNetCode( -1 );
TraceSegmentPcb( &tmpSegm, HOLE, marge, WRITE_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.SetWidth( DrawSegm->GetWidth() );
tmpSegm.m_Param = DrawSegm->GetAngle();
tmpSegm.SetNet( -1 );
tmpSegm.SetNetCode( -1 );
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 */
for( TRACK* track = aPcb->m_Track; track; track = track->Next() )
{
if( net_code == track->GetNet() )
if( net_code == track->GetNetCode() )
continue;
TraceSegmentPcb( track, HOLE, marge, WRITE_CELL );
@ -374,7 +374,7 @@ int Build_Work( BOARD* Pcb )
pt_pad = pt_rats->m_PadStart;
current_net_code = pt_pad->GetNet();
current_net_code = pt_pad->GetNetCode();
pt_ch = pt_rats;
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->SetShape( pcb->GetDesignSettings().m_CurrentViaType );
g_CurrentTrackSegment->SetNet( current_net_code );
g_CurrentTrackSegment->SetNetCode( current_net_code );
}
else // placement of a standard segment
{
@ -1198,7 +1198,7 @@ static void OrCell_Trace( BOARD* pcb, int col, int row,
( RoutingMatrix.m_GridRouting * row ),
pcb->GetBoundingBox().GetY() +
( RoutingMatrix.m_GridRouting * col )));
g_CurrentTrackSegment->SetNet( current_net_code );
g_CurrentTrackSegment->SetNetCode( current_net_code );
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
int netcode = g_FirstTrackSegment->GetNet();
int netcode = g_FirstTrackSegment->GetNetCode();
TRACK* firstTrack = g_FirstTrackSegment;
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
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;
}
@ -1515,7 +1507,7 @@ ZONE_CONTAINER* BOARD::HitTestForAnyFilledArea( const wxPoint& aRefPos,
if( area->GetState( BUSY ) )
continue;
if( aNetCode >= 0 && area->GetNet() != aNetCode )
if( aNetCode >= 0 && area->GetNetCode() != aNetCode )
continue;
if( area->HitTestFilledArea( aRefPos ) )
@ -1534,24 +1526,24 @@ int BOARD::SetAreasNetCodesFromNetNames( void )
{
if( !GetArea( ii )->IsOnCopperLayer() )
{
GetArea( ii )->SetNet( NETINFO_LIST::UNCONNECTED );
GetArea( ii )->SetNetCode( NETINFO_LIST::UNCONNECTED );
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 )
{
GetArea( ii )->SetNet( net->GetNet() );
GetArea( ii )->SetNetCode( net->GetNet() );
}
else
{
error_count++;
// 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 );
new_area->SetNet( netcode );
new_area->SetNetCode( netcode );
new_area->SetLayer( layer );
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
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 );
// 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() )
pad->SetNet( NETINFO_LIST::UNCONNECTED );
pad->SetNetCode( NETINFO_LIST::UNCONNECTED );
}
}
else // Footprint pad has a net.
@ -2580,7 +2572,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
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 );
}
previouspad->SetNet( NETINFO_LIST::UNCONNECTED );
previouspad->SetNetCode( NETINFO_LIST::UNCONNECTED );
}
netname = pad->GetNetname();
count = 1;
@ -2667,7 +2659,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
// Examine last pad
if( pad && count == 1 )
pad->SetNet( NETINFO_LIST::UNCONNECTED );
pad->SetNetCode( NETINFO_LIST::UNCONNECTED );
}
// Last step: Some tests:

View File

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

View File

@ -54,18 +54,6 @@ public:
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
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( const BOARD_CONNECTED_ITEM& aItem );
@ -78,17 +66,26 @@ public:
/**
* 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.
* @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.
*/
void SetNet( int aNetCode );
void SetNetCode( int aNetCode );
/**
* Function GetSubNet
@ -156,6 +153,18 @@ public:
* @return the Net Class name of this item
*/
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
///> board storing net list available.
static const NETINFO_ITEM ORPHANED;
static NETINFO_ITEM ORPHANED;
#if defined(DEBUG)
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_NetClassName = NETCLASS::Default;
m_NetClass = 0;
m_NetClass = NULL;
}
@ -102,7 +101,7 @@ void NETINFO_ITEM::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
{
for( pad = module->Pads(); pad != 0; pad = pad->Next() )
{
if( pad->GetNet() == GetNet() )
if( pad->GetNetCode() == GetNet() )
{
count++;
lengthPadToDie += pad->GetPadToDieLength();
@ -120,13 +119,13 @@ void NETINFO_ITEM::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
{
if( Struct->Type() == PCB_VIA_T )
{
if( ( (SEGVIA*) Struct )->GetNet() == GetNet() )
if( ( (SEGVIA*) Struct )->GetNetCode() == GetNet() )
count++;
}
if( Struct->Type() == PCB_TRACE_T )
{
if( ( (TRACK*) Struct )->GetNet() == GetNet() )
if( ( (TRACK*) Struct )->GetNetCode() == GetNet() )
lengthnet += ( (TRACK*) Struct )->GetLength();
}
}

View File

@ -125,11 +125,16 @@ void NETINFO_LIST::buildListOfNets()
{
pad = m_PadsFullList[ii];
if( pad->GetNet() == NETINFO_LIST::UNCONNECTED ) // pad not connected
if( pad->GetNetCode() == NETINFO_LIST::UNCONNECTED ) // pad not connected
continue;
// 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;
}
@ -232,24 +237,24 @@ void NETINFO_MAPPING::Update()
// Zones
for( int i = 0; i < m_board->GetAreaCount(); ++i )
nets.insert( m_board->GetArea( i )->GetNet() );
nets.insert( m_board->GetArea( i )->GetNetCode() );
// Tracks
for( TRACK* track = m_board->m_Track; track; track = track->Next() )
nets.insert( track->GetNet() );
nets.insert( track->GetNetCode() );
// Modules/pads
for( MODULE* module = m_board->m_Modules; module; module = module->Next() )
{
for( D_PAD* pad = module->Pads().GetFirst(); pad; pad = pad->Next() )
{
nets.insert( pad->GetNet() );
nets.insert( pad->GetNetCode() );
}
}
// Segzones
for( SEGZONE* zone = m_board->m_Zone; zone; zone = zone->Next() )
nets.insert( zone->GetNet() );
nets.insert( zone->GetNetCode() );
// Prepare the new mapping
m_netMapping.clear();
@ -275,5 +280,4 @@ NETINFO_ITEM* NETINFO_MAPPING::iterator::operator->() const
const int NETINFO_LIST::UNCONNECTED = 0;
const NETINFO_ITEM NETINFO_LIST::ORPHANED = NETINFO_ITEM( NULL, wxEmptyString,
NETINFO_LIST::UNCONNECTED );
NETINFO_ITEM NETINFO_LIST::ORPHANED = NETINFO_ITEM( NULL, wxEmptyString, NETINFO_LIST::UNCONNECTED );

View File

@ -373,7 +373,7 @@ void D_PAD::Copy( D_PAD* source )
m_layerMask = source->m_layerMask;
m_NumPadName = source->m_NumPadName;
SetNet( source->GetNet() );
m_netinfo = source->m_netinfo;
m_Drill = source->m_Drill;
m_drillShape = source->m_drillShape;
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.
wxCHECK_RET( aPad != NULL && aPad != this, wxT( "Cannot copy to NULL or yourself." ) );
aPad->SetNet( GetNet() );
aPad->SetNetCode( GetNetCode() );
aPad->SetLocalClearance( m_LocalClearance );
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 );
// 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 );
EDA_COLOR_T nc_color = BLUE;

View File

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

View File

@ -74,7 +74,7 @@ ZONE_CONTAINER::ZONE_CONTAINER( const ZONE_CONTAINER& aZone ) :
BOARD_CONNECTED_ITEM( aZone )
{
// Should the copy be on the same net?
SetNet( aZone.GetNet() );
SetNetCode( aZone.GetNetCode() );
m_Poly = new CPolyLine( *aZone.m_Poly );
// 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() )
{
if( GetNet() >= 0 )
if( GetNetCode() >= 0 )
{
NETINFO_ITEM* equipot = board->FindNet( GetNet() );
NETINFO_ITEM* equipot = GetNet();
if( equipot )
msg = equipot->GetNetname();
@ -640,7 +640,7 @@ void ZONE_CONTAINER::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
#if 1
// 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 ) );
#endif
@ -801,7 +801,7 @@ void ZONE_CONTAINER::Copy( ZONE_CONTAINER* src )
{
m_Parent = src->m_Parent;
m_Layer = src->m_Layer;
SetNet( src->GetNet() );
SetNetCode( src->GetNetCode() );
SetTimeStamp( src->m_TimeStamp );
m_Poly->RemoveAllContours();
m_Poly->Copy( src->m_Poly ); // copy outlines
@ -869,11 +869,11 @@ wxString ZONE_CONTAINER::GetSelectMenuText() const
// Display net name for copper zones
if( !GetIsKeepout() )
{
if( GetNet() >= 0 )
if( GetNetCode() >= 0 )
{
if( board )
{
net = board->FindNet( GetNet() );
net = GetNet();
if( net )
{

View File

@ -76,7 +76,7 @@ ZONE_SETTINGS& ZONE_SETTINGS::operator << ( const ZONE_CONTAINER& aSource )
m_FillMode = aSource.GetFillMode();
m_ZoneClearance = aSource.GetClearance();
m_ZoneMinThickness = aSource.GetMinThickness();
m_NetcodeSelection = aSource.GetNet();
m_NetcodeSelection = aSource.GetNetCode();
m_CurrentZone_Layer = aSource.GetLayer();
m_Zone_HatchingStyle = aSource.GetHatchStyle();
m_ArcToSegmentsCount = aSource.GetArcSegmentCount();
@ -113,7 +113,7 @@ void ZONE_SETTINGS::ExportSetting( ZONE_CONTAINER& aTarget, bool aFullExport ) c
if( aFullExport )
{
aTarget.SetPriority( m_ZonePriority );
aTarget.SetNet( m_NetcodeSelection );
aTarget.SetNetCode( m_NetcodeSelection );
aTarget.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(),
track->GetLayer(),
track->GetLayer(),
track->GetNet() );
track->GetNetCode() );
}
else
{
((SEGVIA*)track)->ReturnLayerPair( &top_layer, &bottom_layer );
zone = m_Brd->HitTestForAnyFilledArea( track->GetStart(),
top_layer, bottom_layer,
track->GetNet() );
track->GetNetCode() );
}
}
@ -359,7 +359,7 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks()
zone = m_Brd->HitTestForAnyFilledArea( via->GetStart(),
bottom_layer,
top_layer,
via->GetNet() );
via->GetNetCode() );
}
if( (other == NULL) && (zone == NULL) )
@ -383,14 +383,14 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks()
zone = m_Brd->HitTestForAnyFilledArea( track->GetEnd(),
track->GetLayer(),
track->GetLayer(),
track->GetNet() );
track->GetNetCode() );
}
else
{
((SEGVIA*)track)->ReturnLayerPair( &top_layer, &bottom_layer );
zone = m_Brd->HitTestForAnyFilledArea( track->GetEnd(),
top_layer, bottom_layer,
track->GetNet() );
track->GetNetCode() );
}
}
@ -419,7 +419,7 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks()
via->ReturnLayerPair( &top_layer, &bottom_layer );
zone = m_Brd->HitTestForAnyFilledArea( via->GetEnd(),
bottom_layer, top_layer,
via->GetNet() );
via->GetNetCode() );
}
if( (other == NULL) && (zone == NULL) )
@ -479,7 +479,7 @@ bool TRACKS_CLEANER::clean_segments()
if( segment->GetLayer() != other->GetLayer() )
continue;
if( segment->GetNet() != other->GetNet() )
if( segment->GetNetCode() != other->GetNetCode() )
break;
if( ( segment->GetStart() == other->GetStart() ) &&
@ -748,14 +748,14 @@ bool PCB_EDIT_FRAME::RemoveMisConnectedTracks()
if( segment->start && segment->start->Type()==PCB_PAD_T )
{
// 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
{
other = segment->GetTrace( GetBoard()->m_Track, NULL, FLG_START );
if( other )
net_code_s = other->GetNet();
net_code_s = other->GetNetCode();
}
if( net_code_s < 0 )
@ -766,14 +766,14 @@ bool PCB_EDIT_FRAME::RemoveMisConnectedTracks()
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
{
other = segment->GetTrace( GetBoard()->m_Track, NULL, FLG_END );
if( other )
net_code_e = other->GetNet();
net_code_e = other->GetNetCode();
}
if( net_code_e < 0 )

View File

@ -718,7 +718,7 @@ void PCB_BASE_FRAME::TestConnections()
for( TRACK* track = m_Pcb->m_Track; track; )
{
// At this point, track is the first track of a given net
current_net_code = track->GetNet();
current_net_code = track->GetNetCode();
// Get last track of the current net
TRACK* lastTrack = track->GetEndNetCode( current_net_code );
@ -760,7 +760,7 @@ void PCB_BASE_FRAME::TestNetConnection( wxDC* aDC, int aNetCode )
for( unsigned i = 0; i < m_Pcb->GetPadCount(); ++i )
{
D_PAD* pad = m_Pcb->GetPad(i);
int pad_net_code = pad->GetNet();
int pad_net_code = pad->GetNetCode();
if( pad_net_code < aNetCode )
continue;
@ -786,7 +786,7 @@ void PCB_BASE_FRAME::TestNetConnection( wxDC* aDC, int aNetCode )
if( firstTrack && lastTrack ) // i.e. if there are segments
{
connections.Build_CurrNet_SubNets_Connections( firstTrack, lastTrack, firstTrack->GetNet() );
connections.Build_CurrNet_SubNets_Connections( firstTrack, lastTrack, firstTrack->GetNetCode() );
}
}
@ -842,7 +842,7 @@ void PCB_BASE_FRAME::RecalculateAllTracksNetcode()
curr_track->end = NULL;
curr_track->SetState( BUSY | IN_EDIT | BEGIN_ONPAD | END_ONPAD, false );
curr_track->SetZoneSubNet( 0 );
curr_track->SetNet( NETINFO_LIST::UNCONNECTED );
curr_track->SetNetCode( NETINFO_LIST::UNCONNECTED );
}
// If no pad, reset pointers and netcode, and do nothing else
@ -863,7 +863,7 @@ void PCB_BASE_FRAME::RecalculateAllTracksNetcode()
for( ; curr_track != NULL; curr_track = curr_track->Next() )
{
if( curr_track->m_PadsConnected.size() )
curr_track->SetNet( curr_track->m_PadsConnected[0]->GetNet() );
curr_track->SetNetCode( curr_track->m_PadsConnected[0]->GetNetCode() );
}
// Pass 2: build connections between track ends
@ -883,17 +883,17 @@ void PCB_BASE_FRAME::RecalculateAllTracksNetcode()
for( curr_track = m_Pcb->m_Track; curr_track; curr_track = curr_track->Next() )
{
int netcode = curr_track->GetNet();
int netcode = curr_track->GetNetCode();
if( netcode == 0 )
{ // try to find a connected item having a netcode
for( unsigned kk = 0; kk < curr_track->m_TracksConnected.size(); kk++ )
{
int altnetcode = curr_track->m_TracksConnected[kk]->GetNet();
int altnetcode = curr_track->m_TracksConnected[kk]->GetNetCode();
if( altnetcode )
{
new_pass_request = true;
netcode = altnetcode;
curr_track->SetNet(netcode);
curr_track->SetNetCode(netcode);
break;
}
}
@ -902,10 +902,10 @@ void PCB_BASE_FRAME::RecalculateAllTracksNetcode()
{ // propagate this netcode to connected tracks having no netcode
for( unsigned kk = 0; kk < curr_track->m_TracksConnected.size(); kk++ )
{
int altnetcode = curr_track->m_TracksConnected[kk]->GetNet();
int altnetcode = curr_track->m_TracksConnected[kk]->GetNetCode();
if( altnetcode == 0 )
{
curr_track->m_TracksConnected[kk]->SetNet(netcode);
curr_track->m_TracksConnected[kk]->SetNetCode(netcode);
new_pass_request = true;
}
}
@ -926,10 +926,10 @@ void PCB_BASE_FRAME::RecalculateAllTracksNetcode()
static bool SortTracksByNetCode( const TRACK* const & ref, const TRACK* const & compare )
{
// For items having the same Net, keep the order in list
if( ref->GetNet() == compare->GetNet())
if( ref->GetNetCode() == compare->GetNetCode())
return ref->m_Param < compare->m_Param;
return ref->GetNet() < compare->GetNet();
return ref->GetNetCode() < compare->GetNetCode();
}
/**

View File

@ -87,7 +87,7 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
if( pad )
{
netcode = pad->GetNet();
netcode = pad->GetNetCode();
// put cursor on the pad:
pos = pad->GetPosition();

View File

@ -120,7 +120,7 @@ TRACK* PCB_EDIT_FRAME::Delete_Segment( wxDC* DC, TRACK* aTrack )
return NULL;
}
current_net_code = aTrack->GetNet();
current_net_code = aTrack->GetNetCode();
DLIST<TRACK>* container = (DLIST<TRACK>*)aTrack->GetList();
wxASSERT( container );
@ -142,7 +142,7 @@ void PCB_EDIT_FRAME::Delete_Track( wxDC* DC, TRACK* aTrack )
{
if( aTrack != NULL )
{
int current_net_code = aTrack->GetNet();
int current_net_code = aTrack->GetNetCode();
Remove_One_Track( DC, aTrack );
OnModify();
TestNetConnection( DC, current_net_code );
@ -160,7 +160,7 @@ void PCB_EDIT_FRAME::Delete_net( wxDC* DC, TRACK* aTrack )
PICKED_ITEMS_LIST itemsList;
ITEM_PICKER picker( NULL, UR_DELETED );
int net_code_delete = aTrack->GetNet();
int net_code_delete = aTrack->GetNetCode();
/* Search the first item for the given net code */
TRACK* trackList = GetBoard()->m_Track->GetStartNetCode( net_code_delete );
@ -171,7 +171,7 @@ void PCB_EDIT_FRAME::Delete_net( wxDC* DC, TRACK* aTrack )
for( TRACK* segm = trackList; segm; segm = next_track, ++ii )
{
next_track = segm->Next();
if( segm->GetNet() != net_code_delete )
if( segm->GetNetCode() != net_code_delete )
break;
GetBoard()->m_Track.Remove( segm );
@ -202,7 +202,7 @@ void PCB_EDIT_FRAME::Remove_One_Track( wxDC* DC, TRACK* pt_segm )
if( segments_to_delete_count == 0 )
return;
int net_code = pt_segm->GetNet();
int net_code = pt_segm->GetNetCode();
PICKED_ITEMS_LIST itemsList;
ITEM_PICKER picker( NULL, UR_DELETED );

View File

@ -812,14 +812,14 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event )
if( m_currentPad->GetNetname() != m_PadNetNameCtrl->GetValue() )
{
if( !m_PadNetNameCtrl->GetValue().IsEmpty() && m_padMaster.GetNet() == 0 )
if( !m_PadNetNameCtrl->GetValue().IsEmpty() && m_padMaster.GetNetCode() == 0 )
{
DisplayError( NULL, _( "Unknown netname, netname not changed" ) );
}
else
{
rastnestIsChanged = true;
m_currentPad->SetNet( m_padMaster.GetNet() );
m_currentPad->SetNetCode( m_padMaster.GetNetCode() );
}
}
@ -982,9 +982,9 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( D_PAD* aPad )
// Check if user has set an existing net name
const NETINFO_ITEM* netinfo = m_board->FindNet( m_PadNetNameCtrl->GetValue() );
if( netinfo != NULL )
aPad->SetNet( netinfo->GetNet() );
aPad->SetNetCode( netinfo->GetNet() );
else
aPad->SetNet( 0 );
aPad->SetNetCode( NETINFO_LIST::UNCONNECTED );
// Clear some values, according to the pad type and shape
switch( aPad->GetShape() )
@ -1032,7 +1032,7 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( D_PAD* aPad )
// no offset, no net name, no pad name allowed
aPad->SetOffset( wxPoint( 0, 0 ) );
aPad->SetPadName( wxEmptyString );
aPad->SetNet( 0 );
aPad->SetNetCode( NETINFO_LIST::UNCONNECTED );
break;
default:

View File

@ -342,7 +342,7 @@ void Collect_TrackSegmentsToDrag( BOARD* aPcb, const wxPoint& aRefPos, LAYER_MSK
for( ; track; track = track->Next() )
{
if( track->GetNet() != aNetCode ) // not the same netcodenet code: all candidates tested
if( track->GetNetCode() != aNetCode ) // not the same netcode: all candidates tested
break;
if( ( aLayerMask & track->GetLayerMask() ) == 0 )

View File

@ -549,7 +549,7 @@ void DRC::testZones()
if( !test_area->IsOnCopperLayer() )
continue;
if( test_area->GetNet() < 0 )
if( test_area->GetNetCode() < 0 )
{
m_currentMarker = fillMarker( test_area,
DRCE_NON_EXISTANT_NET_FOR_ZONE_OUTLINE, m_currentMarker );
@ -756,7 +756,7 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, D_PAD** aStart, D_PAD** aEnd, int x_li
// The pad must be in a net (i.e pt_pad->GetNet() != 0 ),
// But no problem if pads have the same netcode (same net)
if( pad->GetNet() && ( aRefPad->GetNet() == pad->GetNet() ) )
if( pad->GetNetCode() && ( aRefPad->GetNetCode() == pad->GetNetCode() ) )
continue;
// if pads are from the same footprint

View File

@ -164,7 +164,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
m_segmAngle = 0;
layerMask = aRefSeg->GetLayerMask();
net_code_ref = aRefSeg->GetNet();
net_code_ref = aRefSeg->GetNetCode();
// Phase 0 : Test vias
if( aRefSeg->Type() == PCB_VIA_T )
@ -310,8 +310,8 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
// The pad must be in a net (i.e pt_pad->GetNet() != 0 )
// but no problem if the pad netcode is the current netcode (same net)
if( pad->GetNet() // the pad must be connected
&& net_code_ref == pad->GetNet() ) // the pad net is the same as current net -> Ok
if( pad->GetNetCode() // the pad must be connected
&& net_code_ref == pad->GetNetCode() ) // the pad net is the same as current net -> Ok
continue;
// DRC for the pad
@ -339,7 +339,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
for( track = aStart; track; track = track->Next() )
{
// No problem if segments have the same net code:
if( net_code_ref == track->GetNet() )
if( net_code_ref == track->GetNetCode() )
continue;
// No problem if segment are on different layers :

View File

@ -1493,7 +1493,7 @@ void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics )
zone->SetTimeStamp( timeStamp( gr->second ) );
zone->SetLayer( layer );
zone->SetNet( NETINFO_LIST::UNCONNECTED );
zone->SetNetCode( NETINFO_LIST::UNCONNECTED );
CPolyLine::HATCH_STYLE outline_hatch = CPolyLine::DIAGONAL_EDGE;
@ -1696,7 +1696,7 @@ void EAGLE_PLUGIN::loadElements( CPTREE& aElements )
if( ni != m_pads_to_nets.end() )
{
const ENET* enet = &ni->second;
pad->SetNet( enet->netcode );
pad->SetNetCode( enet->netcode );
}
}
@ -2387,7 +2387,7 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals )
t->SetWidth( width );
t->SetLayer( layer );
t->SetNet( netCode );
t->SetNetCode( netCode );
m_board->m_Track.Insert( t, NULL );
}
@ -2452,7 +2452,7 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals )
via->SetPosition( pos );
via->SetEnd( pos );
via->SetNet( netCode );
via->SetNetCode( netCode );
via->SetShape( S_CIRCLE ); // @todo should be in SEGVIA constructor
}
@ -2495,7 +2495,7 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals )
zone->SetTimeStamp( timeStamp( it->second ) );
zone->SetLayer( layer );
zone->SetNet( netCode );
zone->SetNetCode( netCode );
CPolyLine::HATCH_STYLE outline_hatch = CPolyLine::DIAGONAL_EDGE;
@ -2551,7 +2551,7 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals )
// KiCad does not support an unconnected zone with its own non-zero netcode,
// but only when assigned netcode = 0 w/o a name...
for( ZONES::iterator it = zones.begin(); it != zones.end(); ++it )
(*it)->SetNet( NETINFO_LIST::UNCONNECTED );
(*it)->SetNetCode( NETINFO_LIST::UNCONNECTED );
// therefore omit this signal/net.
}

Some files were not shown because too many files have changed in this diff Show More