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
25545756
Commit
25545756
authored
May 09, 2013
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More work on CPOLYGONS_LIST class.
Pcbnew: fix minor bug about plot line width.
parent
cf86e18f
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
182 additions
and
155 deletions
+182
-155
3d_draw.cpp
3d-viewer/3d_draw.cpp
+6
-5
3d_draw_basic_functions.cpp
3d-viewer/3d_draw_basic_functions.cpp
+3
-3
convert_basic_shapes_to_polygon.cpp
common/convert_basic_shapes_to_polygon.cpp
+12
-12
board_items_to_polygon_shape_transform.cpp
pcbnew/board_items_to_polygon_shape_transform.cpp
+18
-18
class_zone.cpp
pcbnew/class_zone.cpp
+16
-15
class_zone.h
pcbnew/class_zone.h
+1
-1
kicad_plugin.cpp
pcbnew/kicad_plugin.cpp
+6
-6
legacy_plugin.cpp
pcbnew/legacy_plugin.cpp
+4
-4
onrightclick.cpp
pcbnew/onrightclick.cpp
+1
-1
pcb_parser.cpp
pcbnew/pcb_parser.cpp
+3
-3
pcb_plot_params.cpp
pcbnew/pcb_plot_params.cpp
+50
-30
pcb_plot_params.h
pcbnew/pcb_plot_params.h
+12
-3
plot_brditems_plotter.cpp
pcbnew/plot_brditems_plotter.cpp
+1
-1
specctra_export.cpp
pcbnew/specctra_export.cpp
+2
-2
zone_filling_algorithm.cpp
pcbnew/zone_filling_algorithm.cpp
+1
-1
zones_by_polygon.cpp
pcbnew/zones_by_polygon.cpp
+1
-1
zones_convert_brd_items_to_polygons_with_Boost.cpp
pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp
+2
-2
zones_convert_to_polygons_aux_functions.cpp
pcbnew/zones_convert_to_polygons_aux_functions.cpp
+5
-5
zones_polygons_insulated_copper_islands.cpp
pcbnew/zones_polygons_insulated_copper_islands.cpp
+2
-2
zones_polygons_test_connections.cpp
pcbnew/zones_polygons_test_connections.cpp
+4
-3
zones_test_and_combine_areas.cpp
pcbnew/zones_test_and_combine_areas.cpp
+4
-4
PolyLine.cpp
polygon/PolyLine.cpp
+23
-30
PolyLine.h
polygon/PolyLine.h
+5
-3
No files found.
3d-viewer/3d_draw.cpp
View file @
25545756
...
...
@@ -88,7 +88,8 @@ static void BuildPadShapeThickOutlineAsPolygon( D_PAD* aPad,
aCircleToSegmentsCount
,
aCorrectionFactor
);
// Add outlines as thick segments in polygon buffer
for
(
unsigned
ii
=
0
,
jj
=
corners
.
size
()
-
1
;
ii
<
corners
.
size
();
jj
=
ii
,
ii
++
)
for
(
unsigned
ii
=
0
,
jj
=
corners
.
GetCornersCount
()
-
1
;
ii
<
corners
.
GetCornersCount
();
jj
=
ii
,
ii
++
)
{
TransformRoundedEndsSegmentToPolygon
(
aCornerBuffer
,
corners
.
GetPos
(
jj
),
...
...
@@ -282,7 +283,7 @@ void EDA_3D_CANVAS::BuildBoard3DView()
}
// bufferPolys contains polygons to merge. Many overlaps . Calculate merged polygons
if
(
bufferPolys
.
size
()
==
0
)
if
(
bufferPolys
.
GetCornersCount
()
==
0
)
continue
;
KI_POLYGON_SET
currLayerPolyset
;
...
...
@@ -294,7 +295,7 @@ void EDA_3D_CANVAS::BuildBoard3DView()
// Add holes in polygon list
currLayerHoles
.
Append
(
allLayerHoles
);
if
(
currLayerHoles
.
size
()
>
0
)
if
(
currLayerHoles
.
GetCornersCount
()
>
0
)
currLayerHoles
.
ExportTo
(
polysetHoles
);
// Merge polygons, remove holes
...
...
@@ -313,7 +314,7 @@ void EDA_3D_CANVAS::BuildBoard3DView()
thickness
,
g_Parm_3D_Visu
.
m_BiuTo3Dunits
);
if
(
bufferZonesPolys
.
size
()
)
if
(
bufferZonesPolys
.
GetCornersCount
()
)
Draw3D_SolidHorizontalPolyPolygons
(
bufferZonesPolys
,
zpos
,
thickness
,
g_Parm_3D_Visu
.
m_BiuTo3Dunits
);
...
...
@@ -404,7 +405,7 @@ void EDA_3D_CANVAS::BuildBoard3DView()
// bufferPolys contains polygons to merge. Many overlaps .
// Calculate merged polygons and remove pads and vias holes
if
(
bufferPolys
.
size
()
==
0
)
if
(
bufferPolys
.
GetCornersCount
()
==
0
)
continue
;
KI_POLYGON_SET
currLayerPolyset
;
...
...
3d-viewer/3d_draw_basic_functions.cpp
View file @
25545756
...
...
@@ -96,11 +96,11 @@ static void Draw3D_VerticalPolygonalCylinder( const CPOLYGONS_LIST& aPolysList,
// Draw the vertical polygonal side
int
startContour
=
0
;
for
(
unsigned
ii
=
0
;
ii
<
aPolysList
.
size
();
ii
++
)
for
(
unsigned
ii
=
0
;
ii
<
aPolysList
.
GetCornersCount
();
ii
++
)
{
unsigned
jj
=
ii
+
1
;
if
(
aPolysList
.
IsEndContour
(
ii
)
||
jj
>=
aPolysList
.
size
()
)
if
(
aPolysList
.
IsEndContour
(
ii
)
||
jj
>=
aPolysList
.
GetCornersCount
()
)
{
jj
=
startContour
;
startContour
=
ii
+
1
;
...
...
@@ -170,7 +170,7 @@ void Draw3D_SolidHorizontalPolyPolygons( const CPOLYGONS_LIST& aPolysList,
{
int
startContour
=
1
;
for
(
unsigned
ii
=
0
;
ii
<
polylist
.
size
();
ii
++
)
for
(
unsigned
ii
=
0
;
ii
<
polylist
.
GetCornersCount
();
ii
++
)
{
if
(
startContour
==
1
)
{
...
...
common/convert_basic_shapes_to_polygon.cpp
View file @
25545756
...
...
@@ -59,10 +59,10 @@ void TransformCircleToPolygon( CPOLYGONS_LIST& aCornerBuffer,
RotatePoint
(
&
corner_position
.
x
,
&
corner_position
.
y
,
angle
);
corner_position
+=
aCenter
;
CPolyPt
polypoint
(
corner_position
.
x
,
corner_position
.
y
);
aCornerBuffer
.
push_back
(
polypoint
);
aCornerBuffer
.
Append
(
polypoint
);
}
aCornerBuffer
.
back
().
end_contour
=
true
;
aCornerBuffer
.
CloseLastContour
()
;
}
...
...
@@ -112,7 +112,7 @@ void TransformRoundedEndsSegmentToPolygon( CPOLYGONS_LIST& aCornerBuffer,
corner
+=
startp
;
polypoint
.
x
=
corner
.
x
;
polypoint
.
y
=
corner
.
y
;
aCornerBuffer
.
push_back
(
polypoint
);
aCornerBuffer
.
Append
(
polypoint
);
}
// Finish arc:
...
...
@@ -121,7 +121,7 @@ void TransformRoundedEndsSegmentToPolygon( CPOLYGONS_LIST& aCornerBuffer,
corner
+=
startp
;
polypoint
.
x
=
corner
.
x
;
polypoint
.
y
=
corner
.
y
;
aCornerBuffer
.
push_back
(
polypoint
);
aCornerBuffer
.
Append
(
polypoint
);
// add left rounded end:
for
(
int
ii
=
0
;
ii
<
1800
;
ii
+=
delta
)
...
...
@@ -132,7 +132,7 @@ void TransformRoundedEndsSegmentToPolygon( CPOLYGONS_LIST& aCornerBuffer,
corner
+=
startp
;
polypoint
.
x
=
corner
.
x
;
polypoint
.
y
=
corner
.
y
;
aCornerBuffer
.
push_back
(
polypoint
);
aCornerBuffer
.
Append
(
polypoint
);
}
// Finish arc:
...
...
@@ -141,9 +141,9 @@ void TransformRoundedEndsSegmentToPolygon( CPOLYGONS_LIST& aCornerBuffer,
corner
+=
startp
;
polypoint
.
x
=
corner
.
x
;
polypoint
.
y
=
corner
.
y
;
aCornerBuffer
.
push_back
(
polypoint
);
aCornerBuffer
.
Append
(
polypoint
);
aCornerBuffer
.
back
().
end_contour
=
true
;
aCornerBuffer
.
CloseLastContour
()
;
}
...
...
@@ -229,13 +229,13 @@ void TransformRingToPolygon( CPOLYGONS_LIST& aCornerBuffer,
curr_point
+=
aCentre
;
polycorner
.
x
=
curr_point
.
x
;
polycorner
.
y
=
curr_point
.
y
;
aCornerBuffer
.
push_back
(
polycorner
);
aCornerBuffer
.
Append
(
polycorner
);
}
// Draw the last point of inner circle
polycorner
.
x
=
aCentre
.
x
+
inner_radius
;
polycorner
.
y
=
aCentre
.
y
;
aCornerBuffer
.
push_back
(
polycorner
);
aCornerBuffer
.
Append
(
polycorner
);
// Draw the outer circle of the ring
for
(
int
ii
=
0
;
ii
<
3600
;
ii
+=
delta
)
...
...
@@ -246,16 +246,16 @@ void TransformRingToPolygon( CPOLYGONS_LIST& aCornerBuffer,
curr_point
+=
aCentre
;
polycorner
.
x
=
curr_point
.
x
;
polycorner
.
y
=
curr_point
.
y
;
aCornerBuffer
.
push_back
(
polycorner
);
aCornerBuffer
.
Append
(
polycorner
);
}
// Draw the last point of outer circle
polycorner
.
x
=
aCentre
.
x
+
outer_radius
;
polycorner
.
y
=
aCentre
.
y
;
aCornerBuffer
.
push_back
(
polycorner
);
aCornerBuffer
.
Append
(
polycorner
);
// Close the polygon
polycorner
.
x
=
aCentre
.
x
+
inner_radius
;
polycorner
.
end_contour
=
true
;
aCornerBuffer
.
push_back
(
polycorner
);
aCornerBuffer
.
Append
(
polycorner
);
}
pcbnew/board_items_to_polygon_shape_transform.cpp
View file @
25545756
...
...
@@ -137,7 +137,7 @@ void MODULE::TransformGraphicShapesWithClearanceToPolygonSet(
RotatePoint
(
&
corner
.
x
,
&
corner
.
y
,
GetOrientation
()
);
corner
.
x
+=
GetPosition
().
x
;
corner
.
y
+=
GetPosition
().
y
;
aCornerBuffer
.
push_back
(
corner
);
aCornerBuffer
.
Append
(
corner
);
}
aCornerBuffer
.
back
().
end_contour
=
true
;
break
;
...
...
@@ -170,7 +170,7 @@ void ZONE_CONTAINER::TransformSolidAreasShapesToPolygonSet(
int
aCircleToSegmentsCount
,
double
aCorrectionFactor
)
{
unsigned
cornerscount
=
GetFilledPolysList
().
size
();
unsigned
cornerscount
=
GetFilledPolysList
().
GetCornersCount
();
CPOLYGONS_LIST
polygonslist
;
if
(
cornerscount
==
0
)
...
...
@@ -239,7 +239,7 @@ void TEXTE_PCB::TransformBoundingBoxWithClearanceToPolygon(
{
// Rotate polygon
RotatePoint
(
&
corners
[
ii
].
x
,
&
corners
[
ii
].
y
,
m_Pos
.
x
,
m_Pos
.
y
,
m_Orient
);
aCornerBuffer
.
push_back
(
corners
[
ii
]
);
aCornerBuffer
.
Append
(
corners
[
ii
]
);
}
aCornerBuffer
.
back
().
end_contour
=
true
;
...
...
@@ -492,7 +492,7 @@ void D_PAD:: TransformShapeWithClearanceToPolygon( CPOLYGONS_LIST& aCornerBuffer
// Rotate according to module orientation
corner_position
+=
PadShapePos
;
// Shift origin to position
CPolyPt
polypoint
(
corner_position
.
x
,
corner_position
.
y
);
aCornerBuffer
.
push_back
(
polypoint
);
aCornerBuffer
.
Append
(
polypoint
);
}
for
(
int
i
=
0
;
i
<
aCircleToSegmentsCount
/
4
+
1
;
i
++
)
...
...
@@ -505,7 +505,7 @@ void D_PAD:: TransformShapeWithClearanceToPolygon( CPOLYGONS_LIST& aCornerBuffer
RotatePoint
(
&
corner_position
,
angle
);
corner_position
+=
PadShapePos
;
CPolyPt
polypoint
(
corner_position
.
x
,
corner_position
.
y
);
aCornerBuffer
.
push_back
(
polypoint
);
aCornerBuffer
.
Append
(
polypoint
);
}
for
(
int
i
=
0
;
i
<
aCircleToSegmentsCount
/
4
+
1
;
i
++
)
...
...
@@ -518,7 +518,7 @@ void D_PAD:: TransformShapeWithClearanceToPolygon( CPOLYGONS_LIST& aCornerBuffer
RotatePoint
(
&
corner_position
,
angle
);
corner_position
+=
PadShapePos
;
CPolyPt
polypoint
(
corner_position
.
x
,
corner_position
.
y
);
aCornerBuffer
.
push_back
(
polypoint
);
aCornerBuffer
.
Append
(
polypoint
);
}
for
(
int
i
=
0
;
i
<
aCircleToSegmentsCount
/
4
+
1
;
i
++
)
...
...
@@ -531,10 +531,10 @@ void D_PAD:: TransformShapeWithClearanceToPolygon( CPOLYGONS_LIST& aCornerBuffer
RotatePoint
(
&
corner_position
,
angle
);
corner_position
+=
PadShapePos
;
CPolyPt
polypoint
(
corner_position
.
x
,
corner_position
.
y
);
aCornerBuffer
.
push_back
(
polypoint
);
aCornerBuffer
.
Append
(
polypoint
);
}
aCornerBuffer
.
back
().
end_contour
=
true
;
aCornerBuffer
.
CloseLastContour
()
;
break
;
}
}
...
...
@@ -569,10 +569,10 @@ void D_PAD::BuildPadShapePolygon( CPOLYGONS_LIST& aCornerBuffer,
{
corners
[
ii
]
+=
PadShapePos
;
// Shift origin to position
CPolyPt
polypoint
(
corners
[
ii
].
x
,
corners
[
ii
].
y
);
aCornerBuffer
.
push_back
(
polypoint
);
aCornerBuffer
.
Append
(
polypoint
);
}
aCornerBuffer
.
back
().
end_contour
=
true
;
aCornerBuffer
.
CloseLastContour
()
;
break
;
}
}
...
...
@@ -768,10 +768,10 @@ void CreateThermalReliefPadPolygon( CPOLYGONS_LIST& aCornerBuffer,
corner
=
corners_buffer
[
ii
];
RotatePoint
(
&
corner
,
th_angle
+
angle_pad
);
// Rotate by segment angle and pad orientation
corner
+=
PadShapePos
;
aCornerBuffer
.
push_back
(
CPolyPt
(
corner
.
x
,
corner
.
y
)
);
aCornerBuffer
.
Append
(
CPolyPt
(
corner
.
x
,
corner
.
y
)
);
}
aCornerBuffer
.
back
().
end_contour
=
true
;
aCornerBuffer
.
CloseLastContour
()
;
th_angle
+=
900
;
// Note: th_angle in in 0.1 deg.
}
}
...
...
@@ -872,7 +872,7 @@ void CreateThermalReliefPadPolygon( CPOLYGONS_LIST& aCornerBuffer,
wxPoint
cpos
=
corners_buffer
[
ic
];
RotatePoint
(
&
cpos
,
angle
);
cpos
+=
PadShapePos
;
aCornerBuffer
.
push_back
(
CPolyPt
(
cpos
.
x
,
cpos
.
y
)
);
aCornerBuffer
.
Append
(
CPolyPt
(
cpos
.
x
,
cpos
.
y
)
);
}
aCornerBuffer
.
back
().
end_contour
=
true
;
...
...
@@ -897,7 +897,7 @@ void CreateThermalReliefPadPolygon( CPOLYGONS_LIST& aCornerBuffer,
wxPoint
cpos
=
corners_buffer
[
ic
];
RotatePoint
(
&
cpos
,
angle
);
cpos
+=
PadShapePos
;
aCornerBuffer
.
push_back
(
CPolyPt
(
cpos
.
x
,
cpos
.
y
)
);
aCornerBuffer
.
Append
(
CPolyPt
(
cpos
.
x
,
cpos
.
y
)
);
}
aCornerBuffer
.
back
().
end_contour
=
true
;
...
...
@@ -970,10 +970,10 @@ void CreateThermalReliefPadPolygon( CPOLYGONS_LIST& aCornerBuffer,
wxPoint
cpos
=
corners_buffer
[
ic
];
RotatePoint
(
&
cpos
,
angle
);
// Rotate according to module orientation
cpos
+=
PadShapePos
;
// Shift origin to position
aCornerBuffer
.
push_back
(
CPolyPt
(
cpos
.
x
,
cpos
.
y
)
);
aCornerBuffer
.
Append
(
CPolyPt
(
cpos
.
x
,
cpos
.
y
)
);
}
aCornerBuffer
.
back
().
end_contour
=
true
;
aCornerBuffer
.
CloseLastContour
()
;
angle
=
AddAngles
(
angle
,
1800
);
// this is calculate hole 3
}
...
...
@@ -993,10 +993,10 @@ void CreateThermalReliefPadPolygon( CPOLYGONS_LIST& aCornerBuffer,
wxPoint
cpos
=
corners_buffer
[
ic
];
RotatePoint
(
&
cpos
,
angle
);
cpos
+=
PadShapePos
;
aCornerBuffer
.
push_back
(
CPolyPt
(
cpos
.
x
,
cpos
.
y
)
);
aCornerBuffer
.
Append
(
CPolyPt
(
cpos
.
x
,
cpos
.
y
)
);
}
aCornerBuffer
.
back
().
end_contour
=
true
;
aCornerBuffer
.
CloseLastContour
()
;
angle
=
AddAngles
(
angle
,
1800
);
}
...
...
pcbnew/class_zone.cpp
View file @
25545756
...
...
@@ -120,7 +120,8 @@ EDA_ITEM* ZONE_CONTAINER::Clone() const
bool
ZONE_CONTAINER
::
UnFill
()
{
bool
change
=
(
m_FilledPolysList
.
size
()
>
0
)
||
(
m_FillSegmList
.
size
()
>
0
);
bool
change
=
(
m_FilledPolysList
.
GetCornersCount
()
>
0
)
||
(
m_FillSegmList
.
size
()
>
0
);
m_FilledPolysList
.
clear
();
m_FillSegmList
.
clear
();
...
...
@@ -250,7 +251,7 @@ void ZONE_CONTAINER::DrawFilledArea( EDA_DRAW_PANEL* panel,
if
(
DisplayOpt
.
DisplayZonesMode
==
1
)
// Do not show filled areas
return
;
if
(
m_FilledPolysList
.
size
()
==
0
)
// Nothing to draw
if
(
m_FilledPolysList
.
GetCornersCount
()
==
0
)
// Nothing to draw
return
;
BOARD
*
brd
=
GetBoard
();
...
...
@@ -279,7 +280,7 @@ void ZONE_CONTAINER::DrawFilledArea( EDA_DRAW_PANEL* panel,
CornersBuffer
.
clear
();
// Draw all filled areas
int
imax
=
m_FilledPolysList
.
size
()
-
1
;
int
imax
=
m_FilledPolysList
.
GetCornersCount
()
-
1
;
for
(
int
ic
=
0
;
ic
<=
imax
;
ic
++
)
{
...
...
@@ -490,7 +491,7 @@ bool ZONE_CONTAINER::HitTestForCorner( const wxPoint& refPos )
int
min_dist
=
MIN_DIST_IN_MILS
*
IU_PER_MILS
;
wxPoint
delta
;
unsigned
lim
=
m_Poly
->
m_CornersList
.
size
();
unsigned
lim
=
m_Poly
->
m_CornersList
.
GetCornersCount
();
for
(
unsigned
item_pos
=
0
;
item_pos
<
lim
;
item_pos
++
)
{
...
...
@@ -513,7 +514,7 @@ bool ZONE_CONTAINER::HitTestForCorner( const wxPoint& refPos )
bool
ZONE_CONTAINER
::
HitTestForEdge
(
const
wxPoint
&
refPos
)
{
unsigned
lim
=
m_Poly
->
m_CornersList
.
size
();
unsigned
lim
=
m_Poly
->
m_CornersList
.
GetCornersCount
();
m_CornerSelection
=
-
1
;
// Set to not found
...
...
@@ -610,7 +611,7 @@ bool ZONE_CONTAINER::HitTestFilledArea( const wxPoint& aRefPos ) const
unsigned
indexstart
=
0
,
indexend
;
bool
inside
=
false
;
for
(
indexend
=
0
;
indexend
<
m_FilledPolysList
.
size
();
indexend
++
)
for
(
indexend
=
0
;
indexend
<
m_FilledPolysList
.
GetCornersCount
();
indexend
++
)
{
if
(
m_FilledPolysList
.
IsEndContour
(
indexend
)
)
// end of a filled sub-area found
{
...
...
@@ -701,7 +702,7 @@ void ZONE_CONTAINER::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
aList
.
push_back
(
MSG_PANEL_ITEM
(
_
(
"Layer"
),
GetLayerName
(),
BROWN
)
);
msg
.
Printf
(
wxT
(
"%d"
),
(
int
)
m_Poly
->
m_CornersList
.
size
()
);
msg
.
Printf
(
wxT
(
"%d"
),
(
int
)
m_Poly
->
m_CornersList
.
GetCornersCount
()
);
aList
.
push_back
(
MSG_PANEL_ITEM
(
_
(
"Corners"
),
msg
,
BLUE
)
);
if
(
m_FillMode
)
...
...
@@ -715,9 +716,9 @@ void ZONE_CONTAINER::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
msg
.
Printf
(
wxT
(
"%d"
),
(
int
)
m_Poly
->
m_HatchLines
.
size
()
);
aList
.
push_back
(
MSG_PANEL_ITEM
(
_
(
"Hatch lines"
),
msg
,
BLUE
)
);
if
(
m_FilledPolysList
.
size
()
)
if
(
m_FilledPolysList
.
GetCornersCount
()
)
{
msg
.
Printf
(
wxT
(
"%d"
),
(
int
)
m_FilledPolysList
.
size
()
);
msg
.
Printf
(
wxT
(
"%d"
),
(
int
)
m_FilledPolysList
.
GetCornersCount
()
);
aList
.
push_back
(
MSG_PANEL_ITEM
(
_
(
"Corners in DrawList"
),
msg
,
BLUE
)
);
}
}
...
...
@@ -728,7 +729,7 @@ void ZONE_CONTAINER::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
void
ZONE_CONTAINER
::
Move
(
const
wxPoint
&
offset
)
{
/* move outlines */
for
(
unsigned
ii
=
0
;
ii
<
m_Poly
->
m_CornersList
.
size
();
ii
++
)
for
(
unsigned
ii
=
0
;
ii
<
m_Poly
->
m_CornersList
.
GetCornersCount
();
ii
++
)
{
SetCornerPosition
(
ii
,
GetCornerPosition
(
ii
)
+
offset
);
}
...
...
@@ -736,7 +737,7 @@ void ZONE_CONTAINER::Move( const wxPoint& offset )
m_Poly
->
Hatch
();
/* move filled areas: */
for
(
unsigned
ic
=
0
;
ic
<
m_FilledPolysList
.
size
();
ic
++
)
for
(
unsigned
ic
=
0
;
ic
<
m_FilledPolysList
.
GetCornersCount
();
ic
++
)
{
m_FilledPolysList
.
SetX
(
ic
,
m_FilledPolysList
.
GetX
(
ic
)
+
offset
.
x
);
m_FilledPolysList
.
SetY
(
ic
,
m_FilledPolysList
.
GetX
(
ic
)
+
offset
.
y
);
...
...
@@ -778,7 +779,7 @@ void ZONE_CONTAINER::Rotate( const wxPoint& centre, double angle )
{
wxPoint
pos
;
for
(
unsigned
ic
=
0
;
ic
<
m_Poly
->
m_CornersList
.
size
();
ic
++
)
for
(
unsigned
ic
=
0
;
ic
<
m_Poly
->
m_CornersList
.
GetCornersCount
();
ic
++
)
{
pos
=
m_Poly
->
m_CornersList
.
GetPos
(
ic
);
RotatePoint
(
&
pos
,
centre
,
angle
);
...
...
@@ -789,7 +790,7 @@ void ZONE_CONTAINER::Rotate( const wxPoint& centre, double angle )
m_Poly
->
Hatch
();
/* rotate filled areas: */
for
(
unsigned
ic
=
0
;
ic
<
m_FilledPolysList
.
size
();
ic
++
)
for
(
unsigned
ic
=
0
;
ic
<
m_FilledPolysList
.
GetCornersCount
();
ic
++
)
{
pos
=
m_FilledPolysList
.
GetPos
(
ic
);
RotatePoint
(
&
pos
,
centre
,
angle
);
...
...
@@ -814,7 +815,7 @@ void ZONE_CONTAINER::Flip( const wxPoint& aCentre )
void
ZONE_CONTAINER
::
Mirror
(
const
wxPoint
&
mirror_ref
)
{
for
(
unsigned
ic
=
0
;
ic
<
m_Poly
->
m_CornersList
.
size
();
ic
++
)
for
(
unsigned
ic
=
0
;
ic
<
m_Poly
->
m_CornersList
.
GetCornersCount
();
ic
++
)
{
int
py
=
m_Poly
->
m_CornersList
.
GetY
(
ic
)
-
mirror_ref
.
y
;
NEGATE
(
py
);
...
...
@@ -824,7 +825,7 @@ void ZONE_CONTAINER::Mirror( const wxPoint& mirror_ref )
m_Poly
->
Hatch
();
/* mirror filled areas: */
for
(
unsigned
ic
=
0
;
ic
<
m_FilledPolysList
.
size
();
ic
++
)
for
(
unsigned
ic
=
0
;
ic
<
m_FilledPolysList
.
GetCornersCount
();
ic
++
)
{
int
py
=
m_FilledPolysList
.
GetY
(
ic
)
-
mirror_ref
.
y
;
NEGATE
(
py
);
...
...
pcbnew/class_zone.h
View file @
25545756
...
...
@@ -449,7 +449,7 @@ public:
int
GetNumCorners
(
void
)
const
{
return
m_Poly
->
Get
NumCorners
();
return
m_Poly
->
Get
CornersCount
();
}
void
RemoveAllContours
(
void
)
...
...
pcbnew/kicad_plugin.cpp
View file @
25545756
...
...
@@ -1398,12 +1398,12 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const
const
CPOLYGONS_LIST
&
cv
=
aZone
->
Outline
()
->
m_CornersList
;
int
newLine
=
0
;
if
(
cv
.
size
()
)
if
(
cv
.
GetCornersCount
()
)
{
m_out
->
Print
(
aNestLevel
+
1
,
"(polygon
\n
"
);
m_out
->
Print
(
aNestLevel
+
2
,
"(pts
\n
"
);
for
(
unsigned
it
=
0
;
it
<
cv
.
size
();
++
it
)
for
(
unsigned
it
=
0
;
it
<
cv
.
GetCornersCount
();
++
it
)
{
if
(
newLine
==
0
)
m_out
->
Print
(
aNestLevel
+
3
,
"(xy %s %s)"
,
...
...
@@ -1429,7 +1429,7 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const
m_out
->
Print
(
aNestLevel
+
2
,
")
\n
"
);
if
(
it
+
1
!=
cv
.
size
()
)
if
(
it
+
1
!=
cv
.
GetCornersCount
()
)
{
newLine
=
0
;
m_out
->
Print
(
aNestLevel
+
1
,
")
\n
"
);
...
...
@@ -1446,12 +1446,12 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const
const
CPOLYGONS_LIST
&
fv
=
aZone
->
GetFilledPolysList
();
newLine
=
0
;
if
(
fv
.
size
()
)
if
(
fv
.
GetCornersCount
()
)
{
m_out
->
Print
(
aNestLevel
+
1
,
"(filled_polygon
\n
"
);
m_out
->
Print
(
aNestLevel
+
2
,
"(pts
\n
"
);
for
(
unsigned
it
=
0
;
it
<
fv
.
size
();
++
it
)
for
(
unsigned
it
=
0
;
it
<
fv
.
GetCornersCount
();
++
it
)
{
if
(
newLine
==
0
)
m_out
->
Print
(
aNestLevel
+
3
,
"(xy %s %s)"
,
...
...
@@ -1477,7 +1477,7 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const
m_out
->
Print
(
aNestLevel
+
2
,
")
\n
"
);
if
(
it
+
1
!=
fv
.
size
()
)
if
(
it
+
1
!=
fv
.
GetCornersCount
()
)
{
newLine
=
0
;
m_out
->
Print
(
aNestLevel
+
1
,
")
\n
"
);
...
...
pcbnew/legacy_plugin.cpp
View file @
25545756
...
...
@@ -2360,7 +2360,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER()
bool
end_contour
=
intParse
(
data
,
&
data
);
// end_countour was a bool when file saved, so '0' or '1' here
int
cornerUtilityFlg
=
intParse
(
data
);
polysList
.
push_back
(
CPolyPt
(
x
,
y
,
end_contour
,
cornerUtilityFlg
)
);
polysList
.
Append
(
CPolyPt
(
x
,
y
,
end_contour
,
cornerUtilityFlg
)
);
}
zc
->
AddFilledPolysList
(
polysList
);
}
...
...
@@ -3693,7 +3693,7 @@ void LEGACY_PLUGIN::saveZONE_CONTAINER( const ZONE_CONTAINER* me ) const
// Save the corner list
const
CPOLYGONS_LIST
&
cv
=
me
->
Outline
()
->
m_CornersList
;
for
(
unsigned
it
=
0
;
it
<
cv
.
size
();
++
it
)
for
(
unsigned
it
=
0
;
it
<
cv
.
GetCornersCount
();
++
it
)
{
fprintf
(
m_fp
,
"ZCorner %s %d
\n
"
,
fmtBIUPair
(
cv
.
GetX
(
it
),
cv
.
GetY
(
it
)
).
c_str
(),
...
...
@@ -3702,11 +3702,11 @@ void LEGACY_PLUGIN::saveZONE_CONTAINER( const ZONE_CONTAINER* me ) const
// Save the PolysList
const
CPOLYGONS_LIST
&
fv
=
me
->
GetFilledPolysList
();
if
(
fv
.
size
()
)
if
(
fv
.
GetCornersCount
()
)
{
fprintf
(
m_fp
,
"$POLYSCORNERS
\n
"
);
for
(
unsigned
it
=
0
;
it
<
fv
.
size
();
++
it
)
for
(
unsigned
it
=
0
;
it
<
fv
.
GetCornersCount
();
++
it
)
{
fprintf
(
m_fp
,
"%s %d %d
\n
"
,
fmtBIUPair
(
fv
.
GetX
(
it
),
fv
.
GetY
(
it
)
).
c_str
(),
...
...
pcbnew/onrightclick.cpp
View file @
25545756
...
...
@@ -665,7 +665,7 @@ void PCB_EDIT_FRAME::createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu*
AddMenuItem
(
zones_menu
,
ID_POPUP_PCB_FILL_ZONE
,
_
(
"Fill Zone"
),
KiBitmap
(
fill_zone_xpm
)
);
if
(
edge_zone
->
GetFilledPolysList
().
size
()
>
0
)
if
(
edge_zone
->
GetFilledPolysList
().
GetCornersCount
()
>
0
)
{
AddMenuItem
(
zones_menu
,
ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_CURRENT_ZONE
,
_
(
"Remove Filled Areas in Zone"
),
KiBitmap
(
zone_unfill_xpm
)
);
...
...
pcbnew/pcb_parser.cpp
View file @
25545756
...
...
@@ -2614,11 +2614,11 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER() throw( IO_ERROR, PARSE_ERROR )
for
(
token
=
NextTok
();
token
!=
T_RIGHT
;
token
=
NextTok
()
)
{
pts
.
push_back
(
CPolyPt
(
parseXY
()
)
);
pts
.
Append
(
CPolyPt
(
parseXY
()
)
);
}
NeedRIGHT
();
pts
.
back
().
end_contour
=
true
;
pts
.
CloseLastContour
()
;
}
break
;
...
...
@@ -2665,7 +2665,7 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER() throw( IO_ERROR, PARSE_ERROR )
zone
->
Outline
()
->
SetHatch
(
hatchStyle
,
hatchPitch
,
true
);
}
if
(
pts
.
size
()
)
if
(
pts
.
GetCornersCount
()
)
zone
->
AddFilledPolysList
(
pts
);
// Ensure keepout does not have a net (which have no sense for a keepout zone)
...
...
pcbnew/pcb_plot_params.cpp
View file @
25545756
...
...
@@ -2,7 +2,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-201
1
KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 1992-201
3
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
...
...
@@ -33,6 +33,7 @@
#define PLOT_LINEWIDTH_MIN (0.02*IU_PER_MM) // min value for default line thickness
#define PLOT_LINEWIDTH_MAX (2*IU_PER_MM) // max value for default line thickness
#define PLOT_LINEWIDTH_DEFAULT (0.15*IU_PER_MM) // def. value for default line thickness
#define HPGL_PEN_DIAMETER_MIN 0
#define HPGL_PEN_DIAMETER_MAX 100 // Unit = mil
#define HPGL_PEN_SPEED_MIN 1 // this param is always in cm/s
...
...
@@ -47,7 +48,7 @@
* Default line thickness in internal units used to draw or plot items using a
* default thickness line value (Frame references)
*/
int
g_DrawDefaultLineThickness
=
(
0.15
*
IU_PER_MM
)
;
int
g_DrawDefaultLineThickness
=
PLOT_LINEWIDTH_DEFAULT
;
using
namespace
PCBPLOTPARAMS_T
;
...
...
@@ -132,8 +133,8 @@ void PCB_PLOT_PARAMS::Format( OUTPUTFORMATTER* aFormatter,
m_useGerberExtensions
?
trueStr
:
falseStr
);
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %s)
\n
"
,
getTokenName
(
T_excludeedgelayer
),
m_excludeEdgeLayer
?
trueStr
:
falseStr
);
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %
d
)
\n
"
,
getTokenName
(
T_linewidth
),
m_lineWidth
);
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %
f
)
\n
"
,
getTokenName
(
T_linewidth
),
m_lineWidth
/
IU_PER_MM
);
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %s)
\n
"
,
getTokenName
(
T_plotframeref
),
m_plotFrameRef
?
trueStr
:
falseStr
);
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %s)
\n
"
,
getTokenName
(
T_viasonmask
),
...
...
@@ -332,83 +333,89 @@ void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams )
aPcbPlotParams
->
m_layerSelection
=
atol
(
CurText
()
);
break
;
case
T_usegerberextensions
:
aPcbPlotParams
->
m_useGerberExtensions
=
P
arseBool
();
aPcbPlotParams
->
m_useGerberExtensions
=
p
arseBool
();
break
;
case
T_psa4output
:
aPcbPlotParams
->
m_A4Output
=
P
arseBool
();
aPcbPlotParams
->
m_A4Output
=
p
arseBool
();
break
;
case
T_excludeedgelayer
:
aPcbPlotParams
->
m_excludeEdgeLayer
=
P
arseBool
();
aPcbPlotParams
->
m_excludeEdgeLayer
=
p
arseBool
();
break
;
case
T_linewidth
:
aPcbPlotParams
->
m_lineWidth
=
ParseInt
(
PLOT_LINEWIDTH_MIN
,
PLOT_LINEWIDTH_MAX
);
{
// Due to a bug, this (minor) parameter was saved in biu
// and now is saved in mm
// If the read value is outside bounds, force a default value
double
tmp
=
parseDouble
();
if
(
!
aPcbPlotParams
->
SetLineWidth
(
KiROUND
(
tmp
*
IU_PER_MM
)
)
)
aPcbPlotParams
->
SetLineWidth
(
PLOT_LINEWIDTH_DEFAULT
);
}
break
;
case
T_plotframeref
:
aPcbPlotParams
->
m_plotFrameRef
=
P
arseBool
();
aPcbPlotParams
->
m_plotFrameRef
=
p
arseBool
();
break
;
case
T_viasonmask
:
aPcbPlotParams
->
m_plotViaOnMaskLayer
=
P
arseBool
();
aPcbPlotParams
->
m_plotViaOnMaskLayer
=
p
arseBool
();
break
;
case
T_mode
:
aPcbPlotParams
->
m_mode
=
static_cast
<
EDA_DRAW_MODE_T
>
(
P
arseInt
(
0
,
2
)
);
aPcbPlotParams
->
m_mode
=
static_cast
<
EDA_DRAW_MODE_T
>
(
p
arseInt
(
0
,
2
)
);
break
;
case
T_useauxorigin
:
aPcbPlotParams
->
m_useAuxOrigin
=
P
arseBool
();
aPcbPlotParams
->
m_useAuxOrigin
=
p
arseBool
();
break
;
case
T_hpglpennumber
:
aPcbPlotParams
->
m_HPGLPenNum
=
P
arseInt
(
HPGL_PEN_NUMBER_MIN
,
aPcbPlotParams
->
m_HPGLPenNum
=
p
arseInt
(
HPGL_PEN_NUMBER_MIN
,
HPGL_PEN_NUMBER_MAX
);
break
;
case
T_hpglpenspeed
:
aPcbPlotParams
->
m_HPGLPenSpeed
=
P
arseInt
(
HPGL_PEN_SPEED_MIN
,
aPcbPlotParams
->
m_HPGLPenSpeed
=
p
arseInt
(
HPGL_PEN_SPEED_MIN
,
HPGL_PEN_SPEED_MAX
);
break
;
case
T_hpglpendiameter
:
aPcbPlotParams
->
m_HPGLPenDiam
=
P
arseInt
(
HPGL_PEN_DIAMETER_MIN
,
aPcbPlotParams
->
m_HPGLPenDiam
=
p
arseInt
(
HPGL_PEN_DIAMETER_MIN
,
HPGL_PEN_DIAMETER_MAX
);
break
;
case
T_hpglpenoverlay
:
aPcbPlotParams
->
m_HPGLPenOvr
=
P
arseInt
(
HPGL_PEN_OVERLAP_MIN
,
aPcbPlotParams
->
m_HPGLPenOvr
=
p
arseInt
(
HPGL_PEN_OVERLAP_MIN
,
HPGL_PEN_OVERLAP_MAX
);
break
;
case
T_pscolor
:
NeedSYMBOL
();
// This actually was never used...
break
;
case
T_psnegative
:
aPcbPlotParams
->
m_negative
=
P
arseBool
();
aPcbPlotParams
->
m_negative
=
p
arseBool
();
break
;
case
T_plotreference
:
aPcbPlotParams
->
m_plotReference
=
P
arseBool
();
aPcbPlotParams
->
m_plotReference
=
p
arseBool
();
break
;
case
T_plotvalue
:
aPcbPlotParams
->
m_plotValue
=
P
arseBool
();
aPcbPlotParams
->
m_plotValue
=
p
arseBool
();
break
;
case
T_plotothertext
:
aPcbPlotParams
->
m_plotOtherText
=
P
arseBool
();
aPcbPlotParams
->
m_plotOtherText
=
p
arseBool
();
break
;
case
T_plotinvisibletext
:
aPcbPlotParams
->
m_plotInvisibleText
=
P
arseBool
();
aPcbPlotParams
->
m_plotInvisibleText
=
p
arseBool
();
break
;
case
T_padsonsilk
:
aPcbPlotParams
->
m_plotPadsOnSilkLayer
=
P
arseBool
();
aPcbPlotParams
->
m_plotPadsOnSilkLayer
=
p
arseBool
();
break
;
case
T_subtractmaskfromsilk
:
aPcbPlotParams
->
m_subtractMaskFromSilk
=
P
arseBool
();
aPcbPlotParams
->
m_subtractMaskFromSilk
=
p
arseBool
();
break
;
case
T_outputformat
:
aPcbPlotParams
->
m_format
=
static_cast
<
PlotFormat
>
(
P
arseInt
(
PLOT_FIRST_FORMAT
,
PLOT_LAST_FORMAT
)
);
p
arseInt
(
PLOT_FIRST_FORMAT
,
PLOT_LAST_FORMAT
)
);
break
;
case
T_mirror
:
aPcbPlotParams
->
m_mirror
=
P
arseBool
();
aPcbPlotParams
->
m_mirror
=
p
arseBool
();
break
;
case
T_drillshape
:
aPcbPlotParams
->
m_drillMarks
=
static_cast
<
PCB_PLOT_PARAMS
::
DrillMarksType
>
(
P
arseInt
(
0
,
2
)
);
(
p
arseInt
(
0
,
2
)
);
break
;
case
T_scaleselection
:
aPcbPlotParams
->
m_scaleSelection
=
P
arseInt
(
0
,
4
);
aPcbPlotParams
->
m_scaleSelection
=
p
arseInt
(
0
,
4
);
break
;
case
T_outputdirectory
:
NeedSYMBOL
();
...
...
@@ -423,7 +430,7 @@ void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams )
}
bool
PCB_PLOT_PARAMS_PARSER
::
P
arseBool
()
bool
PCB_PLOT_PARAMS_PARSER
::
p
arseBool
()
{
T
token
=
NeedSYMBOL
();
...
...
@@ -434,7 +441,7 @@ bool PCB_PLOT_PARAMS_PARSER::ParseBool()
}
int
PCB_PLOT_PARAMS_PARSER
::
P
arseInt
(
int
aMin
,
int
aMax
)
int
PCB_PLOT_PARAMS_PARSER
::
p
arseInt
(
int
aMin
,
int
aMax
)
{
T
token
=
NextTok
();
...
...
@@ -450,3 +457,16 @@ int PCB_PLOT_PARAMS_PARSER::ParseInt( int aMin, int aMax )
return
val
;
}
double
PCB_PLOT_PARAMS_PARSER
::
parseDouble
()
{
T
token
=
NextTok
();
if
(
token
!=
T_NUMBER
)
Expecting
(
T_NUMBER
);
double
val
=
strtod
(
CurText
(),
NULL
);
return
val
;
}
pcbnew/pcb_plot_params.h
View file @
25545756
...
...
@@ -46,16 +46,25 @@ public:
LINE_READER
*
GetReader
()
{
return
reader
;
};
void
Parse
(
PCB_PLOT_PARAMS
*
aPcbPlotParams
)
throw
(
PARSE_ERROR
,
IO_ERROR
);
bool
ParseBool
();
private
:
bool
parseBool
();
/**
* Function
P
arseInt
* Function
p
arseInt
* parses an integer and constrains it between two values.
* @param aMin is the smallest return value.
* @param aMax is the largest return value.
* @return int - the parsed integer.
*/
int
ParseInt
(
int
aMin
,
int
aMax
);
int
parseInt
(
int
aMin
,
int
aMax
);
/**
* Function parseDouble
* parses a double
* @return double - the parsed double.
*/
double
parseDouble
();
};
...
...
pcbnew/plot_brditems_plotter.cpp
View file @
25545756
...
...
@@ -509,7 +509,7 @@ void BRDITEMS_PLOTTER::PlotTextePcb( TEXTE_PCB* pt_texte )
void
BRDITEMS_PLOTTER
::
PlotFilledAreas
(
ZONE_CONTAINER
*
aZone
)
{
const
CPOLYGONS_LIST
&
polysList
=
aZone
->
GetFilledPolysList
();
unsigned
imax
=
polysList
.
size
();
unsigned
imax
=
polysList
.
GetCornersCount
();
if
(
imax
==
0
)
// Nothing to draw
return
;
...
...
pcbnew/specctra_export.cpp
View file @
25545756
...
...
@@ -1502,7 +1502,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IO_ERROR )
mainPolygon
->
layer_id
=
layerIds
[
kicadLayer2pcb
[
item
->
GetLayer
()
]
];
int
count
=
item
->
Outline
()
->
m_CornersList
.
size
();
int
count
=
item
->
Outline
()
->
m_CornersList
.
GetCornersCount
();
int
ndx
=
0
;
// used in 2 for() loops below
for
(
;
ndx
<
count
;
++
ndx
)
{
...
...
@@ -1579,7 +1579,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IO_ERROR )
mainPolygon
->
layer_id
=
layerIds
[
kicadLayer2pcb
[
item
->
GetLayer
()
]
];
int
count
=
item
->
Outline
()
->
m_CornersList
.
size
();
int
count
=
item
->
Outline
()
->
m_CornersList
.
GetCornersCount
();
int
ndx
=
0
;
// used in 2 for() loops below
for
(
;
ndx
<
count
;
++
ndx
)
{
...
...
pcbnew/zone_filling_algorithm.cpp
View file @
25545756
...
...
@@ -157,7 +157,7 @@ int ZONE_CONTAINER::FillZoneAreasWithSegments()
// Read all filled areas in m_FilledPolysList
m_FillSegmList
.
clear
();
istart
=
0
;
int
end_list
=
m_FilledPolysList
.
size
()
-
1
;
int
end_list
=
m_FilledPolysList
.
GetCornersCount
()
-
1
;
for
(
int
ic
=
0
;
ic
<=
end_list
;
ic
++
)
{
...
...
pcbnew/zones_by_polygon.cpp
View file @
25545756
...
...
@@ -358,7 +358,7 @@ void PCB_EDIT_FRAME::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER* aZone )
{
OnModify
();
if
(
aZone
->
Outline
()
->
Get
NumCorners
()
<=
3
)
if
(
aZone
->
Outline
()
->
Get
CornersCount
()
<=
3
)
{
m_canvas
->
RefreshDrawingRect
(
aZone
->
GetBoundingBox
()
);
...
...
pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp
View file @
25545756
...
...
@@ -414,7 +414,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
// cornerBufferPolysToSubstract contains polygons to substract.
// polyset_zone_solid_areas contains the main filled area
// Calculate now actual solid areas
if
(
cornerBufferPolysToSubstract
.
size
()
>
0
)
if
(
cornerBufferPolysToSubstract
.
GetCornersCount
()
>
0
)
{
KI_POLYGON_SET
polyset_holes
;
cornerBufferPolysToSubstract
.
ExportTo
(
polyset_holes
);
...
...
@@ -440,7 +440,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
s_Correction
,
s_thermalRot
);
// remove copper areas corresponding to not connected stubs
if
(
cornerBufferPolysToSubstract
.
size
()
)
if
(
cornerBufferPolysToSubstract
.
GetCornersCount
()
)
{
KI_POLYGON_SET
polyset_holes
;
cornerBufferPolysToSubstract
.
ExportTo
(
polyset_holes
);
...
...
pcbnew/zones_convert_to_polygons_aux_functions.cpp
View file @
25545756
...
...
@@ -68,7 +68,7 @@ void ZONE_CONTAINER::TransformOutlinesShapeWithClearanceToPolygon(
KI_POLYGON_SET
polyset_zone_solid_areas
;
std
::
vector
<
KI_POLY_POINT
>
cornerslist
;
unsigned
ic
=
0
;
unsigned
corners_count
=
zoneOutines
.
size
();
unsigned
corners_count
=
zoneOutines
.
GetCornersCount
();
while
(
ic
<
corners_count
)
{
cornerslist
.
clear
();
...
...
@@ -104,10 +104,10 @@ void ZONE_CONTAINER::TransformOutlinesShapeWithClearanceToPolygon(
corner
.
x
=
point
.
x
();
corner
.
y
=
point
.
y
();
corner
.
end_contour
=
false
;
aCornerBuffer
.
push_back
(
corner
);
aCornerBuffer
.
Append
(
corner
);
}
aCornerBuffer
.
back
().
end_contour
=
true
;
aCornerBuffer
.
CloseLastContour
()
;
}
}
...
...
@@ -284,8 +284,8 @@ void BuildUnconnectedThermalStubsPolygonList( CPOLYGONS_LIST& aCornerBuffer,
CPolyPt
corner
;
corner
.
x
=
cpos
.
x
;
corner
.
y
=
cpos
.
y
;
corner
.
end_contour
=
(
ic
<
(
corners_buffer
.
size
()
-
1
)
)
?
0
:
1
;
aCornerBuffer
.
push_back
(
corner
);
corner
.
end_contour
=
(
ic
<
(
corners_buffer
.
size
()
-
1
)
)
?
false
:
true
;
aCornerBuffer
.
Append
(
corner
);
}
}
}
...
...
pcbnew/zones_polygons_insulated_copper_islands.cpp
View file @
25545756
...
...
@@ -40,7 +40,7 @@
void
ZONE_CONTAINER
::
TestForCopperIslandAndRemoveInsulatedIslands
(
BOARD
*
aPcb
)
{
if
(
m_FilledPolysList
.
size
()
==
0
)
if
(
m_FilledPolysList
.
GetCornersCount
()
==
0
)
return
;
// Build a list of points connected to the net:
...
...
@@ -79,7 +79,7 @@ void ZONE_CONTAINER::TestForCopperIslandAndRemoveInsulatedIslands( BOARD* aPcb )
unsigned
indexstart
=
0
,
indexend
;
bool
connected
=
false
;
for
(
indexend
=
0
;
indexend
<
m_FilledPolysList
.
size
();
indexend
++
)
for
(
indexend
=
0
;
indexend
<
m_FilledPolysList
.
GetCornersCount
();
indexend
++
)
{
if
(
m_FilledPolysList
[
indexend
].
end_contour
)
// end of a filled sub-area found
{
...
...
pcbnew/zones_polygons_test_connections.cpp
View file @
25545756
...
...
@@ -51,7 +51,8 @@ void Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb, int aNetcode );
bool
sort_areas
(
const
ZONE_CONTAINER
*
ref
,
const
ZONE_CONTAINER
*
tst
)
{
if
(
ref
->
GetNet
()
==
tst
->
GetNet
()
)
return
ref
->
GetFilledPolysList
().
size
()
<
tst
->
GetFilledPolysList
().
size
();
return
ref
->
GetFilledPolysList
().
GetCornersCount
()
<
tst
->
GetFilledPolysList
().
GetCornersCount
();
else
return
ref
->
GetNet
()
<
tst
->
GetNet
();
}
...
...
@@ -94,7 +95,7 @@ void BOARD::Test_Connections_To_Copper_Areas( int aNetcode )
continue
;
if
(
(
aNetcode
>=
0
)
&&
(
aNetcode
!=
curr_zone
->
GetNet
()
)
)
continue
;
if
(
curr_zone
->
GetFilledPolysList
().
size
()
==
0
)
if
(
curr_zone
->
GetFilledPolysList
().
GetCornersCount
()
==
0
)
continue
;
zones_candidates
.
push_back
(
curr_zone
);
}
...
...
@@ -144,7 +145,7 @@ void BOARD::Test_Connections_To_Copper_Areas( int aNetcode )
// test if a candidate is inside a filled area of this zone
unsigned
indexstart
=
0
,
indexend
;
const
CPOLYGONS_LIST
&
polysList
=
curr_zone
->
GetFilledPolysList
();
for
(
indexend
=
0
;
indexend
<
polysList
.
size
();
indexend
++
)
for
(
indexend
=
0
;
indexend
<
polysList
.
GetCornersCount
();
indexend
++
)
{
// end of a filled sub-area found
if
(
polysList
.
IsEndContour
(
indexend
)
)
...
...
pcbnew/zones_test_and_combine_areas.cpp
View file @
25545756
...
...
@@ -257,7 +257,7 @@ bool BOARD::TestAreaIntersection( ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area
// If a contour is inside an other contour, no segments intersects, but the zones
// can be combined if a corner is inside an outline (only one corner is enought)
for
(
int
ic2
=
0
;
ic2
<
poly2
->
Get
NumCorners
();
ic2
++
)
for
(
int
ic2
=
0
;
ic2
<
poly2
->
Get
CornersCount
();
ic2
++
)
{
int
x
=
poly2
->
GetX
(
ic2
);
int
y
=
poly2
->
GetY
(
ic2
);
...
...
@@ -268,7 +268,7 @@ bool BOARD::TestAreaIntersection( ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area
}
}
for
(
int
ic1
=
0
;
ic1
<
poly1
->
Get
NumCorners
();
ic1
++
)
for
(
int
ic1
=
0
;
ic1
<
poly1
->
Get
CornersCount
();
ic1
++
)
{
int
x
=
poly1
->
GetX
(
ic1
);
int
y
=
poly1
->
GetY
(
ic1
);
...
...
@@ -414,7 +414,7 @@ int BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_E
zone2zoneClearance
=
1
;
// test for some corners of Area_Ref inside area_to_test
for
(
int
ic
=
0
;
ic
<
refSmoothedPoly
->
Get
NumCorners
();
ic
++
)
for
(
int
ic
=
0
;
ic
<
refSmoothedPoly
->
Get
CornersCount
();
ic
++
)
{
int
x
=
refSmoothedPoly
->
GetX
(
ic
);
int
y
=
refSmoothedPoly
->
GetY
(
ic
);
...
...
@@ -438,7 +438,7 @@ int BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_E
}
// test for some corners of area_to_test inside Area_Ref
for
(
int
ic2
=
0
;
ic2
<
testSmoothedPoly
->
Get
NumCorners
();
ic2
++
)
for
(
int
ic2
=
0
;
ic2
<
testSmoothedPoly
->
Get
CornersCount
();
ic2
++
)
{
int
x
=
testSmoothedPoly
->
GetX
(
ic2
);
int
y
=
testSmoothedPoly
->
GetY
(
ic2
);
...
...
polygon/PolyLine.cpp
View file @
25545756
...
...
@@ -42,7 +42,7 @@ CPolyLine::~CPolyLine()
int
removed
=
0
;
unsigned
startcountour
=
0
;
for
(
unsigned
icnt
=
1
;
icnt
<
m_CornersList
.
size
();
icnt
++
)
for
(
unsigned
icnt
=
1
;
icnt
<
m_CornersList
.
GetCornersCount
();
icnt
++
)
{
unsigned
last
=
icnt
-
1
;
if
(
m_CornersList
[
icnt
].
end_contour
)
...
...
@@ -84,7 +84,7 @@ int CPolyLine::NormalizeAreaOutlines( std::vector<CPolyLine*>* aNewPolygonList )
ClipperLib
::
Polygon
raw_polygon
;
ClipperLib
::
Polygons
normalized_polygons
;
unsigned
corners_count
=
m_CornersList
.
size
();
unsigned
corners_count
=
m_CornersList
.
GetCornersCount
();
KI_POLYGON_SET
polysholes
;
KI_POLYGON_WITH_HOLES
mainpoly
;
...
...
@@ -216,7 +216,7 @@ void CPolyLine::Start( LAYER_NUM layer, int x, int y, int hatch )
CPolyPt
poly_pt
(
x
,
y
);
poly_pt
.
end_contour
=
false
;
m_CornersList
.
push_back
(
poly_pt
);
m_CornersList
.
Append
(
poly_pt
);
}
...
...
@@ -229,7 +229,7 @@ void CPolyLine::AppendCorner( int x, int y )
poly_pt
.
end_contour
=
false
;
// add entries for new corner
m_CornersList
.
push_back
(
poly_pt
);
m_CornersList
.
Append
(
poly_pt
);
}
// move corner of polyline
...
...
@@ -535,16 +535,16 @@ void CPolyLine::InsertCorner( int ic, int x, int y )
{
UnHatch
();
if
(
(
unsigned
)
(
ic
)
>=
m_CornersList
.
size
()
)
if
(
(
unsigned
)
(
ic
)
>=
m_CornersList
.
GetCornersCount
()
)
{
m_CornersList
.
push_back
(
CPolyPt
(
x
,
y
)
);
m_CornersList
.
Append
(
CPolyPt
(
x
,
y
)
);
}
else
{
m_CornersList
.
InsertCorner
(
ic
,
CPolyPt
(
x
,
y
)
);
}
if
(
(
unsigned
)
(
ic
+
1
)
<
m_CornersList
.
size
()
)
if
(
(
unsigned
)
(
ic
+
1
)
<
m_CornersList
.
GetCornersCount
()
)
{
if
(
m_CornersList
[
ic
].
end_contour
)
{
...
...
@@ -585,7 +585,7 @@ CRect CPolyLine::GetCornerBounds()
r
.
left
=
r
.
bottom
=
INT_MAX
;
r
.
right
=
r
.
top
=
INT_MIN
;
for
(
unsigned
i
=
0
;
i
<
m_CornersList
.
size
();
i
++
)
for
(
unsigned
i
=
0
;
i
<
m_CornersList
.
GetCornersCount
();
i
++
)
{
r
.
left
=
std
::
min
(
r
.
left
,
m_CornersList
[
i
].
x
);
r
.
right
=
std
::
max
(
r
.
right
,
m_CornersList
[
i
].
x
);
...
...
@@ -618,26 +618,18 @@ CRect CPolyLine::GetCornerBounds( int icont )
}
int
CPolyLine
::
GetNumCorners
()
const
{
return
m_CornersList
.
size
();
}
int
CPolyLine
::
GetContoursCount
()
{
int
ncont
=
0
;
if
(
!
m_CornersList
.
size
()
)
if
(
!
m_CornersList
.
GetCornersCount
()
)
return
0
;
for
(
unsigned
ic
=
0
;
ic
<
m_CornersList
.
size
();
ic
++
)
for
(
unsigned
ic
=
0
;
ic
<
m_CornersList
.
GetCornersCount
();
ic
++
)
if
(
m_CornersList
[
ic
].
end_contour
)
ncont
++
;
if
(
!
m_CornersList
[
m_CornersList
.
size
()
-
1
].
end_contour
)
if
(
!
m_CornersList
[
m_CornersList
.
GetCornersCount
()
-
1
].
end_contour
)
ncont
++
;
return
ncont
;
...
...
@@ -665,7 +657,7 @@ int CPolyLine::GetContourStart( int icont )
int
ncont
=
0
;
for
(
unsigned
i
=
0
;
i
<
m_CornersList
.
size
();
i
++
)
for
(
unsigned
i
=
0
;
i
<
m_CornersList
.
GetCornersCount
();
i
++
)
{
if
(
m_CornersList
[
i
].
end_contour
)
{
...
...
@@ -687,11 +679,11 @@ int CPolyLine::GetContourEnd( int icont )
return
0
;
if
(
icont
==
GetContoursCount
()
-
1
)
return
m_CornersList
.
size
()
-
1
;
return
m_CornersList
.
GetCornersCount
()
-
1
;
int
ncont
=
0
;
for
(
unsigned
i
=
0
;
i
<
m_CornersList
.
size
();
i
++
)
for
(
unsigned
i
=
0
;
i
<
m_CornersList
.
GetCornersCount
();
i
++
)
{
if
(
m_CornersList
[
i
].
end_contour
)
{
...
...
@@ -715,10 +707,10 @@ int CPolyLine::GetContourSize( int icont )
int
CPolyLine
::
GetClosed
()
{
if
(
m_CornersList
.
size
()
==
0
)
if
(
m_CornersList
.
GetCornersCount
()
==
0
)
return
0
;
else
return
m_CornersList
[
m_CornersList
.
size
()
-
1
].
end_contour
;
return
m_CornersList
[
m_CornersList
.
GetCornersCount
()
-
1
].
end_contour
;
}
...
...
@@ -747,7 +739,7 @@ void CPolyLine::Hatch()
int
min_y
=
m_CornersList
[
0
].
y
;
int
max_y
=
m_CornersList
[
0
].
y
;
for
(
unsigned
ic
=
1
;
ic
<
m_CornersList
.
size
();
ic
++
)
for
(
unsigned
ic
=
1
;
ic
<
m_CornersList
.
GetCornersCount
();
ic
++
)
{
if
(
m_CornersList
[
ic
].
x
<
min_x
)
min_x
=
m_CornersList
[
ic
].
x
;
...
...
@@ -798,7 +790,7 @@ void CPolyLine::Hatch()
min_a
+=
offset
;
// now calculate and draw hatch lines
int
nc
=
m_CornersList
.
size
();
int
nc
=
m_CornersList
.
GetCornersCount
();
// loop through hatch lines
#define MAXPTS 200 // Usually we store only few values per one hatch line
...
...
@@ -824,7 +816,8 @@ void CPolyLine::Hatch()
double
x
,
y
,
x2
,
y2
;
int
ok
;
if
(
m_CornersList
[
ic
].
end_contour
||
(
ic
==
(
int
)
(
m_CornersList
.
size
()
-
1
)
)
)
if
(
m_CornersList
[
ic
].
end_contour
||
(
ic
==
(
int
)
(
m_CornersList
.
GetCornersCount
()
-
1
)
)
)
{
ok
=
FindLineSegmentIntersection
(
a
,
slope
,
m_CornersList
[
ic
].
x
,
m_CornersList
[
ic
].
y
,
...
...
@@ -977,7 +970,7 @@ void CPolyLine::MoveOrigin( int x_off, int y_off )
{
UnHatch
();
for
(
int
ic
=
0
;
ic
<
Get
NumCorners
();
ic
++
)
for
(
int
ic
=
0
;
ic
<
Get
CornersCount
();
ic
++
)
{
SetX
(
ic
,
GetX
(
ic
)
+
x_off
);
SetY
(
ic
,
GetY
(
ic
)
+
y_off
);
...
...
@@ -1284,7 +1277,7 @@ void CPOLYGONS_LIST::ImportFrom( KI_POLYGON_SET& aPolygons )
void
ConvertPolysListWithHolesToOnePolygon
(
const
CPOLYGONS_LIST
&
aPolysListWithHoles
,
CPOLYGONS_LIST
&
aOnePolyList
)
{
unsigned
corners_count
=
aPolysListWithHoles
.
size
();
unsigned
corners_count
=
aPolysListWithHoles
.
GetCornersCount
();
int
polycount
=
0
;
for
(
unsigned
ii
=
0
;
ii
<
corners_count
;
ii
++
)
...
...
@@ -1305,7 +1298,7 @@ void ConvertPolysListWithHolesToOnePolygon( const CPOLYGONS_LIST& aPolysListWith
KI_POLYGON_SET
mainpoly
;
KI_POLYGON
poly_tmp
;
std
::
vector
<
KI_POLY_POINT
>
cornerslist
;
corners_count
=
aPolysListWithHoles
.
size
();
corners_count
=
aPolysListWithHoles
.
GetCornersCount
();
unsigned
ic
=
0
;
// enter main outline
...
...
polygon/PolyLine.h
View file @
25545756
...
...
@@ -118,8 +118,6 @@ public:
// vector <> methods
void
reserve
(
int
aSize
)
{
m_cornersList
.
reserve
(
aSize
);
}
void
clear
()
{
m_cornersList
.
clear
();
}
unsigned
size
()
const
{
return
m_cornersList
.
size
();
}
void
push_back
(
const
CPolyPt
&
aItem
)
{
m_cornersList
.
push_back
(
aItem
);
}
CPolyPt
&
back
()
{
return
m_cornersList
.
back
();
}
unsigned
GetCornersCount
()
const
{
return
m_cornersList
.
size
();
}
...
...
@@ -311,7 +309,11 @@ public:
// access functions
void
SetLayer
(
LAYER_NUM
aLayer
)
{
m_layer
=
aLayer
;
}
LAYER_NUM
GetLayer
()
const
{
return
m_layer
;
}
int
GetNumCorners
()
const
;
int
GetCornersCount
()
const
{
return
m_CornersList
.
GetCornersCount
();
}
int
GetClosed
();
int
GetContoursCount
();
int
GetContour
(
int
ic
);
...
...
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