Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
5b832a66
Commit
5b832a66
authored
Sep 18, 2010
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Plain Diff
drc: more code cleaning. Added comments and fixed some erroneous comments. Fixed bug 638839.
fixed bug 641982 (I hope)
parents
577a79bc
ed54bdfc
Changes
12
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
332 additions
and
263 deletions
+332
-263
CMakeLists.txt
kicad/minizip/CMakeLists.txt
+1
-1
CMakeLists.txt
pcbnew/CMakeLists.txt
+1
-0
class_module.cpp
pcbnew/class_module.cpp
+1
-1
class_pad.cpp
pcbnew/class_pad.cpp
+19
-11
class_pad.h
pcbnew/class_pad.h
+2
-2
dialog_pad_properties.cpp
pcbnew/dialog_pad_properties.cpp
+1
-1
drc.cpp
pcbnew/drc.cpp
+117
-223
drc_marker_functions.cpp
pcbnew/drc_marker_functions.cpp
+172
-0
drc_stuff.h
pcbnew/drc_stuff.h
+11
-12
globaleditpad.cpp
pcbnew/globaleditpad.cpp
+3
-8
move-drag_pads.cpp
pcbnew/move-drag_pads.cpp
+3
-3
muonde.cpp
pcbnew/muonde.cpp
+1
-1
No files found.
kicad/minizip/CMakeLists.txt
View file @
5b832a66
...
...
@@ -10,7 +10,7 @@ else(ZLIB_FOUND)
# and we try to use it
# 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.
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"
)
endif
(
ZLIB_FOUND
)
...
...
pcbnew/CMakeLists.txt
View file @
5b832a66
...
...
@@ -96,6 +96,7 @@ set(PCBNEW_SRCS
dist.cpp
dragsegm.cpp
drc.cpp
drc_marker_functions.cpp
edgemod.cpp
edit.cpp
editedge.cpp
...
...
pcbnew/class_module.cpp
View file @
5b832a66
...
...
@@ -697,7 +697,7 @@ void MODULE::Set_Rectangle_Encadrement()
*/
for
(
D_PAD
*
pad
=
m_Pads
;
pad
;
pad
=
pad
->
Next
()
)
{
rayon
=
pad
->
m_
Rayon
;
rayon
=
pad
->
m_
ShapeMaxRadius
;
cx
=
pad
->
m_Pos0
.
x
;
cy
=
pad
->
m_Pos0
.
y
;
xmin
=
MIN
(
xmin
,
cx
-
rayon
);
...
...
pcbnew/class_pad.cpp
View file @
5b832a66
...
...
@@ -44,7 +44,7 @@ D_PAD::D_PAD( MODULE* parent ) : BOARD_CONNECTED_ITEM( parent, TYPE_PAD )
SetSubRatsnest
(
0
);
// used in ratsnest
// calculations
Compute
Rayon
();
Compute
ShapeMaxRadius
();
}
...
...
@@ -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
::
Compute
Rayon
()
void
D_PAD
::
Compute
ShapeMaxRadius
()
{
switch
(
m_PadShape
&
0x7F
)
{
case
PAD_CIRCLE
:
m_
Rayon
=
m_Size
.
x
/
2
;
m_
ShapeMaxRadius
=
m_Size
.
x
/
2
;
break
;
case
PAD_OVAL
:
m_
Rayon
=
MAX
(
m_Size
.
x
,
m_Size
.
y
)
/
2
;
m_
ShapeMaxRadius
=
MAX
(
m_Size
.
x
,
m_Size
.
y
)
/
2
;
break
;
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
:
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
);
}
break
;
}
}
...
...
@@ -84,11 +92,11 @@ void D_PAD::ComputeRayon()
EDA_Rect
D_PAD
::
GetBoundingBox
()
{
// Calculate area:
Compute
Rayon
();
// calculate the radius of the area, considered as a
Compute
ShapeMaxRadius
();
// calculate the radius of the area, considered as a
// circle
EDA_Rect
area
;
area
.
SetOrigin
(
m_Pos
);
area
.
Inflate
(
m_
Rayon
,
m_Rayon
);
area
.
Inflate
(
m_
ShapeMaxRadius
,
m_ShapeMaxRadius
);
return
area
;
}
...
...
@@ -185,7 +193,7 @@ void D_PAD::Copy( D_PAD* source )
m_Size
=
source
->
m_Size
;
m_DeltaSize
=
source
->
m_DeltaSize
;
m_Pos0
=
source
->
m_Pos0
;
m_
Rayon
=
source
->
m_Rayon
;
m_
ShapeMaxRadius
=
source
->
m_ShapeMaxRadius
;
m_PadShape
=
source
->
m_PadShape
;
m_Attribut
=
source
->
m_Attribut
;
m_Orient
=
source
->
m_Orient
;
...
...
@@ -401,7 +409,7 @@ int D_PAD::ReadDescr( FILE* File, int* LineNum )
m_PadShape
=
PAD_TRAPEZOID
;
break
;
}
Compute
Rayon
();
Compute
ShapeMaxRadius
();
break
;
case
'D'
:
...
...
@@ -766,7 +774,7 @@ bool D_PAD::HitTest( const wxPoint& ref_pos )
deltaY
=
ref_pos
.
y
-
shape_pos
.
y
;
/* 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
;
dx
=
m_Size
.
x
>>
1
;
// dx also is the radius for rounded pads
...
...
pcbnew/class_pad.h
View file @
5b832a66
...
...
@@ -95,7 +95,7 @@ public:
wxPoint
m_Pos0
;
// Initial Pad position (i.e. pas position relative to the module anchor, orientation 0
int
m_
Rayon
;
// radius of pad circl
e
int
m_
ShapeMaxRadius
;
// radius of the circle containing the pad shap
e
int
m_Attribut
;
// NORMAL, PAD_SMD, PAD_CONN
int
m_Orient
;
// in 1/10 degrees
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
wxString
ReturnStringPadName
();
// Return pad name as string in a wxString
void
ReturnStringPadName
(
wxString
&
text
);
// Return pad name as string in a buffer
void
Compute
Rayon
();
// compute radius
void
Compute
ShapeMaxRadius
();
// compute radius
const
wxPoint
ReturnShapePos
();
...
...
pcbnew/dialog_pad_properties.cpp
View file @
5b832a66
...
...
@@ -647,7 +647,7 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event )
m_CurrentPad
->
m_LocalSolderPasteMargin
=
g_Pad_Master
.
m_LocalSolderPasteMargin
;
m_CurrentPad
->
m_LocalSolderPasteMarginRatio
=
g_Pad_Master
.
m_LocalSolderPasteMarginRatio
;
m_CurrentPad
->
Compute
Rayon
();
m_CurrentPad
->
Compute
ShapeMaxRadius
();
Module
->
Set_Rectangle_Encadrement
();
m_CurrentPad
->
DisplayInfo
(
m_Parent
);
...
...
pcbnew/drc.cpp
View file @
5b832a66
This diff is collapsed.
Click to expand it.
pcbnew/drc_marker_functions.cpp
0 → 100644
View file @
5b832a66
/*
* drc_marker_functions.cpp
*/
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2010 Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2004-2010 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.fr
* Copyright (C) 2007 Kicad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/* Methods of class DRC to initialize drc markers with messages
* according to items and error ode
*/
#include "fctsys.h"
#include "common.h"
//#include "class_drawpanel.h"
#include "pcbnew.h"
//#include "wxPcbStruct.h"
#include "class_board_design_settings.h"
#include "drc_stuff.h"
MARKER_PCB
*
DRC
::
fillMarker
(
TRACK
*
aTrack
,
BOARD_ITEM
*
aItem
,
int
aErrorCode
,
MARKER_PCB
*
fillMe
)
{
wxString
textA
=
aTrack
->
MenuText
(
m_pcb
);
wxString
textB
;
wxPoint
position
;
wxPoint
posB
;
if
(
aItem
)
// aItem might be NULL
{
textB
=
aItem
->
MenuText
(
m_pcb
);
posB
=
aItem
->
GetPosition
();
if
(
aItem
->
Type
()
==
TYPE_PAD
)
position
=
aItem
->
GetPosition
();
else
if
(
aItem
->
Type
()
==
TYPE_VIA
)
position
=
aItem
->
GetPosition
();
else
if
(
aItem
->
Type
()
==
TYPE_TRACK
)
{
TRACK
*
track
=
(
TRACK
*
)
aItem
;
wxPoint
endPos
=
track
->
m_End
;
// either of aItem's start or end will be used for the marker position
// first assume start, then switch at end if needed. decision made on
// distance from end of aTrack.
position
=
track
->
m_Start
;
double
dToEnd
=
hypot
(
endPos
.
x
-
aTrack
->
m_End
.
x
,
endPos
.
y
-
aTrack
->
m_End
.
y
);
double
dToStart
=
hypot
(
position
.
x
-
aTrack
->
m_End
.
x
,
position
.
y
-
aTrack
->
m_End
.
y
);
if
(
dToEnd
<
dToStart
)
position
=
endPos
;
}
}
else
position
=
aTrack
->
GetPosition
();
if
(
fillMe
)
{
if
(
aItem
)
fillMe
->
SetData
(
aErrorCode
,
position
,
textA
,
aTrack
->
GetPosition
(),
textB
,
posB
);
else
fillMe
->
SetData
(
aErrorCode
,
position
,
textA
,
aTrack
->
GetPosition
()
);
}
else
{
if
(
aItem
)
fillMe
=
new
MARKER_PCB
(
aErrorCode
,
position
,
textA
,
aTrack
->
GetPosition
(),
textB
,
posB
);
else
fillMe
=
new
MARKER_PCB
(
aErrorCode
,
position
,
textA
,
aTrack
->
GetPosition
()
);
}
return
fillMe
;
}
MARKER_PCB
*
DRC
::
fillMarker
(
D_PAD
*
aPad
,
D_PAD
*
bPad
,
int
aErrorCode
,
MARKER_PCB
*
fillMe
)
{
wxString
textA
=
aPad
->
MenuText
(
m_pcb
);
wxString
textB
=
bPad
->
MenuText
(
m_pcb
);
wxPoint
posA
=
aPad
->
GetPosition
();
wxPoint
posB
=
bPad
->
GetPosition
();
if
(
fillMe
)
fillMe
->
SetData
(
aErrorCode
,
posA
,
textA
,
posA
,
textB
,
posB
);
else
fillMe
=
new
MARKER_PCB
(
aErrorCode
,
posA
,
textA
,
posA
,
textB
,
posB
);
return
fillMe
;
}
MARKER_PCB
*
DRC
::
fillMarker
(
ZONE_CONTAINER
*
aArea
,
int
aErrorCode
,
MARKER_PCB
*
fillMe
)
{
wxString
textA
=
aArea
->
MenuText
(
m_pcb
);
wxPoint
posA
=
aArea
->
GetPosition
();
if
(
fillMe
)
fillMe
->
SetData
(
aErrorCode
,
posA
,
textA
,
posA
);
else
fillMe
=
new
MARKER_PCB
(
aErrorCode
,
posA
,
textA
,
posA
);
return
fillMe
;
}
MARKER_PCB
*
DRC
::
fillMarker
(
const
ZONE_CONTAINER
*
aArea
,
const
wxPoint
&
aPos
,
int
aErrorCode
,
MARKER_PCB
*
fillMe
)
{
wxString
textA
=
aArea
->
MenuText
(
m_pcb
);
wxPoint
posA
=
aPos
;
if
(
fillMe
)
fillMe
->
SetData
(
aErrorCode
,
posA
,
textA
,
posA
);
else
fillMe
=
new
MARKER_PCB
(
aErrorCode
,
posA
,
textA
,
posA
);
return
fillMe
;
}
MARKER_PCB
*
DRC
::
fillMarker
(
int
aErrorCode
,
const
wxString
&
aMessage
,
MARKER_PCB
*
fillMe
)
{
wxPoint
posA
;
// not displayed
if
(
fillMe
)
fillMe
->
SetData
(
aErrorCode
,
posA
,
aMessage
,
posA
);
else
fillMe
=
new
MARKER_PCB
(
aErrorCode
,
posA
,
aMessage
,
posA
);
fillMe
->
SetShowNoCoordinate
();
return
fillMe
;
}
pcbnew/drc_stuff.h
View file @
5b832a66
...
...
@@ -179,7 +179,6 @@ private:
int
m_ycliphi
;
WinEDA_PcbFrame
*
m_mainWindow
;
WinEDA_DrawPanel
*
m_drawPanel
;
BOARD
*
m_pcb
;
DIALOG_DRC_CONTROL
*
m_ui
;
...
...
@@ -306,7 +305,7 @@ private:
* Function checkClearancePadToPad
* @param aRefPad The reference pad to check
* @param aPad Another pad to check against
* @return bool - true if clearance between aRefPad and
p
ad is >= dist_min, else false
* @return bool - true if clearance between aRefPad and
aP
ad is >= dist_min, else false
*/
bool
checkClearancePadToPad
(
D_PAD
*
aRefPad
,
D_PAD
*
aPad
);
...
...
@@ -315,18 +314,18 @@ private:
* Function checkClearanceSegmToPad
* check the distance from a pad to segment. This function uses several
* instance variable not passed in:
* segmLength = length of the segment being tested
*
segmAngle = angle d'inclinaison du segment
;
*
finx, finy
= end coordinate of the segment
*
spot_cX, spot_cY = position of pad /
origin of segment
* @param
pad_to_test
Is the pad involved in the check
* @param
w_segm Hhalf
width of the segment to test
* @param
dist_min
Is the minimum clearance needed
*
m_
segmLength = length of the segment being tested
*
m_segmAngle = angle of the segment with the X axis
;
*
m_segmEnd
= end coordinate of the segment
*
m_padToTestPos = position of pad relative to the
origin of segment
* @param
aPad
Is the pad involved in the check
* @param
aSegmentWidth
width of the segment to test
* @param
aMinDist
Is the minimum clearance needed
*
* @return
fals
e distance >= dist_min,
*
tru
e if distance < dist_min
* @return
tru
e distance >= dist_min,
*
fals
e if distance < dist_min
*/
bool
checkClearanceSegmToPad
(
const
D_PAD
*
pad_to_test
,
int
w_segm
,
int
dist_min
);
bool
checkClearanceSegmToPad
(
const
D_PAD
*
aPad
,
int
aSegmentWidth
,
int
aMinDist
);
/**
...
...
pcbnew/globaleditpad.cpp
View file @
5b832a66
...
...
@@ -4,17 +4,10 @@
#include "fctsys.h"
//#include "gr_basic.h"
#include "common.h"
#include "class_drawpanel.h"
#include "confirm.h"
#include "pcbnew.h"
//#include "trigo.h"
//#include "drag.h"
//#include "protos.h"
#include "dialog_global_pads_edition_base.h"
...
...
@@ -104,6 +97,8 @@ void DIALOG_GLOBAL_PADS_EDITION::PadPropertiesAccept( wxCommandEvent& event )
EndModal
(
returncode
);
break
;
}
m_Parent
->
OnModify
();
}
...
...
@@ -272,7 +267,7 @@ void WinEDA_BasePcbFrame::Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw )
break
;
}
pt_pad
->
Compute
Rayon
();
pt_pad
->
Compute
ShapeMaxRadius
();
}
Module
->
Set_Rectangle_Encadrement
();
...
...
pcbnew/move-drag_pads.cpp
View file @
5b832a66
...
...
@@ -110,7 +110,7 @@ void WinEDA_BasePcbFrame::Export_Pad_Settings( D_PAD* pt_pad )
(
(
MODULE
*
)
pt_pad
->
GetParent
()
)
->
m_Orient
;
g_Pad_Master
.
m_Size
=
pt_pad
->
m_Size
;
g_Pad_Master
.
m_DeltaSize
=
pt_pad
->
m_DeltaSize
;
pt_pad
->
Compute
Rayon
();
pt_pad
->
Compute
ShapeMaxRadius
();
g_Pad_Master
.
m_Offset
=
pt_pad
->
m_Offset
;
g_Pad_Master
.
m_Drill
=
pt_pad
->
m_Drill
;
...
...
@@ -163,7 +163,7 @@ void WinEDA_BasePcbFrame::Import_Pad_Settings( D_PAD* aPad, bool aDraw )
aPad
->
m_Offset
.
y
=
0
;
}
aPad
->
Compute
Rayon
();
aPad
->
Compute
ShapeMaxRadius
();
if
(
aDraw
)
DrawPanel
->
PostDirtyRect
(
aPad
->
GetBoundingBox
()
);
...
...
pcbnew/muonde.cpp
View file @
5b832a66
...
...
@@ -265,7 +265,7 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
PtPad
->
m_Masque_Layer
=
g_TabOneLayerMask
[
Module
->
GetLayer
()];
PtPad
->
m_Attribut
=
PAD_SMD
;
PtPad
->
m_PadShape
=
PAD_CIRCLE
;
PtPad
->
m_Rayon
=
PtPad
->
m_Size
.
x
/
2
;
PtPad
->
ComputeShapeMaxRadius
()
;
D_PAD
*
newpad
=
new
D_PAD
(
Module
);
newpad
->
Copy
(
PtPad
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment