Commit ed54bdfc authored by jean-pierre charras's avatar jean-pierre charras
Browse files

drc: more code cleaning. Added comments and fixed some erroneous comments. Fixed bug 638839.

fixed bug 641982 (I hope)
parent 577a79bc
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -10,7 +10,7 @@ else(ZLIB_FOUND)
    # and we try to use it
    # and we try to use it
    # Unfortunately, we have no way to know exactlty the path of zlib.h becuase this file
    # Unfortunately, we have no way to know exactlty the path of zlib.h becuase this file
    # is in wxWidgets sources, not in wxWidgets include path.
    # is in wxWidgets sources, not in wxWidgets include path.
    find_path(ZLIB_INCLUDE_DIR  PATHS ${wxWidgets_ROOT_DIR}/../src/zlib/ ${wxWidgets_ROOT_DIR}/src/zlib/ DOC "location of zlib include files")
    find_path(ZLIB_INCLUDE_DIR zlib.h PATHS ${wxWidgets_ROOT_DIR}/../src/zlib/ ${wxWidgets_ROOT_DIR}/src/zlib/ DOC "location of zlib include files")
	find_file(ZLIB_LIBRARIES NAMES ${wxWidgets_LIB_DIR}/libwxzlib-2.8.a ZLIB_LIBRARIES NAMES ${wxWidgets_LIB_DIR}/libwxzlib-2.9.a libwxzlib.a PATHS ${wxWidgets_ROOT_DIR}/lib/ PATH_SUFFIXES gcc_dll DOC "location of wxzlib library file")
	find_file(ZLIB_LIBRARIES NAMES ${wxWidgets_LIB_DIR}/libwxzlib-2.8.a ZLIB_LIBRARIES NAMES ${wxWidgets_LIB_DIR}/libwxzlib-2.9.a libwxzlib.a PATHS ${wxWidgets_ROOT_DIR}/lib/ PATH_SUFFIXES gcc_dll DOC "location of wxzlib library file")
endif(ZLIB_FOUND)
endif(ZLIB_FOUND)


+1 −0
Original line number Original line Diff line number Diff line
@@ -96,6 +96,7 @@ set(PCBNEW_SRCS
    dist.cpp
    dist.cpp
    dragsegm.cpp
    dragsegm.cpp
    drc.cpp
    drc.cpp
    drc_marker_functions.cpp
    edgemod.cpp
    edgemod.cpp
    edit.cpp
    edit.cpp
    editedge.cpp
    editedge.cpp
+1 −1
Original line number Original line Diff line number Diff line
@@ -697,7 +697,7 @@ void MODULE::Set_Rectangle_Encadrement()
     */
     */
    for( D_PAD* pad = m_Pads;  pad;  pad = pad->Next() )
    for( D_PAD* pad = m_Pads;  pad;  pad = pad->Next() )
    {
    {
        rayon = pad->m_Rayon;
        rayon = pad->m_ShapeMaxRadius;
        cx    = pad->m_Pos0.x;
        cx    = pad->m_Pos0.x;
        cy    = pad->m_Pos0.y;
        cy    = pad->m_Pos0.y;
        xmin  = MIN( xmin, cx - rayon );
        xmin  = MIN( xmin, cx - rayon );
+19 −11
Original line number Original line Diff line number Diff line
@@ -44,7 +44,7 @@ D_PAD::D_PAD( MODULE* parent ) : BOARD_CONNECTED_ITEM( parent, TYPE_PAD )


    SetSubRatsnest( 0 );                            // used in ratsnest
    SetSubRatsnest( 0 );                            // used in ratsnest
                                                    // calculations
                                                    // calculations
    ComputeRayon();
    ComputeShapeMaxRadius();
}
}




@@ -53,24 +53,32 @@ D_PAD::~D_PAD()
}
}




/* Calculate the radius of the pad.
/* Calculate the radius of the circle containing the pad.
 */
 */
void D_PAD::ComputeRayon()
void D_PAD::ComputeShapeMaxRadius()
{
{
    switch( m_PadShape & 0x7F )
    switch( m_PadShape & 0x7F )
    {
    {
    case PAD_CIRCLE:
    case PAD_CIRCLE:
        m_Rayon = m_Size.x / 2;
        m_ShapeMaxRadius = m_Size.x / 2;
        break;
        break;


    case PAD_OVAL:
    case PAD_OVAL:
        m_Rayon = MAX( m_Size.x, m_Size.y ) / 2;
        m_ShapeMaxRadius = MAX( m_Size.x, m_Size.y ) / 2;
        break;
        break;


    case PAD_RECT:
    case PAD_RECT:
        m_ShapeMaxRadius = 1 + (int) ( sqrt( (double) m_Size.y * m_Size.y
                               + (double) m_Size.x * m_Size.x ) / 2 );
        break;

    case PAD_TRAPEZOID:
    case PAD_TRAPEZOID:
        m_Rayon = (int) ( sqrt( (double) m_Size.y * m_Size.y
    {   wxSize fullsize = m_Size;
        fullsize.x += ABS(m_DeltaSize.y);   // Remember: m_DeltaSize.y is the m_Size.x change
        fullsize.y += ABS(m_DeltaSize.x);   // Remember: m_DeltaSize.x is the m_Size.y change
        m_ShapeMaxRadius = 1 + (int) ( sqrt( (double) m_Size.y * m_Size.y
                               + (double) m_Size.x * m_Size.x ) / 2 );
                               + (double) m_Size.x * m_Size.x ) / 2 );
    }
        break;
        break;
    }
    }
}
}
@@ -84,11 +92,11 @@ void D_PAD::ComputeRayon()
EDA_Rect D_PAD::GetBoundingBox()
EDA_Rect D_PAD::GetBoundingBox()
{
{
    // Calculate area:
    // Calculate area:
    ComputeRayon();     // calculate the radius of the area, considered as a
    ComputeShapeMaxRadius();     // calculate the radius of the area, considered as a
                        // circle
                        // circle
    EDA_Rect area;
    EDA_Rect area;
    area.SetOrigin( m_Pos );
    area.SetOrigin( m_Pos );
    area.Inflate( m_Rayon, m_Rayon );
    area.Inflate( m_ShapeMaxRadius, m_ShapeMaxRadius );


    return area;
    return area;
}
}
@@ -185,7 +193,7 @@ void D_PAD::Copy( D_PAD* source )
    m_Size = source->m_Size;
    m_Size = source->m_Size;
    m_DeltaSize = source->m_DeltaSize;
    m_DeltaSize = source->m_DeltaSize;
    m_Pos0     = source->m_Pos0;
    m_Pos0     = source->m_Pos0;
    m_Rayon    = source->m_Rayon;
    m_ShapeMaxRadius    = source->m_ShapeMaxRadius;
    m_PadShape = source->m_PadShape;
    m_PadShape = source->m_PadShape;
    m_Attribut = source->m_Attribut;
    m_Attribut = source->m_Attribut;
    m_Orient   = source->m_Orient;
    m_Orient   = source->m_Orient;
@@ -401,7 +409,7 @@ int D_PAD::ReadDescr( FILE* File, int* LineNum )
                m_PadShape = PAD_TRAPEZOID; break;
                m_PadShape = PAD_TRAPEZOID; break;
            }
            }


            ComputeRayon();
            ComputeShapeMaxRadius();
            break;
            break;


        case 'D':
        case 'D':
@@ -766,7 +774,7 @@ bool D_PAD::HitTest( const wxPoint& ref_pos )
    deltaY = ref_pos.y - shape_pos.y;
    deltaY = ref_pos.y - shape_pos.y;


    /* Quick test: a test point must be inside the circle. */
    /* Quick test: a test point must be inside the circle. */
    if( ( abs( deltaX ) > m_Rayon ) || ( abs( deltaY ) > m_Rayon ) )
    if( ( abs( deltaX ) > m_ShapeMaxRadius ) || ( abs( deltaY ) > m_ShapeMaxRadius ) )
        return false;
        return false;


    dx = m_Size.x >> 1; // dx also is the radius for rounded pads
    dx = m_Size.x >> 1; // dx also is the radius for rounded pads
+2 −2
Original line number Original line Diff line number Diff line
@@ -95,7 +95,7 @@ public:


    wxPoint m_Pos0;                 // Initial Pad position (i.e. pas position relative to the module anchor, orientation 0
    wxPoint m_Pos0;                 // Initial Pad position (i.e. pas position relative to the module anchor, orientation 0


    int     m_Rayon;                // radius of pad circle
    int     m_ShapeMaxRadius;       // radius of the circle containing the pad shape
    int     m_Attribut;             // NORMAL, PAD_SMD, PAD_CONN
    int     m_Attribut;             // NORMAL, PAD_SMD, PAD_CONN
    int     m_Orient;               // in 1/10 degrees
    int     m_Orient;               // in 1/10 degrees
    static int m_PadSketchModePenSize;      // Pen size used to draw pads in sketch mode
    static int m_PadSketchModePenSize;      // Pen size used to draw pads in sketch mode
@@ -252,7 +252,7 @@ public:
    void          SetPadName( const wxString& name );       // Change pad name
    void          SetPadName( const wxString& name );       // Change pad name
    wxString      ReturnStringPadName();                    // Return pad name as string in a wxString
    wxString      ReturnStringPadName();                    // Return pad name as string in a wxString
    void          ReturnStringPadName( wxString& text );    // Return pad name as string in a buffer
    void          ReturnStringPadName( wxString& text );    // Return pad name as string in a buffer
    void          ComputeRayon();                           // compute radius
    void          ComputeShapeMaxRadius();                           // compute radius
    const wxPoint ReturnShapePos();
    const wxPoint ReturnShapePos();




Loading