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
1c9433fb
Commit
1c9433fb
authored
Jul 29, 2012
by
Miguel Angel Ajo
Browse files
Options
Browse Files
Download
Plain Diff
merged divertion
parents
a8e4f8b0
99b90d2f
Changes
25
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
1058 additions
and
947 deletions
+1058
-947
3d_draw.cpp
3d-viewer/3d_draw.cpp
+2
-2
lib_arc.cpp
eeschema/lib_arc.cpp
+6
-6
lib_arc.h
eeschema/lib_arc.h
+5
-5
Thumbs.db
pcb_calculator/bitmaps/Thumbs.db
+0
-0
solve.cpp
pcbnew/autorouter/solve.cpp
+2
-2
board_items_to_polygon_shape_transform.cpp
pcbnew/board_items_to_polygon_shape_transform.cpp
+6
-6
class_board.cpp
pcbnew/class_board.cpp
+2
-2
class_track.cpp
pcbnew/class_track.cpp
+1
-1
class_zone.cpp
pcbnew/class_zone.cpp
+25
-25
class_zone.h
pcbnew/class_zone.h
+1
-1
clean.cpp
pcbnew/clean.cpp
+18
-17
editrack.cpp
pcbnew/editrack.cpp
+2
-2
kicad_plugin.cpp
pcbnew/kicad_plugin.cpp
+1
-1
legacy_plugin.cpp
pcbnew/legacy_plugin.cpp
+3
-3
move_or_drag_track.cpp
pcbnew/move_or_drag_track.cpp
+4
-4
pcbnew.h
pcbnew/pcbnew.h
+2
-2
polygons_defs.h
pcbnew/polygons_defs.h
+0
-21
specctra_export.cpp
pcbnew/specctra_export.cpp
+14
-14
zone_filling_algorithm.cpp
pcbnew/zone_filling_algorithm.cpp
+8
-35
zones_convert_brd_items_to_polygons_with_Boost.cpp
pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp
+40
-47
zones_functions_for_undo_redo.cpp
pcbnew/zones_functions_for_undo_redo.cpp
+1
-1
zones_test_and_combine_areas.cpp
pcbnew/zones_test_and_combine_areas.cpp
+53
-111
PolyLine.cpp
polygon/PolyLine.cpp
+677
-501
PolyLine.h
polygon/PolyLine.h
+119
-138
polygons_defs.h
polygon/polygons_defs.h
+66
-0
No files found.
3d-viewer/3d_draw.cpp
View file @
1c9433fb
...
...
@@ -305,7 +305,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
{
CPolyPt
*
endcorner
=
&
polysList
[
ic
];
if
(
begincorner
->
utility
==
0
)
if
(
begincorner
->
m_
utility
==
0
)
{
// Draw only basic outlines, not extra segments
dummysegment
.
m_Start
.
x
=
begincorner
->
x
;
...
...
@@ -318,7 +318,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
if
(
(
endcorner
->
end_contour
)
||
(
ic
==
imax
)
)
{
// the last corner of a filled area is found: draw it
if
(
endcorner
->
utility
==
0
)
if
(
endcorner
->
m_
utility
==
0
)
{
// Draw only basic outlines, not extra segments
dummysegment
.
m_Start
.
x
=
endcorner
->
x
;
...
...
eeschema/lib_arc.cpp
View file @
1c9433fb
...
...
@@ -561,15 +561,15 @@ void LIB_ARC::BeginEdit( int aEditMode, const wxPoint aPosition )
// Drag either the start, end point or the outline
if
(
HitTestPoints
(
m_ArcStart
,
aPosition
,
MINIMUM_SELECTION_DISTANCE
)
)
{
m_editSelectPoint
=
START
;
m_editSelectPoint
=
ARC_STATUS_
START
;
}
else
if
(
HitTestPoints
(
m_ArcEnd
,
aPosition
,
MINIMUM_SELECTION_DISTANCE
)
)
{
m_editSelectPoint
=
END
;
m_editSelectPoint
=
ARC_STATUS_
END
;
}
else
{
m_editSelectPoint
=
OUTLINE
;
m_editSelectPoint
=
ARC_STATUS_
OUTLINE
;
}
m_editState
=
0
;
...
...
@@ -619,12 +619,12 @@ void LIB_ARC::calcEdit( const wxPoint& aPosition )
wxPoint
newCenterPoint
,
startPos
,
endPos
;
// Choose the point of the arc to be adjusted
if
(
m_editSelectPoint
==
START
)
if
(
m_editSelectPoint
==
ARC_STATUS_
START
)
{
startPos
=
aPosition
;
endPos
=
m_ArcEnd
;
}
else
if
(
m_editSelectPoint
==
END
)
else
if
(
m_editSelectPoint
==
ARC_STATUS_
END
)
{
endPos
=
aPosition
;
startPos
=
m_ArcStart
;
...
...
@@ -658,7 +658,7 @@ void LIB_ARC::calcEdit( const wxPoint& aPosition )
newCenterPoint
=
m_Pos
;
}
if
(
m_editSelectPoint
==
START
||
m_editSelectPoint
==
END
)
if
(
m_editSelectPoint
==
ARC_STATUS_START
||
m_editSelectPoint
==
ARC_STATUS_
END
)
{
// Compute the new center point when the start/end points are modified
wxPoint
middlePoint
=
wxPoint
(
(
startPos
.
x
+
endPos
.
x
)
/
2
,
...
...
eeschema/lib_arc.h
View file @
1c9433fb
...
...
@@ -37,15 +37,15 @@ class TRANSFORM;
class
LIB_ARC
:
public
LIB_ITEM
{
enum
SELECT_T
enum
SELECT_T
// When creating an arc: status of arc
{
START
,
END
,
OUTLINE
,
ARC_STATUS_
START
,
ARC_STATUS_
END
,
ARC_STATUS_
OUTLINE
,
};
int
m_Radius
;
int
m_t1
;
/
* First radius angle of the arc in 0.1 degrees. */
int
m_t1
;
/
/ First radius angle of the arc in 0.1 degrees.
int
m_t2
;
/* Second radius angle of the arc in 0.1 degrees. */
wxPoint
m_ArcStart
;
wxPoint
m_ArcEnd
;
/* Arc end position. */
...
...
pcb_calculator/bitmaps/Thumbs.db
deleted
100644 → 0
View file @
a8e4f8b0
File deleted
pcbnew/autorouter/solve.cpp
View file @
1c9433fb
...
...
@@ -1302,12 +1302,12 @@ static void AddNewTrace( PCB_EDIT_FRAME* pcbframe, wxDC* DC )
g_CurrentTrackList
.
PushBack
(
newTrack
);
}
g_FirstTrackSegment
->
start
=
pcbframe
->
GetBoard
()
->
GetPad
(
g_FirstTrackSegment
,
START
);
g_FirstTrackSegment
->
start
=
pcbframe
->
GetBoard
()
->
GetPad
(
g_FirstTrackSegment
,
FLG_
START
);
if
(
g_FirstTrackSegment
->
start
)
g_FirstTrackSegment
->
SetState
(
BEGIN_ONPAD
,
ON
);
g_CurrentTrackSegment
->
end
=
pcbframe
->
GetBoard
()
->
GetPad
(
g_CurrentTrackSegment
,
END
);
g_CurrentTrackSegment
->
end
=
pcbframe
->
GetBoard
()
->
GetPad
(
g_CurrentTrackSegment
,
FLG_
END
);
if
(
g_CurrentTrackSegment
->
end
)
g_CurrentTrackSegment
->
SetState
(
END_ONPAD
,
ON
);
...
...
pcbnew/board_items_to_polygon_shape_transform.cpp
View file @
1c9433fb
...
...
@@ -167,19 +167,19 @@ void ZONE_CONTAINER::TransformShapeWithClearanceToPolygon( std::vector <CPolyPt>
// Calculate the polygon with clearance and holes
// holes are linked to the main outline, so only one polygon should be created.
K
PolygonSet
polyset_zone_solid_areas
;
std
::
vector
<
K
PolyPoint
>
cornerslist
;
K
I_POLYGON_SET
polyset_zone_solid_areas
;
std
::
vector
<
K
I_POLY_POINT
>
cornerslist
;
unsigned
ic
=
0
;
unsigned
corners_count
=
zoneOutines
.
size
();
while
(
ic
<
corners_count
)
{
cornerslist
.
clear
();
K
Polygon
poly
;
K
I_POLYGON
poly
;
{
for
(
;
ic
<
corners_count
;
ic
++
)
{
CPolyPt
*
corner
=
&
zoneOutines
[
ic
];
cornerslist
.
push_back
(
K
PolyPoint
(
corner
->
x
,
corner
->
y
)
);
cornerslist
.
push_back
(
K
I_POLY_POINT
(
corner
->
x
,
corner
->
y
)
);
if
(
corner
->
end_contour
)
{
ic
++
;
...
...
@@ -197,12 +197,12 @@ void ZONE_CONTAINER::TransformShapeWithClearanceToPolygon( std::vector <CPolyPt>
// Put the resultng polygon in buffer
for
(
unsigned
ii
=
0
;
ii
<
polyset_zone_solid_areas
.
size
();
ii
++
)
{
K
Polygon
&
poly
=
polyset_zone_solid_areas
[
ii
];
K
I_POLYGON
&
poly
=
polyset_zone_solid_areas
[
ii
];
CPolyPt
corner
(
0
,
0
,
false
);
for
(
unsigned
jj
=
0
;
jj
<
poly
.
size
();
jj
++
)
{
K
PolyPoint
point
=
*
(
poly
.
begin
()
+
jj
);
K
I_POLY_POINT
point
=
*
(
poly
.
begin
()
+
jj
);
corner
.
x
=
point
.
x
();
corner
.
y
=
point
.
y
();
corner
.
end_contour
=
false
;
...
...
pcbnew/class_board.cpp
View file @
1c9433fb
...
...
@@ -1681,7 +1681,7 @@ D_PAD* BOARD::GetPad( TRACK* aTrace, int aEndPoint )
int
aLayerMask
=
GetLayerMask
(
aTrace
->
GetLayer
()
);
if
(
aEndPoint
==
START
)
if
(
aEndPoint
==
FLG_
START
)
{
aPosition
=
aTrace
->
m_Start
;
}
...
...
@@ -2271,7 +2271,7 @@ TRACK* BOARD::CreateLockPoint( wxPoint& aPosition, TRACK* aSegment, PICKED_ITEMS
aSegment
->
end
=
newTrack
;
aSegment
->
SetState
(
END_ONPAD
,
OFF
);
D_PAD
*
pad
=
GetPad
(
newTrack
,
START
);
D_PAD
*
pad
=
GetPad
(
newTrack
,
FLG_
START
);
if
(
pad
)
{
...
...
pcbnew/class_track.cpp
View file @
1c9433fb
...
...
@@ -1282,7 +1282,7 @@ TRACK* TRACK::GetTrace( TRACK* aStartTrace, TRACK* aEndTrace, int aEndPoint )
int
ii
;
int
max_dist
;
if
(
aEndPoint
==
START
)
if
(
aEndPoint
==
FLG_
START
)
position
=
m_Start
;
else
position
=
m_End
;
...
...
pcbnew/class_zone.cpp
View file @
1c9433fb
...
...
@@ -210,7 +210,7 @@ void ZONE_CONTAINER::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int aDrawMode, const
{
seg_start
=
GetCornerPosition
(
ic
)
+
offset
;
if
(
m_Poly
->
corner
[
ic
].
end_contour
==
false
&&
ic
<
GetNumCorners
()
-
1
)
if
(
m_Poly
->
m_CornersList
[
ic
].
end_contour
==
false
&&
ic
<
GetNumCorners
()
-
1
)
{
seg_end
=
GetCornerPosition
(
ic
+
1
)
+
offset
;
}
...
...
@@ -306,7 +306,7 @@ void ZONE_CONTAINER::DrawFilledArea( EDA_DRAW_PANEL* panel,
CornersBuffer
.
push_back
(
coord
);
CornersTypeBuffer
.
push_back
(
(
char
)
corner
->
utility
);
CornersTypeBuffer
.
push_back
(
(
char
)
corner
->
m_
utility
);
if
(
(
corner
->
end_contour
)
||
(
ic
==
imax
)
)
// the last corner of a filled area is found: draw it
{
...
...
@@ -432,13 +432,13 @@ void ZONE_CONTAINER::DrawWhileCreateOutline( EDA_DRAW_PANEL* panel, wxDC* DC, in
int
yi
=
GetCornerPosition
(
ic
).
y
;
int
xf
,
yf
;
if
(
m_Poly
->
corner
[
ic
].
end_contour
==
false
&&
ic
<
icmax
)
if
(
m_Poly
->
m_CornersList
[
ic
].
end_contour
==
false
&&
ic
<
icmax
)
{
is_close_segment
=
false
;
xf
=
GetCornerPosition
(
ic
+
1
).
x
;
yf
=
GetCornerPosition
(
ic
+
1
).
y
;
if
(
(
m_Poly
->
corner
[
ic
+
1
].
end_contour
)
||
(
ic
==
icmax
-
1
)
)
if
(
(
m_Poly
->
m_CornersList
[
ic
+
1
].
end_contour
)
||
(
ic
==
icmax
-
1
)
)
current_gr_mode
=
GR_XOR
;
else
current_gr_mode
=
draw_mode
;
...
...
@@ -507,12 +507,12 @@ bool ZONE_CONTAINER::HitTestForCorner( const wxPoint& refPos )
int
min_dist
=
MIN_DIST_IN_MILS
*
IU_PER_MILS
;
wxPoint
delta
;
unsigned
lim
=
m_Poly
->
corner
.
size
();
unsigned
lim
=
m_Poly
->
m_CornersList
.
size
();
for
(
unsigned
item_pos
=
0
;
item_pos
<
lim
;
item_pos
++
)
{
delta
.
x
=
refPos
.
x
-
m_Poly
->
corner
[
item_pos
].
x
;
delta
.
y
=
refPos
.
y
-
m_Poly
->
corner
[
item_pos
].
y
;
delta
.
x
=
refPos
.
x
-
m_Poly
->
m_CornersList
[
item_pos
].
x
;
delta
.
y
=
refPos
.
y
-
m_Poly
->
m_CornersList
[
item_pos
].
y
;
// Calculate a distance:
int
dist
=
MAX
(
abs
(
delta
.
x
),
abs
(
delta
.
y
)
);
...
...
@@ -530,7 +530,7 @@ bool ZONE_CONTAINER::HitTestForCorner( const wxPoint& refPos )
bool
ZONE_CONTAINER
::
HitTestForEdge
(
const
wxPoint
&
refPos
)
{
unsigned
lim
=
m_Poly
->
corner
.
size
();
unsigned
lim
=
m_Poly
->
m_CornersList
.
size
();
m_CornerSelection
=
-
1
;
// Set to not found
...
...
@@ -547,7 +547,7 @@ bool ZONE_CONTAINER::HitTestForEdge( const wxPoint& refPos )
* the last segment of the current outline starts at current corner, and ends
* at the first corner of the outline
*/
if
(
m_Poly
->
corner
[
item_pos
].
end_contour
||
end_segm
>=
lim
)
if
(
m_Poly
->
m_CornersList
[
item_pos
].
end_contour
||
end_segm
>=
lim
)
{
unsigned
tmp
=
first_corner_pos
;
first_corner_pos
=
end_segm
;
// first_corner_pos is now the beginning of the next outline
...
...
@@ -557,10 +557,10 @@ bool ZONE_CONTAINER::HitTestForEdge( const wxPoint& refPos )
/* test the dist between segment and ref point */
int
dist
=
(
int
)
GetPointToLineSegmentDistance
(
refPos
.
x
,
refPos
.
y
,
m_Poly
->
corner
[
item_pos
].
x
,
m_Poly
->
corner
[
item_pos
].
y
,
m_Poly
->
corner
[
end_segm
].
x
,
m_Poly
->
corner
[
end_segm
].
y
);
m_Poly
->
m_CornersList
[
item_pos
].
x
,
m_Poly
->
m_CornersList
[
item_pos
].
y
,
m_Poly
->
m_CornersList
[
end_segm
].
x
,
m_Poly
->
m_CornersList
[
end_segm
].
y
);
if
(
dist
<
min_dist
)
{
...
...
@@ -703,7 +703,7 @@ void ZONE_CONTAINER::DisplayInfo( EDA_DRAW_FRAME* frame )
msg
=
board
->
GetLayerName
(
m_Layer
);
frame
->
AppendMsgPanel
(
_
(
"Layer"
),
msg
,
BROWN
);
msg
.
Printf
(
wxT
(
"%d"
),
(
int
)
m_Poly
->
corner
.
size
()
);
msg
.
Printf
(
wxT
(
"%d"
),
(
int
)
m_Poly
->
m_CornersList
.
size
()
);
frame
->
AppendMsgPanel
(
_
(
"Corners"
),
msg
,
BLUE
);
if
(
m_FillMode
)
...
...
@@ -730,7 +730,7 @@ void ZONE_CONTAINER::DisplayInfo( EDA_DRAW_FRAME* frame )
void
ZONE_CONTAINER
::
Move
(
const
wxPoint
&
offset
)
{
/* move outlines */
for
(
unsigned
ii
=
0
;
ii
<
m_Poly
->
corner
.
size
();
ii
++
)
for
(
unsigned
ii
=
0
;
ii
<
m_Poly
->
m_CornersList
.
size
();
ii
++
)
{
SetCornerPosition
(
ii
,
GetCornerPosition
(
ii
)
+
offset
);
}
...
...
@@ -761,7 +761,7 @@ void ZONE_CONTAINER::MoveEdge( const wxPoint& offset )
SetCornerPosition
(
ii
,
GetCornerPosition
(
ii
)
+
offset
);
// Move the end point of the selected edge:
if
(
m_Poly
->
corner
[
ii
].
end_contour
||
ii
==
GetNumCorners
()
-
1
)
if
(
m_Poly
->
m_CornersList
[
ii
].
end_contour
||
ii
==
GetNumCorners
()
-
1
)
{
int
icont
=
m_Poly
->
GetContour
(
ii
);
ii
=
m_Poly
->
GetContourStart
(
icont
);
...
...
@@ -781,13 +781,13 @@ void ZONE_CONTAINER::Rotate( const wxPoint& centre, double angle )
{
wxPoint
pos
;
for
(
unsigned
ii
=
0
;
ii
<
m_Poly
->
corner
.
size
();
ii
++
)
for
(
unsigned
ii
=
0
;
ii
<
m_Poly
->
m_CornersList
.
size
();
ii
++
)
{
pos
.
x
=
m_Poly
->
corner
[
ii
].
x
;
pos
.
y
=
m_Poly
->
corner
[
ii
].
y
;
pos
.
x
=
m_Poly
->
m_CornersList
[
ii
].
x
;
pos
.
y
=
m_Poly
->
m_CornersList
[
ii
].
y
;
RotatePoint
(
&
pos
,
centre
,
angle
);
m_Poly
->
corner
[
ii
].
x
=
pos
.
x
;
m_Poly
->
corner
[
ii
].
y
=
pos
.
y
;
m_Poly
->
m_CornersList
[
ii
].
x
=
pos
.
x
;
m_Poly
->
m_CornersList
[
ii
].
y
=
pos
.
y
;
}
m_Poly
->
Hatch
();
...
...
@@ -820,11 +820,11 @@ void ZONE_CONTAINER::Flip( const wxPoint& aCentre )
void
ZONE_CONTAINER
::
Mirror
(
const
wxPoint
&
mirror_ref
)
{
for
(
unsigned
ii
=
0
;
ii
<
m_Poly
->
corner
.
size
();
ii
++
)
for
(
unsigned
ii
=
0
;
ii
<
m_Poly
->
m_CornersList
.
size
();
ii
++
)
{
m_Poly
->
corner
[
ii
].
y
-=
mirror_ref
.
y
;
NEGATE
(
m_Poly
->
corner
[
ii
].
y
);
m_Poly
->
corner
[
ii
].
y
+=
mirror_ref
.
y
;
m_Poly
->
m_CornersList
[
ii
].
y
-=
mirror_ref
.
y
;
NEGATE
(
m_Poly
->
m_CornersList
[
ii
].
y
);
m_Poly
->
m_CornersList
[
ii
].
y
+=
mirror_ref
.
y
;
}
m_Poly
->
Hatch
();
...
...
pcbnew/class_zone.h
View file @
1c9433fb
...
...
@@ -613,7 +613,7 @@ private:
/* set of filled polygons used to draw a zone as a filled area.
* from outlines (m_Poly) but unlike m_Poly these filled polygons have no hole
* (they are
*
all in one piece) In very simple cases m_FilledPolysList is same
* (they are all in one piece) In very simple cases m_FilledPolysList is same
* as m_Poly. In less simple cases (when m_Poly has holes) m_FilledPolysList is
* a polygon equivalent to m_Poly, without holes but with extra outline segment
* connecting "holes" with external main outline. In complex cases an outline
...
...
pcbnew/clean.cpp
View file @
1c9433fb
...
...
@@ -272,7 +272,7 @@ static void DeleteUnconnectedTracks( PCB_EDIT_FRAME* aFrame )
if
(
(
type_end
&
START_ON_PAD
)
==
0
)
{
other
=
segment
->
GetTrace
(
aFrame
->
GetBoard
()
->
m_Track
,
NULL
,
START
);
other
=
segment
->
GetTrace
(
aFrame
->
GetBoard
()
->
m_Track
,
NULL
,
FLG_
START
);
if
(
other
==
NULL
)
// Test a connection to zones
{
...
...
@@ -306,7 +306,7 @@ static void DeleteUnconnectedTracks( PCB_EDIT_FRAME* aFrame )
segment
->
SetState
(
BUSY
,
ON
);
SEGVIA
*
via
=
(
SEGVIA
*
)
other
;
other
=
via
->
GetTrace
(
aFrame
->
GetBoard
()
->
m_Track
,
NULL
,
START
);
other
=
via
->
GetTrace
(
aFrame
->
GetBoard
()
->
m_Track
,
NULL
,
FLG_
START
);
if
(
other
==
NULL
)
{
...
...
@@ -327,7 +327,7 @@ static void DeleteUnconnectedTracks( PCB_EDIT_FRAME* aFrame )
// if not connected to a pad, test if segment's END is connected to another track
if
(
(
type_end
&
END_ON_PAD
)
==
0
)
{
other
=
segment
->
GetTrace
(
aFrame
->
GetBoard
()
->
m_Track
,
NULL
,
END
);
other
=
segment
->
GetTrace
(
aFrame
->
GetBoard
()
->
m_Track
,
NULL
,
FLG_
END
);
if
(
other
==
NULL
)
// Test a connection to zones
{
...
...
@@ -362,7 +362,7 @@ static void DeleteUnconnectedTracks( PCB_EDIT_FRAME* aFrame )
segment
->
SetState
(
BUSY
,
ON
);
SEGVIA
*
via
=
(
SEGVIA
*
)
other
;
other
=
via
->
GetTrace
(
aFrame
->
GetBoard
()
->
m_Track
,
NULL
,
END
);
other
=
via
->
GetTrace
(
aFrame
->
GetBoard
()
->
m_Track
,
NULL
,
FLG_
END
);
if
(
other
==
NULL
)
{
...
...
@@ -486,7 +486,7 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame )
// search for a possible point that connects on the START point of the segment
for
(
segStart
=
segment
->
Next
();
;
)
{
segStart
=
segment
->
GetTrace
(
segStart
,
NULL
,
START
);
segStart
=
segment
->
GetTrace
(
segStart
,
NULL
,
FLG_
START
);
if
(
segStart
)
{
...
...
@@ -500,7 +500,7 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame )
// We must have only one segment connected
segStart
->
SetState
(
BUSY
,
ON
);
other
=
segment
->
GetTrace
(
aFrame
->
GetBoard
()
->
m_Track
,
NULL
,
START
);
other
=
segment
->
GetTrace
(
aFrame
->
GetBoard
()
->
m_Track
,
NULL
,
FLG_
START
);
segStart
->
SetState
(
BUSY
,
OFF
);
if
(
other
==
NULL
)
...
...
@@ -514,7 +514,7 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame )
if
(
flag
)
// We have the starting point of the segment is connected to an other segment
{
segDelete
=
MergeColinearSegmentIfPossible
(
aFrame
->
GetBoard
(),
segment
,
segStart
,
START
);
FLG_
START
);
if
(
segDelete
)
{
...
...
@@ -526,7 +526,7 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame )
// search for a possible point that connects on the END point of the segment:
for
(
segEnd
=
segment
->
Next
();
;
)
{
segEnd
=
segment
->
GetTrace
(
segEnd
,
NULL
,
END
);
segEnd
=
segment
->
GetTrace
(
segEnd
,
NULL
,
FLG_
END
);
if
(
segEnd
)
{
...
...
@@ -538,7 +538,7 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame )
// We must have only one segment connected
segEnd
->
SetState
(
BUSY
,
ON
);
other
=
segment
->
GetTrace
(
aFrame
->
GetBoard
()
->
m_Track
,
NULL
,
END
);
other
=
segment
->
GetTrace
(
aFrame
->
GetBoard
()
->
m_Track
,
NULL
,
FLG_
END
);
segEnd
->
SetState
(
BUSY
,
OFF
);
if
(
other
==
NULL
)
...
...
@@ -554,7 +554,8 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame )
if
(
flag
&
2
)
// We have the ending point of the segment is connected to an other segment
{
segDelete
=
MergeColinearSegmentIfPossible
(
aFrame
->
GetBoard
(),
segment
,
segEnd
,
END
);
segDelete
=
MergeColinearSegmentIfPossible
(
aFrame
->
GetBoard
(),
segment
,
segEnd
,
FLG_END
);
if
(
segDelete
)
{
...
...
@@ -643,7 +644,7 @@ TRACK* MergeColinearSegmentIfPossible( BOARD* aPcb, TRACK* aTrackRef, TRACK* aCa
* (this function) is called when there is only 2 connected segments,
*and if this point is not on a pad, it can be removed and the 2 segments will be merged
*/
if
(
aEndType
==
START
)
if
(
aEndType
==
FLG_
START
)
{
// We must not have a pad, which is a always terminal point for a track
if
(
aPcb
->
GetPadFast
(
aTrackRef
->
m_Start
,
aTrackRef
->
ReturnMaskLayer
()
)
)
...
...
@@ -712,7 +713,7 @@ bool PCB_EDIT_FRAME::RemoveMisConnectedTracks()
}
else
{
other
=
segment
->
GetTrace
(
GetBoard
()
->
m_Track
,
NULL
,
START
);
other
=
segment
->
GetTrace
(
GetBoard
()
->
m_Track
,
NULL
,
FLG_
START
);
if
(
other
)
net_code_s
=
other
->
GetNet
();
...
...
@@ -730,7 +731,7 @@ bool PCB_EDIT_FRAME::RemoveMisConnectedTracks()
}
else
{
other
=
segment
->
GetTrace
(
GetBoard
()
->
m_Track
,
NULL
,
END
);
other
=
segment
->
GetTrace
(
GetBoard
()
->
m_Track
,
NULL
,
FLG_
END
);
if
(
other
)
net_code_e
=
other
->
GetNet
();
...
...
@@ -871,14 +872,14 @@ void ConnectDanglingEndToPad( PCB_EDIT_FRAME* aFrame )
if
(
aFrame
->
GetCanvas
()
->
GetAbortRequest
()
)
return
;
pad
=
aFrame
->
GetBoard
()
->
GetPad
(
segment
,
START
);
pad
=
aFrame
->
GetBoard
()
->
GetPad
(
segment
,
FLG_
START
);
if
(
pad
)
{
// test if the track start point is not exactly starting on the pad
if
(
segment
->
m_Start
!=
pad
->
GetPosition
()
)
{
if
(
segment
->
GetTrace
(
aFrame
->
GetBoard
()
->
m_Track
,
NULL
,
START
)
==
NULL
)
if
(
segment
->
GetTrace
(
aFrame
->
GetBoard
()
->
m_Track
,
NULL
,
FLG_
START
)
==
NULL
)
{
TRACK
*
newTrack
=
(
TRACK
*
)
segment
->
Clone
();
...
...
@@ -893,14 +894,14 @@ void ConnectDanglingEndToPad( PCB_EDIT_FRAME* aFrame )
}
}
pad
=
aFrame
->
GetBoard
()
->
GetPad
(
segment
,
END
);
pad
=
aFrame
->
GetBoard
()
->
GetPad
(
segment
,
FLG_
END
);
if
(
pad
)
{
// test if the track end point is not exactly on the pad
if
(
segment
->
m_End
!=
pad
->
GetPosition
()
)
{
if
(
segment
->
GetTrace
(
aFrame
->
GetBoard
()
->
m_Track
,
NULL
,
END
)
==
NULL
)
if
(
segment
->
GetTrace
(
aFrame
->
GetBoard
()
->
m_Track
,
NULL
,
FLG_
END
)
==
NULL
)
{
TRACK
*
newTrack
=
(
TRACK
*
)
segment
->
Clone
();
...
...
pcbnew/editrack.cpp
View file @
1c9433fb
...
...
@@ -263,7 +263,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC )
newTrack
->
SetState
(
BEGIN_ONPAD
|
END_ONPAD
,
OFF
);
D_PAD
*
pad
=
GetBoard
()
->
GetPad
(
previousTrack
,
END
);
D_PAD
*
pad
=
GetBoard
()
->
GetPad
(
previousTrack
,
FLG_
END
);
if
(
pad
)
{
...
...
@@ -1042,7 +1042,7 @@ void DeleteNullTrackSegments( BOARD* pcb, DLIST<TRACK>& aTrackList )
while
(
track
!=
NULL
)
{
TRACK
*
next_track
=
track
->
Next
();
LockPoint
=
pcb
->
GetPad
(
track
,
END
);
LockPoint
=
pcb
->
GetPad
(
track
,
FLG_
END
);
if
(
LockPoint
)
{
...
...
pcbnew/kicad_plugin.cpp
View file @
1c9433fb
...
...
@@ -1059,7 +1059,7 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const
m_out
->
Print
(
0
,
")
\n
"
);
const
std
::
vector
<
CPolyPt
>&
cv
=
aZone
->
m_Poly
->
corner
;
const
std
::
vector
<
CPolyPt
>&
cv
=
aZone
->
m_Poly
->
m_CornersList
;
int
newLine
=
0
;
if
(
cv
.
size
()
)
...
...
pcbnew/legacy_plugin.cpp
View file @
1c9433fb
...
...
@@ -3609,7 +3609,7 @@ void LEGACY_PLUGIN::saveZONE_CONTAINER( const ZONE_CONTAINER* me ) const
typedef
std
::
vector
<
CPolyPt
>
CPOLY_PTS
;
// Save the corner list
const
CPOLY_PTS
&
cv
=
me
->
m_Poly
->
corner
;
const
CPOLY_PTS
&
cv
=
me
->
m_Poly
->
m_CornersList
;
for
(
CPOLY_PTS
::
const_iterator
it
=
cv
.
begin
();
it
!=
cv
.
end
();
++
it
)
{
fprintf
(
m_fp
,
"ZCorner %s %d
\n
"
,
...
...
@@ -3623,12 +3623,12 @@ void LEGACY_PLUGIN::saveZONE_CONTAINER( const ZONE_CONTAINER* me ) const
{
fprintf
(
m_fp
,
"$POLYSCORNERS
\n
"
);
for
(
CPOLY_PTS
::
const_iterator
it
=
fv
.
begin
();
it
!=
fv
.
end
();
++
it
)
for
(
CPOLY_PTS
::
const_iterator
it
=
fv
.
begin
();
it
!=
fv
.
end
();
++
it
)
{
fprintf
(
m_fp
,
"%s %d %d
\n
"
,
fmtBIUPair
(
it
->
x
,
it
->
y
).
c_str
(),
it
->
end_contour
,
it
->
utility
);
it
->
m_
utility
);
}
fprintf
(
m_fp
,
"$endPOLYSCORNERS
\n
"
);
...
...
pcbnew/move_or_drag_track.cpp
View file @
1c9433fb
...
...
@@ -887,7 +887,7 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
s_StartSegmentPresent
=
s_EndSegmentPresent
=
true
;
if
(
(
track
->
start
==
NULL
)
||
(
track
->
start
->
Type
()
==
PCB_TRACE_T
)
)
TrackToStartPoint
=
track
->
GetTrace
(
GetBoard
()
->
m_Track
,
NULL
,
START
);
TrackToStartPoint
=
track
->
GetTrace
(
GetBoard
()
->
m_Track
,
NULL
,
FLG_
START
);
// Test if more than one segment is connected to this point
if
(
TrackToStartPoint
)
...
...
@@ -895,14 +895,14 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
TrackToStartPoint
->
SetState
(
BUSY
,
ON
);
if
(
(
TrackToStartPoint
->
Type
()
==
PCB_VIA_T
)
||
track
->
GetTrace
(
GetBoard
()
->
m_Track
,
NULL
,
START
)
)
||
track
->
GetTrace
(
GetBoard
()
->
m_Track
,
NULL
,
FLG_
START
)
)
error
=
true
;
TrackToStartPoint
->
SetState
(
BUSY
,
OFF
);
}
if
(
(
track
->
end
==
NULL
)
||
(
track
->
end
->
Type
()
==
PCB_TRACE_T
)
)
TrackToEndPoint
=
track
->
GetTrace
(
GetBoard
()
->
m_Track
,
NULL
,
END
);
TrackToEndPoint
=
track
->
GetTrace
(
GetBoard
()
->
m_Track
,
NULL
,
FLG_
END
);
// Test if more than one segment is connected to this point
if
(
TrackToEndPoint
)
...
...
@@ -910,7 +910,7 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
TrackToEndPoint
->
SetState
(
BUSY
,
ON
);
if
(
(
TrackToEndPoint
->
Type
()
==
PCB_VIA_T
)
||
track
->
GetTrace
(
GetBoard
()
->
m_Track
,
NULL
,
END
)
)
||
track
->
GetTrace
(
GetBoard
()
->
m_Track
,
NULL
,
FLG_
END
)
)
error
=
true
;
TrackToEndPoint
->
SetState
(
BUSY
,
OFF
);
...
...
pcbnew/pcbnew.h
View file @
1c9433fb
...
...
@@ -25,8 +25,8 @@
#define VISIBLE_ONLY (1 << 3) ///< if module not on a visible layer, do not select
#define
START 0
/* Flag used in locate routines */
#define
END 1
#define
FLG_START 0 // Flag used in locate routines
#define
FLG_END 1 // Flag used in locate routines
#define DIM_ANCRE_MODULE 3
/* Anchor size (footprint center) */
#define DIM_ANCRE_TEXTE 2
/* Anchor size (Text center) */
...
...
pcbnew/polygons_defs.h
deleted
100644 → 0
View file @
a8e4f8b0
/*
* file polygons_defs.h
* definitions to use boost::polygon in KiCad.
*/
#ifndef _POLYGONS_DEFS_H_
#define _POLYGONS_DEFS_H_
#include <boost/polygon/polygon.hpp>
// Define some types used here from boost::polygon
namespace
bpl
=
boost
::
polygon
;
// bpl = boost polygon library
using
namespace
bpl
::
operators
;
// +, -, =, ...
typedef
int
coordinate_type
;
typedef
bpl
::
polygon_data
<
int
>
KPolygon
;
typedef
std
::
vector
<
KPolygon
>
KPolygonSet
;
typedef
bpl
::
point_data
<
int
>
KPolyPoint
;
#endif // #ifndef _POLYGONS_DEFS_H_
pcbnew/specctra_export.cpp
View file @
1c9433fb
...
...
@@ -1178,16 +1178,16 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IO_ERROR )
mainPolygon
->
layer_id
=
layerIds
[
kicadLayer2pcb
[
item
->
GetLayer
()
]
];
int
count
=
item
->
m_Poly
->
corner
.
size
();
int
count
=
item
->
m_Poly
->
m_CornersList
.
size
();
int
ndx
=
0
;
// used in 2 for() loops below
for
(
;
ndx
<
count
;
++
ndx
)
{
wxPoint
point
(
item
->
m_Poly
->
corner
[
ndx
].
x
,
item
->
m_Poly
->
corner
[
ndx
].
y
);
wxPoint
point
(
item
->
m_Poly
->
m_CornersList
[
ndx
].
x
,
item
->
m_Poly
->
m_CornersList
[
ndx
].
y
);
mainPolygon
->
AppendPoint
(
mapPt
(
point
)
);
// this was the end of the main polygon
if
(
item
->
m_Poly
->
corner
[
ndx
].
end_contour
)
if
(
item
->
m_Poly
->
m_CornersList
[
ndx
].
end_contour
)
break
;
}
...
...
@@ -1197,7 +1197,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IO_ERROR )
// handle the cutouts
for
(
++
ndx
;
ndx
<
count
;
++
ndx
)
{
if
(
item
->
m_Poly
->
corner
[
ndx
-
1
].
end_contour
)
if
(
item
->
m_Poly
->
m_CornersList
[
ndx
-
1
].
end_contour
)
{
window
=
new
WINDOW
(
plane
);
plane
->
AddWindow
(
window
);
...
...
@@ -1211,8 +1211,8 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IO_ERROR )
wxASSERT
(
window
);
wxASSERT
(
cutout
);
wxPoint
point
(
item
->
m_Poly
->
corner
[
ndx
].
x
,
item
->
m_Poly
->
corner
[
ndx
].
y
);
wxPoint
point
(
item
->
m_Poly
->
m_CornersList
[
ndx
].
x
,
item
->
m_Poly
->
m_CornersList
[
ndx
].
y
);
cutout
->
AppendPoint
(
mapPt
(
point
)
);
}
}
...
...
@@ -1253,16 +1253,16 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IO_ERROR )
mainPolygon
->
layer_id
=
layerIds
[
kicadLayer2pcb
[
item
->
GetLayer
()
]
];
int
count
=
item
->
m_Poly
->
corner
.
size
();
int
count
=
item
->
m_Poly
->
m_CornersList
.
size
();
int
ndx
=
0
;
// used in 2 for() loops below
for
(
;
ndx
<
count
;
++
ndx
)
{
wxPoint
point
(
item
->
m_Poly
->
corner
[
ndx
].
x
,
item
->
m_Poly
->
corner
[
ndx
].
y
);
wxPoint
point
(
item
->
m_Poly
->
m_CornersList
[
ndx
].
x
,
item
->
m_Poly
->
m_CornersList
[
ndx
].
y
);
mainPolygon
->
AppendPoint
(
mapPt
(
point
)
);
// this was the end of the main polygon
if
(
item
->
m_Poly
->
corner
[
ndx
].
end_contour
)
if
(
item
->
m_Poly
->
m_CornersList
[
ndx
].
end_contour
)
break
;
}
...
...
@@ -1272,7 +1272,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IO_ERROR )
// handle the cutouts
for
(
++
ndx
;
ndx
<
count
;
++
ndx
)
{
if
(
item
->
m_Poly
->
corner
[
ndx
-
1
].
end_contour
)
if
(
item
->
m_Poly
->
m_CornersList
[
ndx
-
1
].
end_contour
)
{
window
=
new
WINDOW
(
keepout
);
keepout
->
AddWindow
(
window
);
...
...
@@ -1286,8 +1286,8 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IO_ERROR )
wxASSERT
(
window
);
wxASSERT
(
cutout
);
wxPoint
point
(
item
->
m_Poly
->
corner
[
ndx
].
x
,
item
->
m_Poly
->
corner
[
ndx
].
y
);
wxPoint
point
(
item
->
m_Poly
->
m_CornersList
[
ndx
].
x
,
item
->
m_Poly
->
m_CornersList
[
ndx
].
y
);
cutout
->
AppendPoint
(
mapPt
(
point
)
);
}
}
...
...
pcbnew/zone_filling_algorithm.cpp
View file @
1c9433fb
...
...
@@ -89,39 +89,12 @@ int ZONE_CONTAINER::BuildFilledPolysListData( BOARD* aPcb, std::vector <CPolyPt>
break
;
}
m_smoothedPoly
->
MakeKboolPoly
(
-
1
,
-
1
,
NULL
,
true
);
int
count
=
0
;
while
(
m_smoothedPoly
->
GetKboolEngine
()
->
StartPolygonGet
()
)
{
CPolyPt
corner
(
0
,
0
,
false
);
while
(
m_smoothedPoly
->
GetKboolEngine
()
->
PolygonHasMorePoints
()
)
{
corner
.
x
=
(
int
)
m_smoothedPoly
->
GetKboolEngine
()
->
GetPolygonXPoint
();
corner
.
y
=
(
int
)
m_smoothedPoly
->
GetKboolEngine
()
->
GetPolygonYPoint
();
corner
.
end_contour
=
false
;
if
(
aCornerBuffer
)
aCornerBuffer
->
push_back
(
corner
);
else
m_FilledPolysList
.
push_back
(
corner
);
count
++
;
}
corner
.
end_contour
=
true
;
if
(
aCornerBuffer
)
{
aCornerBuffer
->
pop_back
();
aCornerBuffer
->
push_back
(
corner
);
}
else
{
m_FilledPolysList
.
pop_back
();
m_FilledPolysList
.
push_back
(
corner
);
}
m_smoothedPoly
->
GetKboolEngine
()
->
EndPolygonGet
();
}
m_smoothedPoly
->
FreeKboolEngine
();
if
(
aCornerBuffer
)
ConvertPolysListWithHolesToOnePolygon
(
m_smoothedPoly
->
m_CornersList
,
*
aCornerBuffer
);
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
*/
...
...
@@ -134,7 +107,7 @@ int ZONE_CONTAINER::BuildFilledPolysListData( BOARD* aPcb, std::vector <CPolyPt>
Fill_Zone_Areas_With_Segments
(
);
}
return
count
;
return
1
;
}
// Sort function to build filled zones
...
...
@@ -188,7 +161,7 @@ int ZONE_CONTAINER::Fill_Zone_Areas_With_Segments()
x_coordinates
.
clear
();
for
(
ics
=
istart
,
ice
=
iend
;
ics
<=
iend
;
ice
=
ics
,
ics
++
)
{
if
(
m_FilledPolysList
[
ice
].
utility
)
if
(
m_FilledPolysList
[
ice
].
m_
utility
)
continue
;
int
seg_startX
=
m_FilledPolysList
[
ics
].
x
;
int
seg_startY
=
m_FilledPolysList
[
ics
].
y
;
...
...
pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp
View file @
1c9433fb
...
...
@@ -81,14 +81,14 @@ extern void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
int
aThermalRot
);
// Local Functions: helper function to calculate solid areas
static
void
AddPolygonCornersToKPolygonList
(
std
::
vector
<
CPolyPt
>&
aCornersBuffer
,
K
PolygonSet
&
aK
PolyList
);
static
void
AddPolygonCornersToK
i
PolygonList
(
std
::
vector
<
CPolyPt
>&
aCornersBuffer
,
K
I_POLYGON_SET
&
aKi
PolyList
);
static
int
CopyPolygonsFromKPolygonListToFilledPolysList
(
ZONE_CONTAINER
*
aZone
,
K
PolygonSet
&
aK
PolyList
);
static
int
CopyPolygonsFromK
i
PolygonListToFilledPolysList
(
ZONE_CONTAINER
*
aZone
,
K
I_POLYGON_SET
&
aKi
PolyList
);
static
int
CopyPolygonsFromFilledPolysListTo
tK
PolygonList
(
ZONE_CONTAINER
*
aZone
,
K
PolygonSet
&
aK
PolyList
);
static
int
CopyPolygonsFromFilledPolysListTo
Ki
PolygonList
(
ZONE_CONTAINER
*
aZone
,
K
I_POLYGON_SET
&
aKi
PolyList
);
// Local Variables:
...
...
@@ -148,8 +148,8 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
*/
s_Correction
=
1.0
/
cos
(
3.14159265
/
s_CircleToSegmentsCount
);
// This K
PolygonSet
is the area(s) to fill, with m_ZoneMinThickness/2
K
PolygonSet
polyset_zone_solid_areas
;
// This K
I_POLYGON_SET
is the area(s) to fill, with m_ZoneMinThickness/2
K
I_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)
...
...
@@ -160,7 +160,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
* the main polygon is stored in polyset_zone_solid_areas
*/
CopyPolygonsFromFilledPolysListTo
tK
PolygonList
(
this
,
polyset_zone_solid_areas
);
CopyPolygonsFromFilledPolysListTo
Ki
PolygonList
(
this
,
polyset_zone_solid_areas
);
polyset_zone_solid_areas
-=
margin
;
if
(
polyset_zone_solid_areas
.
size
()
==
0
)
...
...
@@ -431,15 +431,15 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
// Calculate now actual solid areas
if
(
cornerBufferPolysToSubstract
.
size
()
>
0
)
{
K
PolygonSet
polyset_holes
;
AddPolygonCornersToKPolygonList
(
cornerBufferPolysToSubstract
,
polyset_holes
);
K
I_POLYGON_SET
polyset_holes
;
AddPolygonCornersToK
i
PolygonList
(
cornerBufferPolysToSubstract
,
polyset_holes
);
// Remove holes from initial area.:
polyset_zone_solid_areas
-=
polyset_holes
;
}
// put solid areas in m_FilledPolysList:
m_FilledPolysList
.
clear
();
CopyPolygonsFromKPolygonListToFilledPolysList
(
this
,
polyset_zone_solid_areas
);
CopyPolygonsFromK
i
PolygonListToFilledPolysList
(
this
,
polyset_zone_solid_areas
);
// Remove insulated islands:
if
(
GetNet
()
>
0
)
...
...
@@ -455,13 +455,13 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
// remove copper areas
if
(
cornerBufferPolysToSubstract
.
size
()
)
{
K
PolygonSet
polyset_holes
;
AddPolygonCornersToKPolygonList
(
cornerBufferPolysToSubstract
,
polyset_holes
);
K
I_POLYGON_SET
polyset_holes
;
AddPolygonCornersToK
i
PolygonList
(
cornerBufferPolysToSubstract
,
polyset_holes
);
polyset_zone_solid_areas
-=
polyset_holes
;
// put these areas in m_FilledPolysList
m_FilledPolysList
.
clear
();
CopyPolygonsFromKPolygonListToFilledPolysList
(
this
,
polyset_zone_solid_areas
);
CopyPolygonsFromK
i
PolygonListToFilledPolysList
(
this
,
polyset_zone_solid_areas
);
if
(
GetNet
()
>
0
)
Test_For_Copper_Island_And_Remove_Insulated_Islands
(
aPcb
);
...
...
@@ -470,12 +470,12 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
cornerBufferPolysToSubstract
.
clear
();
}
void
AddPolygonCornersToKPolygonList
(
std
::
vector
<
CPolyPt
>&
aCornersBuffer
,
K
PolygonSet
&
aK
PolyList
)
void
AddPolygonCornersToK
i
PolygonList
(
std
::
vector
<
CPolyPt
>&
aCornersBuffer
,
K
I_POLYGON_SET
&
aKi
PolyList
)
{
unsigned
ii
;
std
::
vector
<
K
PolyPoint
>
cornerslist
;
std
::
vector
<
K
I_POLY_POINT
>
cornerslist
;
int
polycount
=
0
;
...
...
@@ -485,49 +485,45 @@ void AddPolygonCornersToKPolygonList( std::vector <CPolyPt>& aCornersBuffer,
polycount
++
;
}
aKPolyList
.
reserve
(
polycount
);
aK
i
PolyList
.
reserve
(
polycount
);
for
(
unsigned
icnt
=
0
;
icnt
<
aCornersBuffer
.
size
();
)
{
K
Polygon
poly
;
K
I_POLYGON
poly
;
cornerslist
.
clear
();
for
(
ii
=
icnt
;
ii
<
aCornersBuffer
.
size
();
ii
++
)
{
cornerslist
.
push_back
(
K
PolyPoint
(
aCornersBuffer
[
ii
].
x
,
aCornersBuffer
[
ii
].
y
)
);
cornerslist
.
push_back
(
K
I_POLY_POINT
(
aCornersBuffer
[
ii
].
x
,
aCornersBuffer
[
ii
].
y
)
);
if
(
aCornersBuffer
[
ii
].
end_contour
)
break
;
}
bpl
::
set_points
(
poly
,
cornerslist
.
begin
(),
cornerslist
.
end
()
);
aKPolyList
.
push_back
(
poly
);
aK
i
PolyList
.
push_back
(
poly
);
icnt
=
ii
+
1
;
}
}
int
CopyPolygonsFromKPolygonListToFilledPolysList
(
ZONE_CONTAINER
*
aZone
,
K
PolygonSet
&
aK
PolyList
)
int
CopyPolygonsFromK
i
PolygonListToFilledPolysList
(
ZONE_CONTAINER
*
aZone
,
K
I_POLYGON_SET
&
aKi
PolyList
)
{
int
count
=
0
;
std
::
vector
<
CPolyPt
>
polysList
;
for
(
unsigned
ii
=
0
;
ii
<
aKPolyList
.
size
();
ii
++
)
for
(
unsigned
ii
=
0
;
ii
<
aK
i
PolyList
.
size
();
ii
++
)
{
K
Polygon
&
poly
=
aK
PolyList
[
ii
];
K
I_POLYGON
&
poly
=
aKi
PolyList
[
ii
];
CPolyPt
corner
(
0
,
0
,
false
);
for
(
unsigned
jj
=
0
;
jj
<
poly
.
size
();
jj
++
)
{
K
PolyPoint
point
=
*
(
poly
.
begin
()
+
jj
);
K
I_POLY_POINT
point
=
*
(
poly
.
begin
()
+
jj
);
corner
.
x
=
point
.
x
();
corner
.
y
=
point
.
y
();
corner
.
end_contour
=
false
;
// Flag this corner if starting a hole connection segment:
// This is used by draw functions to draw only useful segments (and not extra segments)
// corner.utility = (aBoolengine->GetPolygonPointEdgeType() == KB_FALSE_EDGE) ? 1 : 0;
polysList
.
push_back
(
corner
);
count
++
;
}
...
...
@@ -542,10 +538,10 @@ int CopyPolygonsFromKPolygonListToFilledPolysList( ZONE_CONTAINER* aZone,
}
int
CopyPolygonsFromFilledPolysListTo
tK
PolygonList
(
ZONE_CONTAINER
*
aZone
,
K
PolygonSet
&
aK
PolyList
)
int
CopyPolygonsFromFilledPolysListTo
Ki
PolygonList
(
ZONE_CONTAINER
*
aZone
,
K
I_POLYGON_SET
&
aKi
PolyList
)
{
std
::
vector
<
CPolyPt
>
polysList
=
aZone
->
GetFilledPolysList
();
const
std
::
vector
<
CPolyPt
>&
polysList
=
aZone
->
GetFilledPolysList
();
unsigned
corners_count
=
polysList
.
size
();
int
count
=
0
;
unsigned
ic
=
0
;
...
...
@@ -554,35 +550,32 @@ int CopyPolygonsFromFilledPolysListTotKPolygonList( ZONE_CONTAINER* aZone,
for
(
unsigned
ii
=
0
;
ii
<
corners_count
;
ii
++
)
{
CPolyPt
*
corner
=
&
polysList
[
ic
];
const
CPolyPt
&
corner
=
polysList
[
ii
];
if
(
corner
->
end_contour
)
if
(
corner
.
end_contour
)
polycount
++
;
}
aKPolyList
.
reserve
(
polycount
);
std
::
vector
<
K
PolyPoint
>
cornerslist
;
aK
i
PolyList
.
reserve
(
polycount
);
std
::
vector
<
K
I_POLY_POINT
>
cornerslist
;
while
(
ic
<
corners_count
)
{
cornerslist
.
clear
();
K
Polygon
poly
;
K
I_POLYGON
poly
;
{
for
(
;
ic
<
corners_count
;
ic
++
)
while
(
ic
<
corners_count
)
{
CPolyPt
*
corner
=
&
polysList
[
ic
];
cornerslist
.
push_back
(
K
PolyPoint
(
corner
->
x
,
corner
->
y
)
);
const
CPolyPt
&
corner
=
polysList
[
ic
++
];
cornerslist
.
push_back
(
K
I_POLY_POINT
(
corner
.
x
,
corner
.
y
)
);
count
++
;
if
(
corner
->
end_contour
)
{
ic
++
;
if
(
corner
.
end_contour
)
break
;
}
}
bpl
::
set_points
(
poly
,
cornerslist
.
begin
(),
cornerslist
.
end
()
);
aKPolyList
.
push_back
(
poly
);
aK
i
PolyList
.
push_back
(
poly
);
}
}
...
...
pcbnew/zones_functions_for_undo_redo.cpp
View file @
1c9433fb
...
...
@@ -115,7 +115,7 @@ bool ZONE_CONTAINER::IsSame( const ZONE_CONTAINER& aZoneToCompare )
wxASSERT
(
m_Poly
);
// m_Poly == NULL Should never happen
wxASSERT
(
aZoneToCompare
.
m_Poly
);
if
(
m_Poly
->
corner
!=
aZoneToCompare
.
m_Poly
->
corner
)
// Compare vector
if
(
m_Poly
->
m_CornersList
!=
aZoneToCompare
.
m_Poly
->
m_CornersList
)
// Compare vector
return
false
;
return
true
;
...
...
pcbnew/zones_test_and_combine_areas.cpp
View file @
1c9433fb
This diff is collapsed.
Click to expand it.
polygon/PolyLine.cpp
View file @
1c9433fb
This diff is collapsed.
Click to expand it.
polygon/PolyLine.h
View file @
1c9433fb
This diff is collapsed.
Click to expand it.
polygon/polygons_defs.h
0 → 100644
View file @
1c9433fb
/*
* file polygons_defs.h
* definitions to use boost::polygon in KiCad.
*/
#ifndef _POLYGONS_DEFS_H_
#define _POLYGONS_DEFS_H_
#include <boost/polygon/polygon.hpp>
// Define some types used here from boost::polygon
namespace
bpl
=
boost
::
polygon
;
// bpl = boost polygon library
using
namespace
bpl
::
operators
;
// +, -, =, ...
// Definitions needed by boost::polygon
typedef
int
coordinate_type
;
/**
* KI_POLYGON defines a single polygon ( boost::polygon_data type.
* When holes are created in a KPolygon, they are
* linked to main outline by overlapping segments,
* so there is always one polygon and one list of corners
* coordinates are int
*/
typedef
bpl
::
polygon_data
<
int
>
KI_POLYGON
;
/**
* KI_POLYGON_SET defines a set of single KI_POLYGON.
* A KI_POLYGON_SET is used to store a set of polygons
* when performing operations between 2 polygons
* or 2 sets of polygons
* The result of operations like and, xor... between 2 polygons
* is always stored in a KI_POLYGON_SET, because these operations
* can create many polygons
*/
typedef
std
::
vector
<
KI_POLYGON
>
KI_POLYGON_SET
;
/**
* KI_POLY_POINT defines a point for boost::polygon.
* KI_POLY_POINT store x and y coordinates (int)
*/
typedef
bpl
::
point_data
<
int
>
KI_POLY_POINT
;
/**
* KI_POLYGON_WITH_HOLES defines a single polygon with holes
* When holes are created in a KI_POLYGON_WITH_HOLES, they are
* stored as separate single polygons,
* KI_POLYGON_WITH_HOLES store always one polygon for the external outline
* and one list of polygons (holes) which can be empty
*/
typedef
bpl
::
polygon_with_holes_data
<
int
>
KI_POLYGON_WITH_HOLES
;
/**
* KI_POLYGON_WITH_HOLES_SET defines a set of KI_POLYGON_WITH_HOLES.
* A KI_POLYGON_WITH_HOLES_SET is used to store a set of polygons with holes
* when performing operations between 2 polygons
* or 2 sets of polygons with holes
* The result of operations like and, xor... between 2 polygons with holes
* is always stored in a KI_POLYGON_WITH_HOLES_SET, because these operations
* can create many separate polygons with holespolygons
*/
typedef
std
::
vector
<
KI_POLYGON_WITH_HOLES
>
KI_POLYGON_WITH_HOLES_SET
;
#endif // #ifndef _POLYGONS_DEFS_H_
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