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

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
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -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,
                           " 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 );
        }
        }
    }
    }
+2 −41
Original line number Original line Diff line number Diff line
@@ -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 )
        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 )
}
}




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
        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( ">" );
        }
        }
    }
    }
+0 −26
Original line number Original line Diff line number Diff line
@@ -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:


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;
+0 −5
Original line number Original line Diff line number Diff line
@@ -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 )
                    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 )
            // 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.
        }
        }
+1 −1
Original line number Original line Diff line number Diff line
@@ -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 );


Loading