Commit 78732f13 authored by Maciej Suminski's avatar Maciej Suminski

Removed:

- ZONE_CONTAINER::m_Netname field
- ZONE_CONTAINER::SetNetName()
- ZONE_CONTAINER::SetNet() [it uses the one in BOARD_CONNECTED_ITEM]
- ZONE_CONTAINER::GetNetName() [instead BOARD_CONNECTED_ITEM::GetNetname is used]
- ZONE_CONTAINER::SetNetNameFromNetCode()

Performed tests:
- Drawn a zone that belongs to a net, then modified schematics so the net does not exist anymore. After reloading the net list, all pads/tracks are updated. Zones still belongs to the net that does not exist in the schematic (but still exists in .kicad_pcb file). After running DRC, the zone becomes not filled.
- Undo & redo affects assignment of a polygon to a specific net (you may change net of a polygon, refill it and undo/redo the changes).
parent 654e7e55
...@@ -1535,7 +1535,7 @@ int BOARD::SetAreasNetCodesFromNetNames( void ) ...@@ -1535,7 +1535,7 @@ int BOARD::SetAreasNetCodesFromNetNames( void )
if( GetArea( ii )->GetNet() != 0 ) // i.e. if this zone is connected to a net 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 ) if( net )
{ {
...@@ -2720,7 +2720,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets, ...@@ -2720,7 +2720,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
" has non-existent net name \"%s\" **\n" ), " has non-existent net name \"%s\" **\n" ),
GetChars( coord ), GetChars( coord ),
GetChars( zone->GetLayerName() ), GetChars( zone->GetLayerName() ),
GetChars( zone->GetNetName() ) ); GetChars( zone->GetNetname() ) );
aReporter->Report( msg ); aReporter->Report( msg );
} }
} }
......
...@@ -138,31 +138,6 @@ const wxPoint& ZONE_CONTAINER::GetPosition() const ...@@ -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, void ZONE_CONTAINER::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE aDrawMode,
const wxPoint& offset ) const wxPoint& offset )
{ {
...@@ -658,7 +633,7 @@ void ZONE_CONTAINER::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -658,7 +633,7 @@ void ZONE_CONTAINER::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
else // a netcode < 0 is an error else // a netcode < 0 is an error
{ {
msg = wxT( " [" ); msg = wxT( " [" );
msg << m_Netname + wxT( "]" ); msg << GetNetname() + wxT( "]" );
msg << wxT( " <" ) << _( "Not Found" ) << wxT( ">" ); msg << wxT( " <" ) << _( "Not Found" ) << wxT( ">" );
} }
...@@ -849,20 +824,6 @@ void ZONE_CONTAINER::Copy( ZONE_CONTAINER* src ) ...@@ -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 ZoneConnection ZONE_CONTAINER::GetPadConnection( D_PAD* aPad ) const
{ {
if( aPad == NULL || aPad->GetZoneConnection() == UNDEFINED_CONNECTION ) if( aPad == NULL || aPad->GetZoneConnection() == UNDEFINED_CONNECTION )
...@@ -928,7 +889,7 @@ wxString ZONE_CONTAINER::GetSelectMenuText() const ...@@ -928,7 +889,7 @@ wxString ZONE_CONTAINER::GetSelectMenuText() const
else else
{ // A netcode < 0 is an error: { // A netcode < 0 is an error:
// Netname not found or area not initialised // Netname not found or area not initialised
text << wxT( " [" ) << m_Netname << wxT( "]" ); text << wxT( " [" ) << GetNetname() << wxT( "]" );
text << wxT( " <" ) << _( "Not Found" ) << wxT( ">" ); text << wxT( " <" ) << _( "Not Found" ) << wxT( ">" );
} }
} }
......
...@@ -186,31 +186,6 @@ public: ...@@ -186,31 +186,6 @@ public:
return ( GetLayer() < FIRST_NON_COPPER_LAYER ) ? true : false; 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. /// How to fill areas: 0 = use filled polygons, 1 => fill with segments.
void SetFillMode( int aFillMode ) { m_FillMode = aFillMode; } void SetFillMode( int aFillMode ) { m_FillMode = aFillMode; }
int GetFillMode() const { return m_FillMode; } int GetFillMode() const { return m_FillMode; }
...@@ -607,7 +582,6 @@ public: ...@@ -607,7 +582,6 @@ public:
private: private:
CPolyLine* m_Poly; ///< Outline of the zone. 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 CPolyLine* m_smoothedPoly; // Corner-smoothed version of m_Poly
int m_cornerSmoothingType; int m_cornerSmoothingType;
unsigned int m_cornerRadius; unsigned int m_cornerRadius;
......
...@@ -2259,7 +2259,6 @@ void EAGLE_PLUGIN::packageHole( MODULE* aModule, CPTREE& aTree ) const ...@@ -2259,7 +2259,6 @@ void EAGLE_PLUGIN::packageHole( MODULE* aModule, CPTREE& aTree ) const
// no offset, no net name, no pad name allowed // no offset, no net name, no pad name allowed
// pad->SetOffset( wxPoint( 0, 0 ) ); // pad->SetOffset( wxPoint( 0, 0 ) );
// pad->SetPadName( wxEmptyString ); // pad->SetPadName( wxEmptyString );
// pad->SetNetname( wxEmptyString );
wxPoint padpos( kicad_x( e.x ), kicad_y( e.y ) ); wxPoint padpos( kicad_x( e.x ), kicad_y( e.y ) );
...@@ -2496,7 +2495,6 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals ) ...@@ -2496,7 +2495,6 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals )
zone->SetTimeStamp( timeStamp( it->second ) ); zone->SetTimeStamp( timeStamp( it->second ) );
zone->SetLayer( layer ); zone->SetLayer( layer );
zone->SetNet( netCode ); zone->SetNet( netCode );
zone->SetNetName( netName );
CPolyLine::HATCH_STYLE outline_hatch = CPolyLine::DIAGONAL_EDGE; CPolyLine::HATCH_STYLE outline_hatch = CPolyLine::DIAGONAL_EDGE;
...@@ -2552,10 +2550,7 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals ) ...@@ -2552,10 +2550,7 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals )
// KiCad does not support an unconnected zone with its own non-zero netcode, // KiCad does not support an unconnected zone with its own non-zero netcode,
// but only when assigned netcode = 0 w/o a name... // but only when assigned netcode = 0 w/o a name...
for( ZONES::iterator it = zones.begin(); it != zones.end(); ++it ) for( ZONES::iterator it = zones.begin(); it != zones.end(); ++it )
{
(*it)->SetNet( 0 ); (*it)->SetNet( 0 );
(*it)->SetNetName( wxEmptyString );
}
// therefore omit this signal/net. // therefore omit this signal/net.
} }
......
...@@ -1406,7 +1406,7 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const ...@@ -1406,7 +1406,7 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const
// (perhaps netcode and netname should be not stored) // (perhaps netcode and netname should be not stored)
m_out->Print( aNestLevel, "(zone (net %d) (net_name %s)", m_out->Print( aNestLevel, "(zone (net %d) (net_name %s)",
aZone->GetIsKeepout() ? 0 : aZone->GetNet(), 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 ); formatLayer( aZone );
......
...@@ -2238,7 +2238,6 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER() ...@@ -2238,7 +2238,6 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER()
// the zone net name is the name read in file. // the zone net name is the name read in file.
// (When mismatch, the user will be prompted in DRC, to fix the actual name) // (When mismatch, the user will be prompted in DRC, to fix the actual name)
zc->BOARD_CONNECTED_ITEM::SetNet( netcode ); zc->BOARD_CONNECTED_ITEM::SetNet( netcode );
zc->SetNetName( FROM_UTF8( buf ) ); // init the net name here
} }
else if( TESTLINE( "ZLayer" ) ) // layer found else if( TESTLINE( "ZLayer" ) ) // layer found
...@@ -2255,7 +2254,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER() ...@@ -2255,7 +2254,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER()
if( !hopt ) 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 ); THROW_IO_ERROR( m_error );
} }
...@@ -2266,7 +2265,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER() ...@@ -2266,7 +2265,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER()
case 'F': outline_hatch = CPolyLine::DIAGONAL_FULL; break; case 'F': outline_hatch = CPolyLine::DIAGONAL_FULL; break;
default: 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 ); THROW_IO_ERROR( m_error );
} }
...@@ -2283,7 +2282,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER() ...@@ -2283,7 +2282,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER()
if( smoothing >= ZONE_SETTINGS::SMOOTHING_LAST || smoothing < 0 ) 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 ); THROW_IO_ERROR( m_error );
} }
...@@ -2358,7 +2357,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER() ...@@ -2358,7 +2357,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER()
default: default:
m_error.Printf( wxT( "Bad ZClearance padoption for CZONE_CONTAINER '%s'" ), m_error.Printf( wxT( "Bad ZClearance padoption for CZONE_CONTAINER '%s'" ),
zc->GetNetName().GetData() ); zc->GetNetname().GetData() );
THROW_IO_ERROR( m_error ); THROW_IO_ERROR( m_error );
} }
...@@ -2422,10 +2421,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER() ...@@ -2422,10 +2421,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER()
// Ensure keepout does not have a net // Ensure keepout does not have a net
// (which have no sense for a keepout zone) // (which have no sense for a keepout zone)
if( zc->GetIsKeepout() ) if( zc->GetIsKeepout() )
{ zc->SetNet( 0 );
zc->SetNet(0);
zc->SetNetName( wxEmptyString );
}
// should always occur, but who knows, a zone without two corners // should always occur, but who knows, a zone without two corners
// is no zone at all, it's a spot? // is no zone at all, it's a spot?
...@@ -3644,7 +3640,7 @@ void LEGACY_PLUGIN::saveZONE_CONTAINER( const ZONE_CONTAINER* me ) const ...@@ -3644,7 +3640,7 @@ void LEGACY_PLUGIN::saveZONE_CONTAINER( const ZONE_CONTAINER* me ) const
fprintf( m_fp, "ZInfo %lX %d %s\n", fprintf( m_fp, "ZInfo %lX %d %s\n",
me->GetTimeStamp(), me->GetTimeStamp(),
me->GetIsKeepout() ? 0 : me->GetNet(), 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 // Save the outline layer info
fprintf( m_fp, "ZLayer %d\n", me->GetLayer() ); fprintf( m_fp, "ZLayer %d\n", me->GetLayer() );
......
...@@ -172,7 +172,6 @@ void PCB_POLYGON::AddToBoard() ...@@ -172,7 +172,6 @@ void PCB_POLYGON::AddToBoard()
zone->SetTimeStamp( m_timestamp ); zone->SetTimeStamp( m_timestamp );
zone->SetLayer( m_KiCadLayer ); zone->SetLayer( m_KiCadLayer );
zone->SetNet( m_netCode ); zone->SetNet( m_netCode );
zone->SetNetName( m_net );
// add outline // add outline
int outline_hatch = CPolyLine::DIAGONAL_EDGE; int outline_hatch = CPolyLine::DIAGONAL_EDGE;
......
...@@ -2423,7 +2423,7 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER() throw( IO_ERROR, PARSE_ERROR ) ...@@ -2423,7 +2423,7 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER() throw( IO_ERROR, PARSE_ERROR )
case T_net_name: case T_net_name:
NeedSYMBOLorNUMBER(); NeedSYMBOLorNUMBER();
zone->SetNetName( FromUTF8() ); assert( m_board->FindNet( zone->GetNet() )->GetNetname() == FromUTF8() );
NeedRIGHT(); NeedRIGHT();
break; break;
...@@ -2699,10 +2699,7 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER() throw( IO_ERROR, PARSE_ERROR ) ...@@ -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) // Ensure keepout does not have a net (which have no sense for a keepout zone)
if( zone->GetIsKeepout() ) if( zone->GetIsKeepout() )
{ zone->SetNet( 0 );
zone->SetNet(0);
zone->SetNetName( wxEmptyString );
}
return zone.release(); return zone.release();
} }
......
...@@ -1557,7 +1557,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IO_ERROR ) ...@@ -1557,7 +1557,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IO_ERROR )
plane->SetShape( mainPolygon ); plane->SetShape( mainPolygon );
plane->name = TO_UTF8( item->GetNetName() ); plane->name = TO_UTF8( item->GetNetname() );
if( plane->name.size() == 0 ) if( plane->name.size() == 0 )
{ {
......
...@@ -550,7 +550,6 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC ) ...@@ -550,7 +550,6 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
zoneInfo.m_NetcodeSelection = GetBoard()->GetHighLightNetCode(); zoneInfo.m_NetcodeSelection = GetBoard()->GetHighLightNetCode();
zone->SetNet( zoneInfo.m_NetcodeSelection ); zone->SetNet( zoneInfo.m_NetcodeSelection );
zone->SetNetNameFromNetCode( );
} }
double tmp = ZONE_THERMAL_RELIEF_GAP_MIL; double tmp = ZONE_THERMAL_RELIEF_GAP_MIL;
wxGetApp().GetSettings()->Read( ZONE_THERMAL_RELIEF_GAP_STRING_KEY, &tmp ); wxGetApp().GetSettings()->Read( ZONE_THERMAL_RELIEF_GAP_STRING_KEY, &tmp );
...@@ -579,7 +578,6 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC ) ...@@ -579,7 +578,6 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
// Netcode and netname are irrelevant, // Netcode and netname are irrelevant,
// so ensure they are cleared // so ensure they are cleared
zone->SetNet( 0 ); zone->SetNet( 0 );
zone->SetNetName( wxEmptyString );
edited = InvokeKeepoutAreaEditor( this, &zoneInfo ); edited = InvokeKeepoutAreaEditor( this, &zoneInfo );
} }
else else
...@@ -904,7 +902,7 @@ void PCB_EDIT_FRAME::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* aZone ) ...@@ -904,7 +902,7 @@ void PCB_EDIT_FRAME::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* aZone )
NETINFO_ITEM* net = GetBoard()->FindNet( zoneInfo.m_NetcodeSelection ); NETINFO_ITEM* net = GetBoard()->FindNet( zoneInfo.m_NetcodeSelection );
if( net ) // net == NULL should not occur if( net ) // net == NULL should not occur
aZone->SetNetName( net->GetNetname() ); aZone->SetNet( net->GetNet() );
// Combine zones if possible // Combine zones if possible
GetBoard()->OnAreaPolygonModified( &s_AuxiliaryList, aZone ); GetBoard()->OnAreaPolygonModified( &s_AuxiliaryList, aZone );
......
...@@ -103,7 +103,7 @@ int PCB_EDIT_FRAME::Fill_Zone( ZONE_CONTAINER* aZone ) ...@@ -103,7 +103,7 @@ int PCB_EDIT_FRAME::Fill_Zone( ZONE_CONTAINER* aZone )
zoneInfo.m_NetcodeSelection = aZone->GetNet(); zoneInfo.m_NetcodeSelection = aZone->GetNet();
SetZoneSettings( zoneInfo ); SetZoneSettings( zoneInfo );
msg = aZone->GetNetName(); msg = aZone->GetNetname();
if( msg.IsEmpty() ) if( msg.IsEmpty() )
msg = wxT( "No net" ); msg = wxT( "No net" );
...@@ -150,7 +150,7 @@ int PCB_EDIT_FRAME::Fill_All_Zones( wxWindow * aActiveWindow, bool aVerbose ) ...@@ -150,7 +150,7 @@ int PCB_EDIT_FRAME::Fill_All_Zones( wxWindow * aActiveWindow, bool aVerbose )
if( zoneContainer->GetIsKeepout() ) if( zoneContainer->GetIsKeepout() )
continue; continue;
msg.Printf( FORMAT_STRING, ii+1, areaCount, GetChars( zoneContainer->GetNetName() ) ); msg.Printf( FORMAT_STRING, ii + 1, areaCount, GetChars( zoneContainer->GetNetname() ) );
if( progressDialog ) if( progressDialog )
{ {
......
...@@ -67,7 +67,7 @@ bool ZONE_CONTAINER::IsSame( const ZONE_CONTAINER& aZoneToCompare ) ...@@ -67,7 +67,7 @@ bool ZONE_CONTAINER::IsSame( const ZONE_CONTAINER& aZoneToCompare )
if( GetLayer() != aZoneToCompare.GetLayer() ) if( GetLayer() != aZoneToCompare.GetLayer() )
return false; return false;
if( m_Netname != aZoneToCompare.m_Netname ) if( GetNet() != aZoneToCompare.GetNet() )
return false; return false;
if( GetPriority() != aZoneToCompare.GetPriority() ) if( GetPriority() != aZoneToCompare.GetPriority() )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment