Commit 575f13d8 authored by Dick Hollenbeck's avatar Dick Hollenbeck
Browse files

fix VIA::IsOnLayer()

parent 3aa880de
Loading
Loading
Loading
Loading
+8 −6
Original line number Original line Diff line number Diff line
@@ -1401,26 +1401,28 @@ int BOARD::SetAreasNetCodesFromNetNames()


    for( int ii = 0; ii < GetAreaCount(); ii++ )
    for( int ii = 0; ii < GetAreaCount(); ii++ )
    {
    {
        if( !GetArea( ii )->IsOnCopperLayer() )
        ZONE_CONTAINER* it = GetArea( ii );

        if( !it->IsOnCopperLayer() )
        {
        {
            GetArea( ii )->SetNetCode( NETINFO_LIST::UNCONNECTED );
            it->SetNetCode( NETINFO_LIST::UNCONNECTED );
            continue;
            continue;
        }
        }


        if( GetArea( ii )->GetNetCode() != 0 )      // i.e. if this zone is connected to a net
        if( it->GetNetCode() != 0 )      // i.e. if this zone is connected to a net
        {
        {
            const NETINFO_ITEM* net = GetArea( ii )->GetNet();
            const NETINFO_ITEM* net = it->GetNet();


            if( net )
            if( net )
            {
            {
                GetArea( ii )->SetNetCode( net->GetNet() );
                it->SetNetCode( net->GetNet() );
            }
            }
            else
            else
            {
            {
                error_count++;
                error_count++;


                // keep Net Name and set m_NetCode to -1 : error flag.
                // keep Net Name and set m_NetCode to -1 : error flag.
                GetArea( ii )->SetNetCode( -1 );
                it->SetNetCode( -1 );
            }
            }
        }
        }
    }
    }
+3 −1
Original line number Original line Diff line number Diff line
@@ -377,7 +377,9 @@ bool VIA::IsOnLayer( LAYER_ID layer_number ) const


    LayerPair( &top_layer, &bottom_layer );
    LayerPair( &top_layer, &bottom_layer );


    if( bottom_layer <= layer_number && layer_number <= top_layer )
    wxASSERT( top_layer <= bottom_layer );

    if( top_layer <= layer_number && layer_number <= bottom_layer )
        return true;
        return true;
    else
    else
        return false;
        return false;
+24 −29
Original line number Original line Diff line number Diff line
@@ -861,22 +861,19 @@ void PCB_BASE_FRAME::TestNetConnection( wxDC* aDC, int aNetCode )
 */
 */
void PCB_BASE_FRAME::RecalculateAllTracksNetcode()
void PCB_BASE_FRAME::RecalculateAllTracksNetcode()
{
{
    TRACK*              curr_track;

    // Build the net info list
    // Build the net info list
    GetBoard()->BuildListOfNets();
    GetBoard()->BuildListOfNets();


    // Reset variables and flags used in computation
    // Reset variables and flags used in computation
    curr_track = m_Pcb->m_Track;
    for( TRACK* t = m_Pcb->m_Track;  t;  t = t->Next() )
    for( ; curr_track != NULL; curr_track = curr_track->Next() )
    {
    {
        curr_track->m_TracksConnected.clear();
        t->m_TracksConnected.clear();
        curr_track->m_PadsConnected.clear();
        t->m_PadsConnected.clear();
        curr_track->start = NULL;
        t->start = NULL;
        curr_track->end = NULL;
        t->end = NULL;
        curr_track->SetState( BUSY | IN_EDIT | BEGIN_ONPAD | END_ONPAD, false );
        t->SetState( BUSY | IN_EDIT | BEGIN_ONPAD | END_ONPAD, false );
        curr_track->SetZoneSubNet( 0 );
        t->SetZoneSubNet( 0 );
        curr_track->SetNetCode( NETINFO_LIST::UNCONNECTED );
        t->SetNetCode( NETINFO_LIST::UNCONNECTED );
    }
    }


    // If no pad, reset pointers and netcode, and do nothing else
    // If no pad, reset pointers and netcode, and do nothing else
@@ -890,21 +887,19 @@ void PCB_BASE_FRAME::RecalculateAllTracksNetcode()
    // First pass: build connections between track segments and pads.
    // First pass: build connections between track segments and pads.
    connections.SearchTracksConnectedToPads();
    connections.SearchTracksConnectedToPads();


    /* For tracks connected to at least one pad,
    // For tracks connected to at least one pad,
     * set the track net code to the pad netcode
    // set the track net code to the pad netcode
     */
    for( TRACK* t = m_Pcb->m_Track;  t;  t = t->Next() )
    curr_track = m_Pcb->m_Track;
    for( ; curr_track != NULL; curr_track = curr_track->Next() )
    {
    {
        if( curr_track->m_PadsConnected.size() )
        if( t->m_PadsConnected.size() )
            curr_track->SetNetCode( curr_track->m_PadsConnected[0]->GetNetCode() );
            t->SetNetCode( t->m_PadsConnected[0]->GetNetCode() );
    }
    }


    // Pass 2: build connections between track ends
    // Pass 2: build connections between track ends
    for( curr_track = m_Pcb->m_Track; curr_track != NULL; curr_track = curr_track->Next() )
    for( TRACK* t = m_Pcb->m_Track;  t;  t = t->Next() )
    {
    {
        connections.SearchConnectedTracks( curr_track );
        connections.SearchConnectedTracks( t );
        connections.GetConnectedTracks( curr_track );
        connections.GetConnectedTracks( t );
    }
    }


    // Propagate net codes from a segment to other connected segments
    // Propagate net codes from a segment to other connected segments
@@ -915,21 +910,21 @@ void PCB_BASE_FRAME::RecalculateAllTracksNetcode()
    {
    {
        new_pass_request = false;
        new_pass_request = false;


        for( curr_track = m_Pcb->m_Track; curr_track; curr_track = curr_track->Next() )
        for( TRACK* t = m_Pcb->m_Track;  t;  t = t->Next() )
        {
        {
            int netcode = curr_track->GetNetCode();
            int netcode = t->GetNetCode();


            if( netcode == 0 )
            if( netcode == 0 )
            {
            {
                // try to find a connected item having a netcode
                // try to find a connected item having a netcode
                for( unsigned kk = 0; kk < curr_track->m_TracksConnected.size(); kk++ )
                for( unsigned kk = 0; kk < t->m_TracksConnected.size(); kk++ )
                {
                {
                    int altnetcode = curr_track->m_TracksConnected[kk]->GetNetCode();
                    int altnetcode = t->m_TracksConnected[kk]->GetNetCode();
                    if( altnetcode )
                    if( altnetcode )
                    {
                    {
                        new_pass_request = true;
                        new_pass_request = true;
                        netcode = altnetcode;
                        netcode = altnetcode;
                        curr_track->SetNetCode(netcode);
                        t->SetNetCode(netcode);
                        break;
                        break;
                    }
                    }
                }
                }
@@ -938,12 +933,12 @@ void PCB_BASE_FRAME::RecalculateAllTracksNetcode()
            if( netcode )    // this track has a netcode
            if( netcode )    // this track has a netcode
            {
            {
                // propagate this netcode to connected tracks having no netcode
                // propagate this netcode to connected tracks having no netcode
                for( unsigned kk = 0; kk < curr_track->m_TracksConnected.size(); kk++ )
                for( unsigned kk = 0; kk < t->m_TracksConnected.size(); kk++ )
                {
                {
                    int altnetcode = curr_track->m_TracksConnected[kk]->GetNetCode();
                    int altnetcode = t->m_TracksConnected[kk]->GetNetCode();
                    if( altnetcode == 0 )
                    if( altnetcode == 0 )
                    {
                    {
                        curr_track->m_TracksConnected[kk]->SetNetCode(netcode);
                        t->m_TracksConnected[kk]->SetNetCode(netcode);
                        new_pass_request = true;
                        new_pass_request = true;
                    }
                    }
                }
                }
+40 −43
Original line number Original line Diff line number Diff line
@@ -2751,7 +2751,6 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER() throw( IO_ERROR, PARSE_ERROR )
                NeedRIGHT();
                NeedRIGHT();
                zone->AddPolygon( corners );
                zone->AddPolygon( corners );
            }
            }

            break;
            break;


        case T_filled_polygon:
        case T_filled_polygon:
@@ -2771,7 +2770,6 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER() throw( IO_ERROR, PARSE_ERROR )
                NeedRIGHT();
                NeedRIGHT();
                pts.CloseLastContour();
                pts.CloseLastContour();
            }
            }

            break;
            break;


        case T_fill_segments:
        case T_fill_segments:
@@ -2795,7 +2793,6 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER() throw( IO_ERROR, PARSE_ERROR )


                zone->AddFillSegments( segs );
                zone->AddFillSegments( segs );
            }
            }

            break;
            break;


        default:
        default:
+1 −0
Original line number Original line Diff line number Diff line
@@ -790,6 +790,7 @@ static bool sort_by_distance( const wxPoint& ref, const wxPoint& compare )


    return lengthref < lengthcmp;
    return lengthref < lengthcmp;
}
}

static bool sort_by_point( const wxPoint& ref, const wxPoint& compare )
static bool sort_by_point( const wxPoint& ref, const wxPoint& compare )
{
{
    if( ref.x == compare.x )
    if( ref.x == compare.x )
Loading