Commit 59be0f6e authored by Andrew Zonenberg's avatar Andrew Zonenberg Committed by Maciej Suminski
Browse files

1) Pad properties dialog can trigger divide-by-zero when "0" is entered as the pad size

2) PNS router incorrectly detects collisions with blind/buried vias that don't actually intersect the active layer
3) PNS router silently converts blind/buried vias to through-board vias when shoved
parents 33605eaa e6fba84e
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -965,6 +965,11 @@ unsigned int D_PAD::ViewGetLOD( int aLayer ) const
    // Netnames will be shown only if zoom is appropriate
    if( IsNetnameLayer( aLayer ) )
    {
        // Pad sizes can be zero briefly when someone is typing a number like "0.5" in the pad properties dialog.
        // Fail gracefully if this happens.
        if( ( m_Size.x == 0 ) && ( m_Size.y == 0 ) )
            return UINT_MAX;

        return ( 100000000 / std::max( m_Size.x, m_Size.y ) );
    }

+8 −4
Original line number Diff line number Diff line
@@ -227,12 +227,15 @@ PNS_ITEM* PNS_ROUTER::syncTrack( TRACK* aTrack )

PNS_ITEM* PNS_ROUTER::syncVia( VIA* aVia )
{
    LAYER_ID top, bottom;
    aVia->LayerPair( &top, &bottom );
    PNS_VIA* v = new PNS_VIA(
            aVia->GetPosition(),
            PNS_LAYERSET( 0, MAX_CU_LAYERS - 1 ),
            PNS_LAYERSET( top, bottom ),
            aVia->GetWidth(),
            aVia->GetDrillValue(),
            aVia->GetNetCode() );
            aVia->GetNetCode(),
            aVia->GetViaType() );

    v->SetParent( aVia );

@@ -759,8 +762,9 @@ void PNS_ROUTER::CommitRouting( PNS_NODE* aNode )
            via_board->SetWidth( via->Diameter() );
            via_board->SetDrill( via->Drill() );
            via_board->SetNetCode( via->Net() );
            via_board->SetLayerPair( ToLAYER_ID( m_settings.GetLayerTop() ),
                                     ToLAYER_ID( m_settings.GetLayerBottom() ) );
            via_board->SetViaType( via->ViaType() ); // MUST be before SetLayerPair()
            via_board->SetLayerPair( ToLAYER_ID( via->Layers().Start() ),
                                     ToLAYER_ID( via->Layers().End() ) );
            newBI = via_board;
            break;
        }
+1 −0
Original line number Diff line number Diff line
@@ -91,6 +91,7 @@ PNS_VIA* PNS_VIA::Clone ( ) const
    v->m_shape = SHAPE_CIRCLE( m_pos, m_diameter / 2 );
    v->m_rank = m_rank;
    v->m_marker = m_marker;
    v->m_viaType = m_viaType;

    return v;
}
+16 −1
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@
#include <geometry/shape_line_chain.h>
#include <geometry/shape_circle.h>

#include "../class_track.h"

#include "pns_item.h"

class PNS_NODE;
@@ -36,7 +38,7 @@ public:
    {}

    PNS_VIA( const VECTOR2I& aPos, const PNS_LAYERSET& aLayers,
             int aDiameter, int aDrill, int aNet = -1 ) :
             int aDiameter, int aDrill, int aNet = -1, VIATYPE_T aViaType = VIA_THROUGH ) :
        PNS_ITEM( VIA )
    {
        SetNet( aNet );
@@ -45,6 +47,7 @@ public:
        m_diameter = aDiameter;
        m_drill = aDrill;
        m_shape = SHAPE_CIRCLE( aPos, aDiameter / 2 );
        m_viaType = aViaType;
    }


@@ -60,6 +63,7 @@ public:
        m_rank = aB.m_rank;
        m_owner = aB.m_owner;
        m_drill = aB.m_drill;
        m_viaType = aB.m_viaType;
    }

    const VECTOR2I& Pos() const
@@ -73,6 +77,16 @@ public:
        m_shape.SetCenter( aPos );
    }

    VIATYPE_T ViaType() const
    {
        return m_viaType;
    }

    void SetViaType( VIATYPE_T aViaType )
    {
        m_viaType = aViaType;
    }

    int Diameter() const
    {
        return m_diameter;
@@ -124,6 +138,7 @@ private:
    int m_drill;
    VECTOR2I m_pos;
    SHAPE_CIRCLE m_shape;
    VIATYPE_T m_viaType;
};

#endif