diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index dfcebd69e8..af7cc3e4f0 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -1535,7 +1535,7 @@ int BOARD::SetAreasNetCodesFromNetNames( void ) if( GetArea( ii )->GetNet() != 0 ) // i.e. if this zone is connected to a net { - const NETINFO_ITEM* net = FindNet( GetArea( ii )->GetNetName() ); + const NETINFO_ITEM* net = FindNet( GetArea( ii )->GetNetname() ); if( net ) { @@ -2720,7 +2720,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets, " has non-existent net name \"%s\" **\n" ), GetChars( coord ), GetChars( zone->GetLayerName() ), - GetChars( zone->GetNetName() ) ); + GetChars( zone->GetNetname() ) ); aReporter->Report( msg ); } } diff --git a/pcbnew/class_zone.cpp b/pcbnew/class_zone.cpp index b1d8405c81..941f95f3b5 100644 --- a/pcbnew/class_zone.cpp +++ b/pcbnew/class_zone.cpp @@ -138,31 +138,6 @@ const wxPoint& ZONE_CONTAINER::GetPosition() const } -void ZONE_CONTAINER::SetNet( int aNetCode ) -{ - BOARD_CONNECTED_ITEM::SetNet( aNetCode ); - - if( aNetCode < 0 ) - return; - - BOARD* board = GetBoard(); - - if( board ) - { - NETINFO_ITEM* net = board->FindNet( aNetCode ); - - if( net ) - m_Netname = net->GetNetname(); - else - m_Netname.Empty(); - } - else - { - m_Netname.Empty(); - } -} - - void ZONE_CONTAINER::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE aDrawMode, const wxPoint& offset ) { @@ -658,7 +633,7 @@ void ZONE_CONTAINER::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) else // a netcode < 0 is an error { msg = wxT( " [" ); - msg << m_Netname + wxT( "]" ); + msg << GetNetname() + wxT( "]" ); msg << wxT( " <" ) << _( "Not Found" ) << wxT( ">" ); } @@ -849,20 +824,6 @@ void ZONE_CONTAINER::Copy( ZONE_CONTAINER* src ) } -bool ZONE_CONTAINER::SetNetNameFromNetCode( void ) -{ - NETINFO_ITEM* net; - - if( m_Parent && ( net = ( (BOARD*) m_Parent )->FindNet( GetNet() ) ) ) - { - m_Netname = net->GetNetname(); - return true; - } - - return false; -} - - ZoneConnection ZONE_CONTAINER::GetPadConnection( D_PAD* aPad ) const { if( aPad == NULL || aPad->GetZoneConnection() == UNDEFINED_CONNECTION ) @@ -928,7 +889,7 @@ wxString ZONE_CONTAINER::GetSelectMenuText() const else { // A netcode < 0 is an error: // Netname not found or area not initialised - text << wxT( " [" ) << m_Netname << wxT( "]" ); + text << wxT( " [" ) << GetNetname() << wxT( "]" ); text << wxT( " <" ) << _( "Not Found" ) << wxT( ">" ); } } diff --git a/pcbnew/class_zone.h b/pcbnew/class_zone.h index 513859b9d8..6423d85396 100644 --- a/pcbnew/class_zone.h +++ b/pcbnew/class_zone.h @@ -186,31 +186,6 @@ public: return ( GetLayer() < FIRST_NON_COPPER_LAYER ) ? true : false; } - /** - * Function SetNet - * sets the netcode and the netname. - * - * @param aNetCode The net code of the zone container if greater than or equal to - * zero. Otherwise the current net code is kept and set the net - * code error flag. - */ - virtual void SetNet( int aNetCode ); - - /** - * Function SetNetNameFromNetCode - * Find the net name corresponding to the net code. - * @return bool - true if net found, else false - */ - bool SetNetNameFromNetCode( void ); - - /** - * Function GetNetName - * returns the net name. - * @return const wxString& - The net name. - */ - const wxString& GetNetName() const { return m_Netname; }; - void SetNetName( const wxString& aName ) { m_Netname = aName; } - /// How to fill areas: 0 = use filled polygons, 1 => fill with segments. void SetFillMode( int aFillMode ) { m_FillMode = aFillMode; } int GetFillMode() const { return m_FillMode; } @@ -607,7 +582,6 @@ public: private: CPolyLine* m_Poly; ///< Outline of the zone. - wxString m_Netname; ///< Name of the net assigned to the zone. CPolyLine* m_smoothedPoly; // Corner-smoothed version of m_Poly int m_cornerSmoothingType; unsigned int m_cornerRadius; diff --git a/pcbnew/eagle_plugin.cpp b/pcbnew/eagle_plugin.cpp index 6fec2fbdb2..14405e9753 100644 --- a/pcbnew/eagle_plugin.cpp +++ b/pcbnew/eagle_plugin.cpp @@ -2259,7 +2259,6 @@ void EAGLE_PLUGIN::packageHole( MODULE* aModule, CPTREE& aTree ) const // no offset, no net name, no pad name allowed // pad->SetOffset( wxPoint( 0, 0 ) ); // pad->SetPadName( wxEmptyString ); - // pad->SetNetname( wxEmptyString ); wxPoint padpos( kicad_x( e.x ), kicad_y( e.y ) ); @@ -2496,7 +2495,6 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals ) zone->SetTimeStamp( timeStamp( it->second ) ); zone->SetLayer( layer ); zone->SetNet( netCode ); - zone->SetNetName( netName ); CPolyLine::HATCH_STYLE outline_hatch = CPolyLine::DIAGONAL_EDGE; @@ -2552,10 +2550,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( 0 ); - (*it)->SetNetName( wxEmptyString ); - } // therefore omit this signal/net. } diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp index d18c32edaa..ed6d7c062e 100644 --- a/pcbnew/kicad_plugin.cpp +++ b/pcbnew/kicad_plugin.cpp @@ -1406,7 +1406,7 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const // (perhaps netcode and netname should be not stored) m_out->Print( aNestLevel, "(zone (net %d) (net_name %s)", aZone->GetIsKeepout() ? 0 : aZone->GetNet(), - m_out->Quotew( aZone->GetIsKeepout() ? wxT("") : aZone->GetNetName() ).c_str() ); + m_out->Quotew( aZone->GetIsKeepout() ? wxT("") : aZone->GetNetname() ).c_str() ); formatLayer( aZone ); diff --git a/pcbnew/legacy_plugin.cpp b/pcbnew/legacy_plugin.cpp index 532750329c..ade83543f1 100644 --- a/pcbnew/legacy_plugin.cpp +++ b/pcbnew/legacy_plugin.cpp @@ -2238,7 +2238,6 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER() // the zone net name is the name read in file. // (When mismatch, the user will be prompted in DRC, to fix the actual name) zc->BOARD_CONNECTED_ITEM::SetNet( netcode ); - zc->SetNetName( FROM_UTF8( buf ) ); // init the net name here } else if( TESTLINE( "ZLayer" ) ) // layer found @@ -2255,7 +2254,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER() if( !hopt ) { - m_error.Printf( wxT( "Bad ZAux for CZONE_CONTAINER '%s'" ), zc->GetNetName().GetData() ); + m_error.Printf( wxT( "Bad ZAux for CZONE_CONTAINER '%s'" ), zc->GetNetname().GetData() ); THROW_IO_ERROR( m_error ); } @@ -2266,7 +2265,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER() case 'F': outline_hatch = CPolyLine::DIAGONAL_FULL; break; default: - m_error.Printf( wxT( "Bad ZAux for CZONE_CONTAINER '%s'" ), zc->GetNetName().GetData() ); + m_error.Printf( wxT( "Bad ZAux for CZONE_CONTAINER '%s'" ), zc->GetNetname().GetData() ); THROW_IO_ERROR( m_error ); } @@ -2283,7 +2282,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER() if( smoothing >= ZONE_SETTINGS::SMOOTHING_LAST || smoothing < 0 ) { - m_error.Printf( wxT( "Bad ZSmoothing for CZONE_CONTAINER '%s'" ), zc->GetNetName().GetData() ); + m_error.Printf( wxT( "Bad ZSmoothing for CZONE_CONTAINER '%s'" ), zc->GetNetname().GetData() ); THROW_IO_ERROR( m_error ); } @@ -2358,7 +2357,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER() default: m_error.Printf( wxT( "Bad ZClearance padoption for CZONE_CONTAINER '%s'" ), - zc->GetNetName().GetData() ); + zc->GetNetname().GetData() ); THROW_IO_ERROR( m_error ); } @@ -2422,10 +2421,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER() // Ensure keepout does not have a net // (which have no sense for a keepout zone) if( zc->GetIsKeepout() ) - { - zc->SetNet(0); - zc->SetNetName( wxEmptyString ); - } + zc->SetNet( 0 ); // should always occur, but who knows, a zone without two corners // is no zone at all, it's a spot? @@ -3644,7 +3640,7 @@ void LEGACY_PLUGIN::saveZONE_CONTAINER( const ZONE_CONTAINER* me ) const fprintf( m_fp, "ZInfo %lX %d %s\n", me->GetTimeStamp(), me->GetIsKeepout() ? 0 : me->GetNet(), - EscapedUTF8( me->GetIsKeepout() ? wxT("") : me->GetNetName() ).c_str() ); + EscapedUTF8( me->GetIsKeepout() ? wxT("") : me->GetNetname() ).c_str() ); // Save the outline layer info fprintf( m_fp, "ZLayer %d\n", me->GetLayer() ); diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_polygon.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_polygon.cpp index d64f626bf9..5fab0055e8 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_polygon.cpp +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_polygon.cpp @@ -172,7 +172,6 @@ void PCB_POLYGON::AddToBoard() zone->SetTimeStamp( m_timestamp ); zone->SetLayer( m_KiCadLayer ); zone->SetNet( m_netCode ); - zone->SetNetName( m_net ); // add outline int outline_hatch = CPolyLine::DIAGONAL_EDGE; diff --git a/pcbnew/pcb_parser.cpp b/pcbnew/pcb_parser.cpp index b25251a5db..0fd7f55b64 100644 --- a/pcbnew/pcb_parser.cpp +++ b/pcbnew/pcb_parser.cpp @@ -2423,7 +2423,7 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER() throw( IO_ERROR, PARSE_ERROR ) case T_net_name: NeedSYMBOLorNUMBER(); - zone->SetNetName( FromUTF8() ); + assert( m_board->FindNet( zone->GetNet() )->GetNetname() == FromUTF8() ); NeedRIGHT(); break; @@ -2699,10 +2699,7 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER() throw( IO_ERROR, PARSE_ERROR ) // Ensure keepout does not have a net (which have no sense for a keepout zone) if( zone->GetIsKeepout() ) - { - zone->SetNet(0); - zone->SetNetName( wxEmptyString ); - } + zone->SetNet( 0 ); return zone.release(); } diff --git a/pcbnew/specctra_export.cpp b/pcbnew/specctra_export.cpp index 535d6834fa..dee6c8be03 100644 --- a/pcbnew/specctra_export.cpp +++ b/pcbnew/specctra_export.cpp @@ -1557,7 +1557,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IO_ERROR ) plane->SetShape( mainPolygon ); - plane->name = TO_UTF8( item->GetNetName() ); + plane->name = TO_UTF8( item->GetNetname() ); if( plane->name.size() == 0 ) { diff --git a/pcbnew/zones_by_polygon.cpp b/pcbnew/zones_by_polygon.cpp index 19dcfe5f2a..977fef6e29 100644 --- a/pcbnew/zones_by_polygon.cpp +++ b/pcbnew/zones_by_polygon.cpp @@ -550,7 +550,6 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC ) zoneInfo.m_NetcodeSelection = GetBoard()->GetHighLightNetCode(); zone->SetNet( zoneInfo.m_NetcodeSelection ); - zone->SetNetNameFromNetCode( ); } double tmp = ZONE_THERMAL_RELIEF_GAP_MIL; wxGetApp().GetSettings()->Read( ZONE_THERMAL_RELIEF_GAP_STRING_KEY, &tmp ); @@ -579,7 +578,6 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC ) // Netcode and netname are irrelevant, // so ensure they are cleared zone->SetNet( 0 ); - zone->SetNetName( wxEmptyString ); edited = InvokeKeepoutAreaEditor( this, &zoneInfo ); } else @@ -904,7 +902,7 @@ void PCB_EDIT_FRAME::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* aZone ) NETINFO_ITEM* net = GetBoard()->FindNet( zoneInfo.m_NetcodeSelection ); if( net ) // net == NULL should not occur - aZone->SetNetName( net->GetNetname() ); + aZone->SetNet( net->GetNet() ); // Combine zones if possible GetBoard()->OnAreaPolygonModified( &s_AuxiliaryList, aZone ); diff --git a/pcbnew/zones_by_polygon_fill_functions.cpp b/pcbnew/zones_by_polygon_fill_functions.cpp index 61324cb6c7..73ca2a8217 100644 --- a/pcbnew/zones_by_polygon_fill_functions.cpp +++ b/pcbnew/zones_by_polygon_fill_functions.cpp @@ -103,7 +103,7 @@ int PCB_EDIT_FRAME::Fill_Zone( ZONE_CONTAINER* aZone ) zoneInfo.m_NetcodeSelection = aZone->GetNet(); SetZoneSettings( zoneInfo ); - msg = aZone->GetNetName(); + msg = aZone->GetNetname(); if( msg.IsEmpty() ) msg = wxT( "No net" ); @@ -150,7 +150,7 @@ int PCB_EDIT_FRAME::Fill_All_Zones( wxWindow * aActiveWindow, bool aVerbose ) if( zoneContainer->GetIsKeepout() ) continue; - msg.Printf( FORMAT_STRING, ii+1, areaCount, GetChars( zoneContainer->GetNetName() ) ); + msg.Printf( FORMAT_STRING, ii + 1, areaCount, GetChars( zoneContainer->GetNetname() ) ); if( progressDialog ) { diff --git a/pcbnew/zones_functions_for_undo_redo.cpp b/pcbnew/zones_functions_for_undo_redo.cpp index 52166bc5db..8abd5b6306 100644 --- a/pcbnew/zones_functions_for_undo_redo.cpp +++ b/pcbnew/zones_functions_for_undo_redo.cpp @@ -67,7 +67,7 @@ bool ZONE_CONTAINER::IsSame( const ZONE_CONTAINER& aZoneToCompare ) if( GetLayer() != aZoneToCompare.GetLayer() ) return false; - if( m_Netname != aZoneToCompare.m_Netname ) + if( GetNet() != aZoneToCompare.GetNet() ) return false; if( GetPriority() != aZoneToCompare.GetPriority() )