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
9d5e2713
Commit
9d5e2713
authored
Aug 04, 2012
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pcbnew: fix a minor issue in non copper zones when creating the solid filled areas.
parent
c82b8787
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
35 deletions
+50
-35
class_zone.h
pcbnew/class_zone.h
+15
-0
zone_filling_algorithm.cpp
pcbnew/zone_filling_algorithm.cpp
+22
-1
zones_convert_brd_items_to_polygons_with_Boost.cpp
pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp
+13
-34
No files found.
pcbnew/class_zone.h
View file @
9d5e2713
...
...
@@ -261,6 +261,21 @@ public:
*/
int
BuildFilledPolysListData
(
BOARD
*
aPcb
,
std
::
vector
<
CPolyPt
>*
aCornerBuffer
=
NULL
);
/**
* Function CopyPolygonsFromKiPolygonListToFilledPolysList
* Copy polygons stored in aKiPolyList to m_FilledPolysList
* The previous m_FilledPolysList contents is replaced.
* @param aKiPolyList = a KI_POLYGON_SET containing polygons.
*/
void
CopyPolygonsFromKiPolygonListToFilledPolysList
(
KI_POLYGON_SET
&
aKiPolyList
);
/**
* Function CopyPolygonsFromFilledPolysListToKiPolygonList
* Copy polygons from m_FilledPolysList to aKiPolyList
* @param aKiPolyList = a KI_POLYGON_SET to fill by polygons.
*/
void
CopyPolygonsFromFilledPolysListToKiPolygonList
(
KI_POLYGON_SET
&
aKiPolyList
);
/**
* Function AddClearanceAreasPolygonsToPolysList
* Add non copper areas polygons (pads and tracks with clearance)
...
...
pcbnew/zone_filling_algorithm.cpp
View file @
9d5e2713
...
...
@@ -95,14 +95,35 @@ int ZONE_CONTAINER::BuildFilledPolysListData( BOARD* aPcb, std::vector <CPolyPt>
else
ConvertPolysListWithHolesToOnePolygon
(
m_smoothedPoly
->
m_CornersList
,
m_FilledPolysList
);
/* For copper layers, we now must add holes in the Polygon list.
* holes are pads and tracks with their clearance area
* for non copper layers just recalculate the m_FilledPolysList
* with m_ZoneMinThickness taken in account
*/
if
(
!
aCornerBuffer
)
{
if
(
IsOnCopperLayer
()
)
AddClearanceAreasPolygonsToPolysList
(
aPcb
);
else
{
// This KI_POLYGON_SET is the area(s) to fill, with m_ZoneMinThickness/2
KI_POLYGON_SET
polyset_zone_solid_areas
;
int
margin
=
m_ZoneMinThickness
/
2
;
/* First, creates the main polygon (i.e. the filled area using only one outline)
* to reserve a m_ZoneMinThickness/2 margin around the outlines and holes
* this margin is the room to redraw outlines with segments having a width set to
* m_ZoneMinThickness
* so m_ZoneMinThickness is the min thickness of the filled zones areas
* the polygon is stored in polyset_zone_solid_areas
*/
CopyPolygonsFromFilledPolysListToKiPolygonList
(
polyset_zone_solid_areas
);
polyset_zone_solid_areas
-=
margin
;
// put solid area in m_FilledPolysList:
m_FilledPolysList
.
clear
();
CopyPolygonsFromKiPolygonListToFilledPolysList
(
polyset_zone_solid_areas
);
}
if
(
m_FillMode
)
// if fill mode uses segments, create them:
Fill_Zone_Areas_With_Segments
(
);
}
...
...
pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp
View file @
9d5e2713
...
...
@@ -79,18 +79,9 @@ extern void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
int
aCircleToSegmentsCount
,
double
aCorrectionFactor
,
int
aThermalRot
);
// Local Functions: helper function to calculate solid areas
static
void
AddPolygonCornersToKiPolygonList
(
std
::
vector
<
CPolyPt
>&
aCornersBuffer
,
KI_POLYGON_SET
&
aKiPolyList
);
static
int
CopyPolygonsFromKiPolygonListToFilledPolysList
(
ZONE_CONTAINER
*
aZone
,
KI_POLYGON_SET
&
aKiPolyList
);
static
int
CopyPolygonsFromFilledPolysListToKiPolygonList
(
ZONE_CONTAINER
*
aZone
,
KI_POLYGON_SET
&
aKiPolyList
);
// Local Variables:
static
int
s_thermalRot
=
450
;
// angle of stubs in thermal reliefs for round pads
...
...
@@ -160,7 +151,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
* the main polygon is stored in polyset_zone_solid_areas
*/
CopyPolygonsFromFilledPolysListToKiPolygonList
(
this
,
polyset_zone_solid_areas
);
CopyPolygonsFromFilledPolysListToKiPolygonList
(
polyset_zone_solid_areas
);
polyset_zone_solid_areas
-=
margin
;
if
(
polyset_zone_solid_areas
.
size
()
==
0
)
...
...
@@ -439,7 +430,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
// put solid areas in m_FilledPolysList:
m_FilledPolysList
.
clear
();
CopyPolygonsFromKiPolygonListToFilledPolysList
(
this
,
polyset_zone_solid_areas
);
CopyPolygonsFromKiPolygonListToFilledPolysList
(
polyset_zone_solid_areas
);
// Remove insulated islands:
if
(
GetNet
()
>
0
)
...
...
@@ -461,7 +452,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
// put these areas in m_FilledPolysList
m_FilledPolysList
.
clear
();
CopyPolygonsFromKiPolygonListToFilledPolysList
(
this
,
polyset_zone_solid_areas
);
CopyPolygonsFromKiPolygonListToFilledPolysList
(
polyset_zone_solid_areas
);
if
(
GetNet
()
>
0
)
Test_For_Copper_Island_And_Remove_Insulated_Islands
(
aPcb
);
...
...
@@ -507,11 +498,9 @@ void AddPolygonCornersToKiPolygonList( std::vector <CPolyPt>& aCornersBuffer,
}
int
CopyPolygonsFromKiPolygonListToFilledPolysList
(
ZONE_CONTAINER
*
aZone
,
KI_POLYGON_SET
&
aKiPolyList
)
void
ZONE_CONTAINER
::
CopyPolygonsFromKiPolygonListToFilledPolysList
(
KI_POLYGON_SET
&
aKiPolyList
)
{
int
count
=
0
;
std
::
vector
<
CPolyPt
>
polysList
;
m_FilledPolysList
.
clear
();
for
(
unsigned
ii
=
0
;
ii
<
aKiPolyList
.
size
();
ii
++
)
{
...
...
@@ -524,33 +513,26 @@ int CopyPolygonsFromKiPolygonListToFilledPolysList( ZONE_CONTAINER* aZone,
corner
.
x
=
point
.
x
();
corner
.
y
=
point
.
y
();
corner
.
end_contour
=
false
;
polysList
.
push_back
(
corner
);
count
++
;
m_FilledPolysList
.
push_back
(
corner
);
}
corner
.
end_contour
=
true
;
p
olysList
.
pop_back
();
p
olysList
.
push_back
(
corner
);
m_FilledP
olysList
.
pop_back
();
m_FilledP
olysList
.
push_back
(
corner
);
}
aZone
->
AddFilledPolysList
(
polysList
);
return
count
;
}
int
CopyPolygonsFromFilledPolysListToKiPolygonList
(
ZONE_CONTAINER
*
aZone
,
KI_POLYGON_SET
&
aKiPolyList
)
void
ZONE_CONTAINER
::
CopyPolygonsFromFilledPolysListToKiPolygonList
(
KI_POLYGON_SET
&
aKiPolyList
)
{
const
std
::
vector
<
CPolyPt
>&
polysList
=
aZone
->
GetFilledPolysList
();
unsigned
corners_count
=
polysList
.
size
();
int
count
=
0
;
unsigned
corners_count
=
m_FilledPolysList
.
size
();
unsigned
ic
=
0
;
int
polycount
=
0
;
for
(
unsigned
ii
=
0
;
ii
<
corners_count
;
ii
++
)
{
const
CPolyPt
&
corner
=
p
olysList
[
ii
];
const
CPolyPt
&
corner
=
m_FilledP
olysList
[
ii
];
if
(
corner
.
end_contour
)
polycount
++
;
...
...
@@ -566,9 +548,8 @@ int CopyPolygonsFromFilledPolysListToKiPolygonList( ZONE_CONTAINER* aZone,
{
while
(
ic
<
corners_count
)
{
const
CPolyPt
&
corner
=
p
olysList
[
ic
++
];
const
CPolyPt
&
corner
=
m_FilledP
olysList
[
ic
++
];
cornerslist
.
push_back
(
KI_POLY_POINT
(
corner
.
x
,
corner
.
y
)
);
count
++
;
if
(
corner
.
end_contour
)
break
;
...
...
@@ -578,6 +559,4 @@ int CopyPolygonsFromFilledPolysListToKiPolygonList( ZONE_CONTAINER* aZone,
aKiPolyList
.
push_back
(
poly
);
}
}
return
count
;
}
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