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
99b90d2f
Commit
99b90d2f
authored
Jul 25, 2012
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More work on a better support of polygons in Kicad (code cleaning).
parent
ef5f1b9e
Changes
16
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
748 additions
and
672 deletions
+748
-672
lib_arc.cpp
eeschema/lib_arc.cpp
+6
-6
lib_arc.h
eeschema/lib_arc.h
+5
-5
solve.cpp
pcbnew/autorouter/solve.cpp
+2
-2
class_board.cpp
pcbnew/class_board.cpp
+2
-2
class_track.cpp
pcbnew/class_track.cpp
+1
-1
class_zone.h
pcbnew/class_zone.h
+1
-1
clean.cpp
pcbnew/clean.cpp
+18
-17
editrack.cpp
pcbnew/editrack.cpp
+2
-2
move_or_drag_track.cpp
pcbnew/move_or_drag_track.cpp
+4
-4
pcbnew.h
pcbnew/pcbnew.h
+2
-2
zone_filling_algorithm.cpp
pcbnew/zone_filling_algorithm.cpp
+7
-34
zones_convert_brd_items_to_polygons_with_Boost.cpp
pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp
+0
-4
zones_test_and_combine_areas.cpp
pcbnew/zones_test_and_combine_areas.cpp
+0
-53
PolyLine.cpp
polygon/PolyLine.cpp
+588
-422
PolyLine.h
polygon/PolyLine.h
+110
-117
polygons_defs.h
polygon/polygons_defs.h
+0
-0
No files found.
eeschema/lib_arc.cpp
View file @
99b90d2f
...
...
@@ -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 @
99b90d2f
...
...
@@ -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. */
...
...
pcbnew/autorouter/solve.cpp
View file @
99b90d2f
...
...
@@ -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/class_board.cpp
View file @
99b90d2f
...
...
@@ -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 @
99b90d2f
...
...
@@ -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.h
View file @
99b90d2f
...
...
@@ -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 @
99b90d2f
...
...
@@ -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 @
99b90d2f
...
...
@@ -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/move_or_drag_track.cpp
View file @
99b90d2f
...
...
@@ -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 @
99b90d2f
...
...
@@ -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/zone_filling_algorithm.cpp
View file @
99b90d2f
...
...
@@ -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
...
...
pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp
View file @
99b90d2f
...
...
@@ -524,10 +524,6 @@ int CopyPolygonsFromKiPolygonListToFilledPolysList( ZONE_CONTAINER* aZone,
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
++
;
}
...
...
pcbnew/zones_test_and_combine_areas.cpp
View file @
99b90d2f
...
...
@@ -31,7 +31,6 @@
*/
#include <fctsys.h>
#include <polygons_defs.h>
#include <common.h>
#include <confirm.h>
#include <class_undoredo_container.h>
...
...
@@ -779,58 +778,6 @@ int BOARD::TestAreaIntersection( ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area_
return
1
;
}
/**
* Function CopyPolysListToKiPolygonWithHole
* converts the outline contours aPolysList to a KI_POLYGON_WITH_HOLES
*
* @param aPolysList = the list of corners of contours
* @param aPolygoneWithHole = a KI_POLYGON_WITH_HOLES to populate
*/
void
CopyPolysListToKiPolygonWithHole
(
const
std
::
vector
<
CPolyPt
>&
aPolysList
,
KI_POLYGON_WITH_HOLES
&
aPolygoneWithHole
)
{
unsigned
corners_count
=
aPolysList
.
size
();
std
::
vector
<
KI_POLY_POINT
>
cornerslist
;
KI_POLYGON
poly
;
// Enter main outline: this is the first contour
unsigned
ic
=
0
;
while
(
ic
<
corners_count
)
{
const
CPolyPt
&
corner
=
aPolysList
[
ic
++
];
cornerslist
.
push_back
(
KI_POLY_POINT
(
corner
.
x
,
corner
.
y
)
);
if
(
corner
.
end_contour
)
break
;
}
aPolygoneWithHole
.
set
(
cornerslist
.
begin
(),
cornerslist
.
end
()
);
// Enter holes: they are next contours (when exist)
if
(
ic
<
corners_count
)
{
KI_POLYGON_SET
holePolyList
;
while
(
ic
<
corners_count
)
{
cornerslist
.
clear
();
while
(
ic
<
corners_count
)
{
const
CPolyPt
&
corner
=
aPolysList
[
ic
++
];
cornerslist
.
push_back
(
KI_POLY_POINT
(
corner
.
x
,
corner
.
y
)
);
if
(
corner
.
end_contour
)
break
;
}
bpl
::
set_points
(
poly
,
cornerslist
.
begin
(),
cornerslist
.
end
()
);
holePolyList
.
push_back
(
poly
);
}
aPolygoneWithHole
.
set_holes
(
holePolyList
.
begin
(),
holePolyList
.
end
()
);
}
}
/**
* Function CombineAreas
...
...
polygon/PolyLine.cpp
View file @
99b90d2f
This diff is collapsed.
Click to expand it.
polygon/PolyLine.h
View file @
99b90d2f
This diff is collapsed.
Click to expand it.
p
cbnew
/polygons_defs.h
→
p
olygon
/polygons_defs.h
View file @
99b90d2f
File moved
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