- 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).
This commit is contained in:
Maciej Suminski 2014-01-14 11:41:06 +01:00
parent 654e7e556e
commit 78732f13f7
12 changed files with 18 additions and 98 deletions

View File

@ -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 );
}
}

View File

@ -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( ">" );
}
}

View File

@ -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;

View File

@ -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.
}

View File

@ -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 );

View File

@ -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() );

View File

@ -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;

View File

@ -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();
}

View File

@ -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 )
{

View File

@ -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 );

View File

@ -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 )
{

View File

@ -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() )