removed in drawpanel an erroneous change (was made only for a test). drc code cleaning. cmakelist.txt changes in minizip.

This commit is contained in:
jean-pierre charras 2010-09-18 10:29:40 +02:00
parent f7af38a6ac
commit 5738d2960d
12 changed files with 195 additions and 179 deletions

View File

@ -866,7 +866,7 @@ void WinEDA_DrawPanel::DrawGrid( wxDC* DC )
wxMemoryDC tmpDC; wxMemoryDC tmpDC;
wxBitmap tmpBM( 1, screenSize.y ); wxBitmap tmpBM( 1, screenSize.y );
tmpDC.SelectObject( tmpBM ); tmpDC.SelectObject( tmpBM );
GRSetColorPen( &tmpDC, WHITE/*g_DrawBgColor*/ ); GRSetColorPen( &tmpDC, g_DrawBgColor );
tmpDC.DrawLine( 0, 0, 0, screenSize.y-1 ); // init background tmpDC.DrawLine( 0, 0, 0, screenSize.y-1 ); // init background
GRSetColorPen( &tmpDC, m_Parent->GetGridColor() ); GRSetColorPen( &tmpDC, m_Parent->GetGridColor() );
for( jj = 0; ; jj++ ) // draw grid points for( jj = 0; ; jj++ ) // draw grid points

View File

@ -8,8 +8,8 @@ else(ZLIB_FOUND)
# include files are in ${wxWidgets_ROOT_DIR}/src/zlib # include files are in ${wxWidgets_ROOT_DIR}/src/zlib
# and the corresponding library is libwxzlib-<version>.a (like libwxzlib-2.8.a) # and the corresponding library is libwxzlib-<version>.a (like libwxzlib-2.8.a)
# and we try to use it # and we try to use it
find_path(ZLIB_INCLUDE_DIR zlib.h PATHS ${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")
set(ZLIB_LIBRARIES ${wxWidgets_ROOT_DIR}/lib/libwxzlib-2.8.a) 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)
include_directories(${CMAKE_CURRENT_SOURCE_DIR} include_directories(${CMAKE_CURRENT_SOURCE_DIR}

View File

@ -869,10 +869,13 @@ void BOARD::DisplayInfo( WinEDA_DrawFrame* frame )
frame->ClearMsgPanel(); frame->ClearMsgPanel();
int viasCount = 0; int viasCount = 0;
int trackSegmentsCount = 0;
for( BOARD_ITEM* item = m_Track; item; item = item->Next() ) for( BOARD_ITEM* item = m_Track; item; item = item->Next() )
{ {
if( item->Type() == TYPE_VIA ) if( item->Type() == TYPE_VIA )
viasCount++; viasCount++;
else
trackSegmentsCount++;
} }
txt.Printf( wxT( "%d" ), GetPadsCount() ); txt.Printf( wxT( "%d" ), GetPadsCount() );
@ -881,6 +884,9 @@ void BOARD::DisplayInfo( WinEDA_DrawFrame* frame )
txt.Printf( wxT( "%d" ), viasCount ); txt.Printf( wxT( "%d" ), viasCount );
frame->AppendMsgPanel( _( "Vias" ), txt, DARKGREEN ); frame->AppendMsgPanel( _( "Vias" ), txt, DARKGREEN );
txt.Printf( wxT( "%d" ), trackSegmentsCount );
frame->AppendMsgPanel( _( "trackSegm" ), txt, DARKGREEN );
txt.Printf( wxT( "%d" ), GetNodesCount() ); txt.Printf( wxT( "%d" ), GetNodesCount() );
frame->AppendMsgPanel( _( "Nodes" ), txt, DARKCYAN ); frame->AppendMsgPanel( _( "Nodes" ), txt, DARKCYAN );

View File

@ -30,6 +30,7 @@
#include "common.h" #include "common.h"
#include "pcbnew.h" #include "pcbnew.h"
#include "drc_stuff.h"
wxString DRC_ITEM::GetErrorText() const wxString DRC_ITEM::GetErrorText() const
{ {

View File

@ -6,8 +6,7 @@
#define CLASS_MARKER_PCB_H #define CLASS_MARKER_PCB_H
#include "base_struct.h" #include "base_struct.h"
#include "class_marker_base.h"
#include "drc_stuff.h"
class MARKER_PCB : public BOARD_ITEM, public MARKER_BASE class MARKER_PCB : public BOARD_ITEM, public MARKER_BASE
{ {

View File

@ -42,7 +42,6 @@
#include "protos.h" #include "protos.h"
#include "drc_stuff.h" #include "drc_stuff.h"
#include "dialog_drc.h" #include "dialog_drc.h"
@ -108,12 +107,7 @@ DRC::DRC( WinEDA_PcbFrame* aPcbWindow )
// m_rptFilename set to empty by its constructor // m_rptFilename set to empty by its constructor
m_currentMarker = 0; m_currentMarker = NULL;
m_spotcx = 0;
m_spotcy = 0;
m_finx = 0;
m_finy = 0;
m_segmAngle = 0; m_segmAngle = 0;
m_segmLength = 0; m_segmLength = 0;
@ -539,6 +533,8 @@ void DRC::testZones( bool adoTestFillSegments )
if( !adoTestFillSegments ) if( !adoTestFillSegments )
return; return;
// m_pcb->m_Zone is fully obsolete. Keep this test for compatibility
// with old designs. Will be removed on day
for( zoneSeg = m_pcb->m_Zone; zoneSeg && zoneSeg->Next(); zoneSeg = zoneSeg->Next() ) for( zoneSeg = m_pcb->m_Zone; zoneSeg && zoneSeg->Next(); zoneSeg = zoneSeg->Next() )
{ {
// Test zoneSeg with other zone segments and with all pads // Test zoneSeg with other zone segments and with all pads
@ -705,13 +701,13 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
NETCLASS* netclass = aRefSeg->GetNetClass(); NETCLASS* netclass = aRefSeg->GetNetClass();
// Origine sur le PCB des axes du repere centre sur /* In order to make some calculations more easier or faster,
// l'origine du segment de reference * pads and tracks coordinates will be made relative to the reference segment origin
int org_X = aRefSeg->m_Start.x; */
int org_Y = aRefSeg->m_Start.y; wxPoint origin = aRefSeg->m_Start; // origin will be the origin of other coordinates
m_finx = dx = aRefSeg->m_End.x - org_X; m_segmEnd.x = dx = aRefSeg->m_End.x - origin.x;
m_finy = dy = aRefSeg->m_End.y - org_Y; m_segmEnd.y = dy = aRefSeg->m_End.y - origin.y;
layerMask = aRefSeg->ReturnMaskLayer(); layerMask = aRefSeg->ReturnMaskLayer();
net_code_ref = aRefSeg->GetNet(); net_code_ref = aRefSeg->GetNet();
@ -834,8 +830,8 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
pseudo_pad.m_Orient = pad->m_Orient; pseudo_pad.m_Orient = pad->m_Orient;
pseudo_pad.ComputeRayon(); // compute the radius pseudo_pad.ComputeRayon(); // compute the radius
m_spotcx = pseudo_pad.GetPosition().x - org_X; m_padToTestPos.x = pseudo_pad.GetPosition().x - origin.x;
m_spotcy = pseudo_pad.GetPosition().y - org_Y; m_padToTestPos.y = pseudo_pad.GetPosition().y - origin.y;
if( !checkClearanceSegmToPad( &pseudo_pad, refsegm_half_width, if( !checkClearanceSegmToPad( &pseudo_pad, refsegm_half_width,
netclass->GetClearance() ) ) netclass->GetClearance() ) )
@ -856,8 +852,8 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
// DRC for the pad // DRC for the pad
shape_pos = pad->ReturnShapePos(); shape_pos = pad->ReturnShapePos();
m_spotcx = shape_pos.x - org_X; m_padToTestPos.x = shape_pos.x - origin.x;
m_spotcy = shape_pos.y - org_Y; m_padToTestPos.y = shape_pos.y - origin.y;
if( !checkClearanceSegmToPad( pad, refsegm_half_width, aRefSeg->GetClearance( pad ) ) ) if( !checkClearanceSegmToPad( pad, refsegm_half_width, aRefSeg->GetClearance( pad ) ) )
{ {
@ -899,21 +895,17 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
// If the reference segment is a via, we test it here // If the reference segment is a via, we test it here
if( aRefSeg->Type() == TYPE_VIA ) if( aRefSeg->Type() == TYPE_VIA )
{ {
int orgx, orgy; // origine du repere d'axe X = segment a comparer
int angle = 0; // angle du segment a tester; int angle = 0; // angle du segment a tester;
orgx = track->m_Start.x; dx = track->m_End.x - track->m_Start.x;
orgy = track->m_Start.y; dy = track->m_End.y - track->m_Start.y;
dx = track->m_End.x - orgx; x0 = aRefSeg->m_Start.x - track->m_Start.x;
dy = track->m_End.y - orgy; y0 = aRefSeg->m_Start.y - track->m_Start.y;
x0 = aRefSeg->m_Start.x - orgx;
y0 = aRefSeg->m_Start.y - orgy;
if( track->Type() == TYPE_VIA ) if( track->Type() == TYPE_VIA )
{ {
// Test distance between two vias // Test distance between two vias, i.e. two circles, trivial case
if( (int) hypot( x0, y0 ) < w_dist ) if( (int) hypot( x0, y0 ) < w_dist )
{ {
m_currentMarker = fillMarker( aRefSeg, track, m_currentMarker = fillMarker( aRefSeg, track,
@ -944,11 +936,11 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
* the segment to test in the new axis : the new X axis is the * the segment to test in the new axis : the new X axis is the
* reference segment. We must translate and rotate the segment to test * reference segment. We must translate and rotate the segment to test
*/ */
x0 = track->m_Start.x - org_X; x0 = track->m_Start.x - origin.x;
y0 = track->m_Start.y - org_Y; y0 = track->m_Start.y - origin.y;
xf = track->m_End.x - org_X; xf = track->m_End.x - origin.x;
yf = track->m_End.y - org_Y; yf = track->m_End.y - origin.y;
RotatePoint( &x0, &y0, m_segmAngle ); RotatePoint( &x0, &y0, m_segmAngle );
RotatePoint( &xf, &yf, m_segmAngle ); RotatePoint( &xf, &yf, m_segmAngle );
@ -1262,8 +1254,10 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad )
goto exit; goto exit;
/* Here, pads are near and DRC depend on the pad shapes /* Here, pads are near and DRC depend on the pad shapes
* We must compare distance using a fine shape analysis */ * We must compare distance using a fine shape analysis
* Because a circle or oval shape is the easier shape to test, try to have
* aRefPad shape type = PAD_CIRCLE or PAD_OVAL. Swap aRefPad and aPad if needed
*/
bool swap_pads; bool swap_pads;
swap_pads = false; swap_pads = false;
if( (aRefPad->m_PadShape != PAD_CIRCLE) && (aPad->m_PadShape == PAD_CIRCLE) ) if( (aRefPad->m_PadShape != PAD_CIRCLE) && (aPad->m_PadShape == PAD_CIRCLE) )
@ -1280,7 +1274,7 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad )
/* Because pad exchange, aRefPad shape is PAD_CIRCLE or PAD_OVAL, /* Because pad exchange, aRefPad shape is PAD_CIRCLE or PAD_OVAL,
* if one of the 2 pads was a PAD_CIRCLE or PAD_OVAL. * if one of the 2 pads was a PAD_CIRCLE or PAD_OVAL.
* Therefore, if aRefPad is a PAD_RECT or a PAD_TRAPEZOID, * Therefore, if aRefPad is a PAD_RECT or a PAD_TRAPEZOID,
* the other pad is also a PAD_RECT or a PAD_TRAPEZOID * aPad is also a PAD_RECT or a PAD_TRAPEZOID
*/ */
switch( aRefPad->m_PadShape ) switch( aRefPad->m_PadShape )
{ {
@ -1288,16 +1282,16 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad )
m_segmLength = 0; m_segmLength = 0;
m_segmAngle = 0; m_segmAngle = 0;
m_finx = m_finy = 0; m_segmEnd.x = m_segmEnd.y = 0;
m_spotcx = rel_pos.x; m_padToTestPos.x = rel_pos.x;
m_spotcy = rel_pos.y; m_padToTestPos.y = rel_pos.y;
diag = checkClearanceSegmToPad( aPad, aRefPad->m_Rayon, dist_min ); diag = checkClearanceSegmToPad( aPad, aRefPad->m_Rayon, dist_min );
break; break;
case PAD_RECT: case PAD_RECT:
RotatePoint( &rel_pos.x, &rel_pos.y, aRefPad->m_Orient ); RotatePoint( &rel_pos, aRefPad->m_Orient );
// pad_angle = pad orient relative to the aRefPad orient // pad_angle = pad orient relative to the aRefPad orient
pad_angle = aRefPad->m_Orient + aPad->m_Orient; pad_angle = aRefPad->m_Orient + aPad->m_Orient;
@ -1309,8 +1303,7 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad )
// The trivial case is if both rects are rotated by multiple of 90 deg // The trivial case is if both rects are rotated by multiple of 90 deg
// Most of time this is the case, and the test is fast // Most of time this is the case, and the test is fast
if( ( (aRefPad->m_Orient == 0) || (aRefPad->m_Orient == 900) if( ( (aRefPad->m_Orient == 0) || (aRefPad->m_Orient == 900)
|| (aRefPad->m_Orient == 1800) || (aRefPad->m_Orient == 1800) || (aRefPad->m_Orient == 2700) )
|| (aRefPad->m_Orient == 2700) )
&& ( (aPad->m_Orient == 0) || (aPad->m_Orient == 900) || (aPad->m_Orient == 1800) && ( (aPad->m_Orient == 0) || (aPad->m_Orient == 900) || (aPad->m_Orient == 1800)
|| (aPad->m_Orient == 2700) ) ) || (aPad->m_Orient == 2700) ) )
{ {
@ -1394,7 +1387,6 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad )
&x, &x,
&y, &y,
&d ); &d );
;
if( intersect || (d< dist_min) ) if( intersect || (d< dist_min) )
{ {
diag = false; diag = false;
@ -1436,11 +1428,10 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad )
RotatePoint( &segstart, m_segmAngle ); // True start point coordinate of the equivalent segment RotatePoint( &segstart, m_segmAngle ); // True start point coordinate of the equivalent segment
// move pad position relative to the segment origin // move pad position relative to the segment origin
m_spotcx = rel_pos.x - segstart.x; m_padToTestPos = rel_pos - segstart;
m_spotcy = rel_pos.y - segstart.y;
// Calculate segment end // Calculate segment end
m_finx = -2 * segstart.x; m_segmEnd.x = -2 * segstart.x;
m_finy = -2 * segstart.y; // end of segment coordinate m_segmEnd.y = -2 * segstart.y; // end of segment coordinate
diag = checkClearanceSegmToPad( aPad, segm_width / 2, dist_min ); diag = checkClearanceSegmToPad( aPad, segm_width / 2, dist_min );
break; break;
} }
@ -1459,41 +1450,40 @@ exit: // the only way out (hopefully) for simpler debugging
bool DRC::checkClearanceSegmToPad( const D_PAD* pad_to_test, int w_segm, int aMinDist ) bool DRC::checkClearanceSegmToPad( const D_PAD* pad_to_test, int w_segm, int aMinDist )
{ {
int p_dimx; wxSize padHalfsize; // half the dimension of the pad
int p_dimy; // half the dimension of the pad
int orient; int orient;
int x0, y0, xf, yf; int x0, y0, xf, yf;
int seuil; int seuil;
int deltay; int deltay;
seuil = w_segm + aMinDist; seuil = w_segm + aMinDist;
p_dimx = pad_to_test->m_Size.x >> 1; padHalfsize.x = pad_to_test->m_Size.x >> 1;
p_dimy = pad_to_test->m_Size.y >> 1; padHalfsize.y = pad_to_test->m_Size.y >> 1;
if( pad_to_test->m_PadShape == PAD_CIRCLE ) if( pad_to_test->m_PadShape == PAD_CIRCLE )
{ {
/* calcul des coord centre du pad dans le repere axe X confondu /* calcul des coord centre du pad dans le repere axe X confondu
* avec le segment en tst */ * avec le segment en tst */
RotatePoint( &m_spotcx, &m_spotcy, m_segmAngle ); RotatePoint( &m_padToTestPos.x, &m_padToTestPos.y, m_segmAngle );
return checkMarginToCircle( m_spotcx, m_spotcy, seuil + p_dimx, m_segmLength ); return checkMarginToCircle( m_padToTestPos.x, m_padToTestPos.y, seuil + padHalfsize.x, m_segmLength );
} }
else else
{ {
/* calcul de la "surface de securite" du pad de reference */ /* calcul de la "surface de securite" du pad de reference */
m_xcliplo = m_spotcx - seuil - p_dimx; m_xcliplo = m_padToTestPos.x - seuil - padHalfsize.x;
m_ycliplo = m_spotcy - seuil - p_dimy; m_ycliplo = m_padToTestPos.y - seuil - padHalfsize.y;
m_xcliphi = m_spotcx + seuil + p_dimx; m_xcliphi = m_padToTestPos.x + seuil + padHalfsize.x;
m_ycliphi = m_spotcy + seuil + p_dimy; m_ycliphi = m_padToTestPos.y + seuil + padHalfsize.y;
x0 = y0 = 0; x0 = y0 = 0;
xf = m_finx; xf = m_segmEnd.x;
yf = m_finy; yf = m_segmEnd.y;
orient = pad_to_test->m_Orient; orient = pad_to_test->m_Orient;
RotatePoint( &x0, &y0, m_spotcx, m_spotcy, -orient ); RotatePoint( &x0, &y0, m_padToTestPos.x, m_padToTestPos.y, -orient );
RotatePoint( &xf, &yf, m_spotcx, m_spotcy, -orient ); RotatePoint( &xf, &yf, m_padToTestPos.x, m_padToTestPos.y, -orient );
if( checkLine( x0, y0, xf, yf ) ) if( checkLine( x0, y0, xf, yf ) )
return true; return true;
@ -1507,51 +1497,51 @@ bool DRC::checkClearanceSegmToPad( const D_PAD* pad_to_test, int w_segm, int aMi
case PAD_OVAL: case PAD_OVAL:
/* test de la pastille ovale ramenee au type ovale vertical */ /* test de la pastille ovale ramenee au type ovale vertical */
if( p_dimx > p_dimy ) if( padHalfsize.x > padHalfsize.y )
{ {
EXCHG( p_dimx, p_dimy ); EXCHG( padHalfsize.x, padHalfsize.y );
orient += 900; orient += 900;
if( orient >= 3600 ) if( orient >= 3600 )
orient -= 3600; orient -= 3600;
} }
deltay = p_dimy - p_dimx; deltay = padHalfsize.y - padHalfsize.x;
/* ici: p_dimx = rayon, /* ici: padHalfsize.x = rayon,
* delta = dist centre cercles a centre pad */ * delta = dist centre cercles a centre pad */
/* Test du rectangle separant les 2 demi cercles */ /* Test du rectangle separant les 2 demi cercles */
m_xcliplo = m_spotcx - seuil - p_dimx; m_xcliplo = m_padToTestPos.x - seuil - padHalfsize.x;
m_ycliplo = m_spotcy - w_segm - deltay; m_ycliplo = m_padToTestPos.y - w_segm - deltay;
m_xcliphi = m_spotcx + seuil + p_dimx; m_xcliphi = m_padToTestPos.x + seuil + padHalfsize.x;
m_ycliphi = m_spotcy + w_segm + deltay; m_ycliphi = m_padToTestPos.y + w_segm + deltay;
if( !checkLine( x0, y0, xf, yf ) ) if( !checkLine( x0, y0, xf, yf ) )
return false; return false;
/* test des 2 cercles */ /* test des 2 cercles */
x0 = m_spotcx; /* x0,y0 = centre du cercle superieur du pad ovale */ x0 = m_padToTestPos.x; /* x0,y0 = centre du cercle superieur du pad ovale */
y0 = m_spotcy + deltay; y0 = m_padToTestPos.y + deltay;
RotatePoint( &x0, &y0, m_spotcx, m_spotcy, orient ); RotatePoint( &x0, &y0, m_padToTestPos.x, m_padToTestPos.y, orient );
RotatePoint( &x0, &y0, m_segmAngle ); RotatePoint( &x0, &y0, m_segmAngle );
if( !checkMarginToCircle( x0, y0, p_dimx + seuil, m_segmLength ) ) if( !checkMarginToCircle( x0, y0, padHalfsize.x + seuil, m_segmLength ) )
return false; return false;
x0 = m_spotcx; /* x0,y0 = centre du cercle inferieur du pad ovale */ x0 = m_padToTestPos.x; /* x0,y0 = centre du cercle inferieur du pad ovale */
y0 = m_spotcy - deltay; y0 = m_padToTestPos.y - deltay;
RotatePoint( &x0, &y0, m_spotcx, m_spotcy, orient ); RotatePoint( &x0, &y0, m_padToTestPos.x, m_padToTestPos.y, orient );
RotatePoint( &x0, &y0, m_segmAngle ); RotatePoint( &x0, &y0, m_segmAngle );
if( !checkMarginToCircle( x0, y0, p_dimx + seuil, m_segmLength ) ) if( !checkMarginToCircle( x0, y0, padHalfsize.x + seuil, m_segmLength ) )
return false; return false;
break; break;
case PAD_RECT: /* 2 rectangle + 4 1/4 cercles a tester */ case PAD_RECT: /* 2 rectangle + 4 1/4 cercles a tester */
/* Test du rectangle dimx + seuil, dimy */ /* Test du rectangle dimx + seuil, dimy */
m_xcliplo = m_spotcx - p_dimx - seuil; m_xcliplo = m_padToTestPos.x - padHalfsize.x - seuil;
m_ycliplo = m_spotcy - p_dimy; m_ycliplo = m_padToTestPos.y - padHalfsize.y;
m_xcliphi = m_spotcx + p_dimx + seuil; m_xcliphi = m_padToTestPos.x + padHalfsize.x + seuil;
m_ycliphi = m_spotcy + p_dimy; m_ycliphi = m_padToTestPos.y + padHalfsize.y;
if( !checkLine( x0, y0, xf, yf ) ) if( !checkLine( x0, y0, xf, yf ) )
{ {
@ -1559,10 +1549,10 @@ bool DRC::checkClearanceSegmToPad( const D_PAD* pad_to_test, int w_segm, int aMi
} }
/* Test du rectangle dimx , dimy + seuil */ /* Test du rectangle dimx , dimy + seuil */
m_xcliplo = m_spotcx - p_dimx; m_xcliplo = m_padToTestPos.x - padHalfsize.x;
m_ycliplo = m_spotcy - p_dimy - seuil; m_ycliplo = m_padToTestPos.y - padHalfsize.y - seuil;
m_xcliphi = m_spotcx + p_dimx; m_xcliphi = m_padToTestPos.x + padHalfsize.x;
m_ycliphi = m_spotcy + p_dimy + seuil; m_ycliphi = m_padToTestPos.y + padHalfsize.y + seuil;
if( !checkLine( x0, y0, xf, yf ) ) if( !checkLine( x0, y0, xf, yf ) )
{ {
@ -1571,9 +1561,9 @@ bool DRC::checkClearanceSegmToPad( const D_PAD* pad_to_test, int w_segm, int aMi
/* test des 4 cercles ( surface d'solation autour des sommets */ /* test des 4 cercles ( surface d'solation autour des sommets */
/* test du coin sup. gauche du pad */ /* test du coin sup. gauche du pad */
x0 = m_spotcx - p_dimx; x0 = m_padToTestPos.x - padHalfsize.x;
y0 = m_spotcy - p_dimy; y0 = m_padToTestPos.y - padHalfsize.y;
RotatePoint( &x0, &y0, m_spotcx, m_spotcy, orient ); RotatePoint( &x0, &y0, m_padToTestPos.x, m_padToTestPos.y, orient );
RotatePoint( &x0, &y0, m_segmAngle ); RotatePoint( &x0, &y0, m_segmAngle );
if( !checkMarginToCircle( x0, y0, seuil, m_segmLength ) ) if( !checkMarginToCircle( x0, y0, seuil, m_segmLength ) )
{ {
@ -1581,9 +1571,9 @@ bool DRC::checkClearanceSegmToPad( const D_PAD* pad_to_test, int w_segm, int aMi
} }
/* test du coin sup. droit du pad */ /* test du coin sup. droit du pad */
x0 = m_spotcx + p_dimx; x0 = m_padToTestPos.x + padHalfsize.x;
y0 = m_spotcy - p_dimy; y0 = m_padToTestPos.y - padHalfsize.y;
RotatePoint( &x0, &y0, m_spotcx, m_spotcy, orient ); RotatePoint( &x0, &y0, m_padToTestPos.x, m_padToTestPos.y, orient );
RotatePoint( &x0, &y0, m_segmAngle ); RotatePoint( &x0, &y0, m_segmAngle );
if( !checkMarginToCircle( x0, y0, seuil, m_segmLength ) ) if( !checkMarginToCircle( x0, y0, seuil, m_segmLength ) )
{ {
@ -1591,9 +1581,9 @@ bool DRC::checkClearanceSegmToPad( const D_PAD* pad_to_test, int w_segm, int aMi
} }
/* test du coin inf. gauche du pad */ /* test du coin inf. gauche du pad */
x0 = m_spotcx - p_dimx; x0 = m_padToTestPos.x - padHalfsize.x;
y0 = m_spotcy + p_dimy; y0 = m_padToTestPos.y + padHalfsize.y;
RotatePoint( &x0, &y0, m_spotcx, m_spotcy, orient ); RotatePoint( &x0, &y0, m_padToTestPos.x, m_padToTestPos.y, orient );
RotatePoint( &x0, &y0, m_segmAngle ); RotatePoint( &x0, &y0, m_segmAngle );
if( !checkMarginToCircle( x0, y0, seuil, m_segmLength ) ) if( !checkMarginToCircle( x0, y0, seuil, m_segmLength ) )
{ {
@ -1601,9 +1591,9 @@ bool DRC::checkClearanceSegmToPad( const D_PAD* pad_to_test, int w_segm, int aMi
} }
/* test du coin inf. droit du pad */ /* test du coin inf. droit du pad */
x0 = m_spotcx + p_dimx; x0 = m_padToTestPos.x + padHalfsize.x;
y0 = m_spotcy + p_dimy; y0 = m_padToTestPos.y + padHalfsize.y;
RotatePoint( &x0, &y0, m_spotcx, m_spotcy, orient ); RotatePoint( &x0, &y0, m_padToTestPos.x, m_padToTestPos.y, orient );
RotatePoint( &x0, &y0, m_segmAngle ); RotatePoint( &x0, &y0, m_segmAngle );
if( !checkMarginToCircle( x0, y0, seuil, m_segmLength ) ) if( !checkMarginToCircle( x0, y0, seuil, m_segmLength ) )
{ {

View File

@ -27,7 +27,7 @@
#include "fctsys.h" #include "fctsys.h"
#include "class_marker_base.h" #include "class_marker_pcb.h"
#define OK_DRC 0 #define OK_DRC 0
@ -67,9 +67,9 @@
#define DRCE_NETCLASS_TRACKWIDTH 30 ///< netclass has TrackWidth < board.m_designSettings->m_TrackMinWidth #define DRCE_NETCLASS_TRACKWIDTH 30 ///< netclass has TrackWidth < board.m_designSettings->m_TrackMinWidth
#define DRCE_NETCLASS_CLEARANCE 31 ///< netclass has Clearance < board.m_designSettings->m_TrackClearance #define DRCE_NETCLASS_CLEARANCE 31 ///< netclass has Clearance < board.m_designSettings->m_TrackClearance
#define DRCE_NETCLASS_VIASIZE 32 ///< netclass has ViaSize < board.m_designSettings->m_ViasMinSize #define DRCE_NETCLASS_VIASIZE 32 ///< netclass has ViaSize < board.m_designSettings->m_ViasMinSize
#define DRCE_NETCLASS_VIADRILLSIZE 33 ///< netclass has ViaDrillSize < board.m_designSettings->m_ViaDrill #define DRCE_NETCLASS_VIADRILLSIZE 33 ///< netclass has ViaDrillSize < board.m_designSettings->m_ViasMinDrill
#define DRCE_NETCLASS_uVIASIZE 34 #define DRCE_NETCLASS_uVIASIZE 34 ///< netclass has ViaSize < board.m_designSettings->m_MicroViasMinSize
#define DRCE_NETCLASS_uVIADRILLSIZE 35 #define DRCE_NETCLASS_uVIADRILLSIZE 35 ///< netclass has ViaSize < board.m_designSettings->m_MicroViasMinDrill
class WinEDA_DrawPanel; class WinEDA_DrawPanel;
@ -154,18 +154,29 @@ private:
bool m_aboartDRC; bool m_aboartDRC;
bool m_drcInProgress; bool m_drcInProgress;
int m_spotcx;
int m_spotcy;
int m_finx;
int m_finy; // coord relatives de l'extremite du segm de reference
int m_segmAngle; // angle d'inclinaison du segment de reference en 0,1 degre /* In DRC functions, many calculations are using coordinates relative
* to the position of the segment under test (segm to segm DRC, segm to pad DRC
* Next variables store coordinates relative to the start point of this segment
*/
wxPoint m_padToTestPos; // Position of the pad to compare in drc test segm to pad or pad to pad
wxPoint m_segmEnd; // End point of the reference segment (start point = (0,0) )
/* Some functions are comparing the ref segm to pads or others segments using
* coordinates relative to the ref segment considered as the X axis
* so we store the ref segment length (the end point relative to these axis)
* and the segment orientation (used to rotate other coordinates)
*/
int m_segmAngle; // Ref segm orientation in 0,1 degre
int m_segmLength; // length of the reference segment int m_segmLength; // length of the reference segment
/* variables used in checkLine to test DRC segm to segm:
* define the area relative to the ref segment that does not contains anu other segment
*/
int m_xcliplo; int m_xcliplo;
int m_ycliplo; int m_ycliplo;
int m_xcliphi; int m_xcliphi;
int m_ycliphi; // coord de la surface de securite du segment a comparer int m_ycliphi;
WinEDA_PcbFrame* m_mainWindow; WinEDA_PcbFrame* m_mainWindow;
WinEDA_DrawPanel* m_drawPanel; WinEDA_DrawPanel* m_drawPanel;
@ -215,7 +226,10 @@ private:
* @param fillMe A MARKER_PCB* which is to be filled in, or NULL if one is to * @param fillMe A MARKER_PCB* which is to be filled in, or NULL if one is to
* first be allocated, then filled. * first be allocated, then filled.
*/ */
MARKER_PCB* fillMarker( const ZONE_CONTAINER * aArea, const wxPoint & aPos, int aErrorCode, MARKER_PCB* fillMe ); MARKER_PCB* fillMarker( const ZONE_CONTAINER* aArea,
const wxPoint& aPos,
int aErrorCode,
MARKER_PCB* fillMe );
/** /**
* Function fillMarker * Function fillMarker
@ -385,6 +399,7 @@ public:
return doTrackDrc( aRefSeg, aList ) ? OK_DRC : BAD_DRC; return doTrackDrc( aRefSeg, aList ) ? OK_DRC : BAD_DRC;
} }
/** /**
* Function ShowDialog * Function ShowDialog
* opens a dialog and prompts the user, then if a test run button is * opens a dialog and prompts the user, then if a test run button is
@ -421,6 +436,7 @@ public:
m_doCreateRptFile = aSaveReport; m_doCreateRptFile = aSaveReport;
} }
/** /**
* Function RunTests * Function RunTests
* will actually run all the tests specified with a previous call to * will actually run all the tests specified with a previous call to

View File

@ -11,6 +11,7 @@
#include "pcbnew.h" #include "pcbnew.h"
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "drc_stuff.h"
#include "protos.h" #include "protos.h"

View File

@ -10,6 +10,7 @@
#include "pcbnew.h" #include "pcbnew.h"
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "drc_stuff.h"
#include "protos.h" #include "protos.h"

View File

@ -11,6 +11,7 @@
#include "pcbnew.h" #include "pcbnew.h"
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
#include "trigo.h" #include "trigo.h"
#include "drc_stuff.h"
#include "drag.h" #include "drag.h"
#include "pcbnew_id.h" #include "pcbnew_id.h"

View File

@ -15,6 +15,7 @@
#include "pcbnew_id.h" #include "pcbnew_id.h"
#include "protos.h" #include "protos.h"
#include "zones_functions_for_undo_redo.h" #include "zones_functions_for_undo_redo.h"
#include "drc_stuff.h"
bool s_Verbose = false; // false if zone outline diags must not be shown bool s_Verbose = false; // false if zone outline diags must not be shown

View File

@ -11,11 +11,11 @@
#include "common.h" #include "common.h"
#include "confirm.h" #include "confirm.h"
#include "pcbnew.h" #include "pcbnew.h"
#include "drc_stuff.h"
bool bDontShowSelfIntersectionArcsWarning; static bool bDontShowSelfIntersectionArcsWarning;
bool bDontShowSelfIntersectionWarning; static bool bDontShowSelfIntersectionWarning;
bool bDontShowIntersectionArcsWarning; static bool bDontShowIntersectionArcsWarning;
bool bDontShowIntersectionWarning;
/** Function AddArea /** Function AddArea