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
365dbe15
Commit
365dbe15
authored
Oct 31, 2008
by
charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enhancement in zones filling by polygon, and better display for small texts
(more noticeable in eeschema)
parent
07767585
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
10 deletions
+30
-10
gr_basic.cpp
common/gr_basic.cpp
+6
-4
zones_convert_brd_items_to_polygons.cpp
pcbnew/zones_convert_brd_items_to_polygons.cpp
+24
-6
No files found.
common/gr_basic.cpp
View file @
365dbe15
...
@@ -869,8 +869,6 @@ static bool IsGRSPolyDrawable( EDA_Rect* ClipBox, int n, int* Points )
...
@@ -869,8 +869,6 @@ static bool IsGRSPolyDrawable( EDA_Rect* ClipBox, int n, int* Points )
void
GRSPoly
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
int
n
,
int
*
Points
,
int
Fill
,
void
GRSPoly
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
int
n
,
int
*
Points
,
int
Fill
,
int
width
,
int
Color
,
int
BgColor
)
int
width
,
int
Color
,
int
BgColor
)
{
{
int
startx
,
starty
;
if
(
!
IsGRSPolyDrawable
(
ClipBox
,
n
,
Points
)
)
if
(
!
IsGRSPolyDrawable
(
ClipBox
,
n
,
Points
)
)
return
;
return
;
...
@@ -883,11 +881,15 @@ void GRSPoly( EDA_Rect* ClipBox, wxDC* DC, int n, int* Points, int Fill,
...
@@ -883,11 +881,15 @@ void GRSPoly( EDA_Rect* ClipBox, wxDC* DC, int n, int* Points, int Fill,
}
}
else
else
{
{
start
x
=
Points
[
n
*
2
-
2
];
int
end
x
=
Points
[
n
*
2
-
2
];
start
y
=
Points
[
n
*
2
-
1
];
int
end
y
=
Points
[
n
*
2
-
1
];
GRSetBrush
(
DC
,
Color
);
GRSetBrush
(
DC
,
Color
);
DC
->
DrawLines
(
n
,
(
wxPoint
*
)
Points
);
DC
->
DrawLines
(
n
,
(
wxPoint
*
)
Points
);
// The last point is not drawn by DrawLine and DrawLines
// Add it if the polygon is not closed
if
(
endx
!=
Points
[
0
]
||
endy
!=
Points
[
1
]
)
DC
->
DrawPoint
(
endx
,
endy
);
}
}
}
}
...
...
pcbnew/zones_convert_brd_items_to_polygons.cpp
View file @
365dbe15
...
@@ -36,7 +36,10 @@ void AddTextBoxWithClearancePolygon( Bool_Engine* aBooleng,
...
@@ -36,7 +36,10 @@ void AddTextBoxWithClearancePolygon( Bool_Engine* aBooleng,
static
int
s_CircleToSegmentsCount
=
16
;
/* default value. the real value will be changed to 32
static
int
s_CircleToSegmentsCount
=
16
;
/* default value. the real value will be changed to 32
* if g_Zone_Arc_Approximation == 1
* if g_Zone_Arc_Approximation == 1
*/
*/
double
s_Correction
;
/* mult coeff used to enlarge rouded and oval pads
* because the segment approximation for arcs and circles
* create a smaler gap than a trur circle
*/
/** function AddClearanceAreasPolygonsToPolysList
/** function AddClearanceAreasPolygonsToPolysList
* Add non copper areas polygons (pads and tracks with clearence)
* Add non copper areas polygons (pads and tracks with clearence)
* to a filled copper area
* to a filled copper area
...
@@ -60,6 +63,13 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
...
@@ -60,6 +63,13 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
else
else
s_CircleToSegmentsCount
=
16
;
s_CircleToSegmentsCount
=
16
;
/* calculates the coeff to compensate radius reduction of holes clearance
* due to the segment approx.
* For a circle the min radius is radius * cos( 2PI / s_CircleToSegmentsCount / 2)
* s_Correction is 1 /cos( PI/s_CircleToSegmentsCount )
*/
s_Correction
=
1.0
/
cos
(
3.14159265
/
s_CircleToSegmentsCount
);
/* Uses a kbool engine to add holes in the m_FilledPolysList polygon.
/* Uses a kbool engine to add holes in the m_FilledPolysList polygon.
* Because this function is called just after creating the m_FilledPolysList,
* Because this function is called just after creating the m_FilledPolysList,
* only one polygon is in list.
* only one polygon is in list.
...
@@ -89,13 +99,16 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
...
@@ -89,13 +99,16 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
booleng
->
EndPolygonAdd
();
booleng
->
EndPolygonAdd
();
}
}
// Calculates the clearance value that meet DRC requirements
int
clearance
=
max
(
m_ZoneClearance
,
g_DesignSettings
.
m_TrackClearence
);
/* Add holes (i.e. tracks and pads areas as polygons outlines)
/* Add holes (i.e. tracks and pads areas as polygons outlines)
* in GroupB in Bool_Engine
* in GroupB in Bool_Engine
*/
*/
/* items ouside the zone bounding box are skipped */
/* items ouside the zone bounding box are skipped */
EDA_Rect
item_boundingbox
;
EDA_Rect
item_boundingbox
;
EDA_Rect
zone_boundingbox
=
GetBoundingBox
();
EDA_Rect
zone_boundingbox
=
GetBoundingBox
();
zone_boundingbox
.
Inflate
(
m_ZoneClearance
,
m_ZoneC
learance
);
zone_boundingbox
.
Inflate
(
m_ZoneClearance
,
c
learance
);
/*
/*
* First : Add pads
* First : Add pads
*/
*/
...
@@ -110,7 +123,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
...
@@ -110,7 +123,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
{
{
item_boundingbox
=
pad
->
GetBoundingBox
();
item_boundingbox
=
pad
->
GetBoundingBox
();
if
(
item_boundingbox
.
Intersects
(
zone_boundingbox
)
)
if
(
item_boundingbox
.
Intersects
(
zone_boundingbox
)
)
AddPadWithClearancePolygon
(
booleng
,
*
pad
,
m_ZoneC
learance
);
AddPadWithClearancePolygon
(
booleng
,
*
pad
,
c
learance
);
continue
;
continue
;
}
}
...
@@ -119,7 +132,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
...
@@ -119,7 +132,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
case
PAD_NOT_IN_ZONE
:
case
PAD_NOT_IN_ZONE
:
item_boundingbox
=
pad
->
GetBoundingBox
();
item_boundingbox
=
pad
->
GetBoundingBox
();
if
(
item_boundingbox
.
Intersects
(
zone_boundingbox
)
)
if
(
item_boundingbox
.
Intersects
(
zone_boundingbox
)
)
AddPadWithClearancePolygon
(
booleng
,
*
pad
,
m_ZoneC
learance
);
AddPadWithClearancePolygon
(
booleng
,
*
pad
,
c
learance
);
break
;
break
;
case
THERMAL_PAD
:
case
THERMAL_PAD
:
...
@@ -148,10 +161,11 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
...
@@ -148,10 +161,11 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
continue
;
continue
;
item_boundingbox
=
track
->
GetBoundingBox
();
item_boundingbox
=
track
->
GetBoundingBox
();
if
(
item_boundingbox
.
Intersects
(
zone_boundingbox
)
)
if
(
item_boundingbox
.
Intersects
(
zone_boundingbox
)
)
AddTrackWithClearancePolygon
(
booleng
,
*
track
,
m_ZoneC
learance
);
AddTrackWithClearancePolygon
(
booleng
,
*
track
,
c
learance
);
}
}
// Draw graphic items (copper texts) and board edges
// Draw graphic items (copper texts) and board edges
// zone clearance is used here regardless of the g_DesignSettings.m_TrackClearence value
for
(
BOARD_ITEM
*
item
=
aPcb
->
m_Drawings
;
item
;
item
=
item
->
Next
()
)
for
(
BOARD_ITEM
*
item
=
aPcb
->
m_Drawings
;
item
;
item
=
item
->
Next
()
)
{
{
if
(
item
->
GetLayer
()
!=
GetLayer
()
&&
item
->
GetLayer
()
!=
EDGE_N
)
if
(
item
->
GetLayer
()
!=
GetLayer
()
&&
item
->
GetLayer
()
!=
EDGE_N
)
...
@@ -228,6 +242,7 @@ void AddPadWithClearancePolygon( Bool_Engine* aBooleng,
...
@@ -228,6 +242,7 @@ void AddPadWithClearancePolygon( Bool_Engine* aBooleng,
switch
(
aPad
.
m_PadShape
)
switch
(
aPad
.
m_PadShape
)
{
{
case
PAD_CIRCLE
:
case
PAD_CIRCLE
:
dx
=
(
int
)
(
dx
*
s_Correction
);
for
(
ii
=
0
;
ii
<
s_CircleToSegmentsCount
;
ii
++
)
for
(
ii
=
0
;
ii
<
s_CircleToSegmentsCount
;
ii
++
)
{
{
corner_position
=
wxPoint
(
dx
,
0
);
corner_position
=
wxPoint
(
dx
,
0
);
...
@@ -243,6 +258,7 @@ void AddPadWithClearancePolygon( Bool_Engine* aBooleng,
...
@@ -243,6 +258,7 @@ void AddPadWithClearancePolygon( Bool_Engine* aBooleng,
angle
=
aPad
.
m_Orient
;
angle
=
aPad
.
m_Orient
;
if
(
dy
>
dx
)
// Oval pad X/Y ratio for choosing translation axles
if
(
dy
>
dx
)
// Oval pad X/Y ratio for choosing translation axles
{
{
dy
=
(
int
)
(
dy
*
s_Correction
);
int
angle_pg
;
// Polygon angle
int
angle_pg
;
// Polygon angle
wxPoint
shape_offset
=
wxPoint
(
0
,
(
dy
-
dx
)
);
wxPoint
shape_offset
=
wxPoint
(
0
,
(
dy
-
dx
)
);
RotatePoint
(
&
shape_offset
,
angle
);
// Rotating shape offset vector with component
RotatePoint
(
&
shape_offset
,
angle
);
// Rotating shape offset vector with component
...
@@ -269,8 +285,9 @@ void AddPadWithClearancePolygon( Bool_Engine* aBooleng,
...
@@ -269,8 +285,9 @@ void AddPadWithClearancePolygon( Bool_Engine* aBooleng,
break
;
break
;
}
}
else
else
//if( dy <= dx )
{
{
dx
=
(
int
)
(
dx
*
s_Correction
);
int
angle_pg
;
// Polygon angle
int
angle_pg
;
// Polygon angle
wxPoint
shape_offset
=
wxPoint
(
(
dy
-
dx
),
0
);
wxPoint
shape_offset
=
wxPoint
(
(
dy
-
dx
),
0
);
RotatePoint
(
&
shape_offset
,
angle
);
RotatePoint
(
&
shape_offset
,
angle
);
...
@@ -663,6 +680,7 @@ void AddTrackWithClearancePolygon( Bool_Engine* aBooleng,
...
@@ -663,6 +680,7 @@ void AddTrackWithClearancePolygon( Bool_Engine* aBooleng,
case
TYPEVIA
:
case
TYPEVIA
:
if
(
aBooleng
->
StartPolygonAdd
(
GROUP_B
)
)
if
(
aBooleng
->
StartPolygonAdd
(
GROUP_B
)
)
{
{
dx
=
(
int
)
(
dx
*
s_Correction
);
for
(
ii
=
0
;
ii
<
s_CircleToSegmentsCount
;
ii
++
)
for
(
ii
=
0
;
ii
<
s_CircleToSegmentsCount
;
ii
++
)
{
{
corner_position
=
wxPoint
(
dx
,
0
);
corner_position
=
wxPoint
(
dx
,
0
);
...
...
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