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
92b43c74
Commit
92b43c74
authored
Aug 31, 2012
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix 0 length segment in outline zone creation, that breaks zone chamfer option.
parent
37ee2394
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
61 additions
and
3 deletions
+61
-3
drawtxt.cpp
common/drawtxt.cpp
+1
-1
zones_by_polygon.cpp
pcbnew/zones_by_polygon.cpp
+5
-1
PolyLine.cpp
polygon/PolyLine.cpp
+39
-0
PolyLine.h
polygon/PolyLine.h
+16
-1
No files found.
common/drawtxt.cpp
View file @
92b43c74
...
...
@@ -392,7 +392,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
aCallback
(
current_char_pos
.
x
,
current_char_pos
.
y
,
end
.
x
,
end
.
y
);
}
else
GRLine
(
aPanel
->
GetClipBox
()
,
aDC
,
GRLine
(
clipBox
,
aDC
,
current_char_pos
.
x
,
current_char_pos
.
y
,
end
.
x
,
end
.
y
,
aWidth
,
aColor
);
return
;
...
...
pcbnew/zones_by_polygon.cpp
View file @
92b43c74
...
...
@@ -671,7 +671,8 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
{
ii
=
zone
->
GetNumCorners
()
-
1
;
// edge in progress : the current corner coordinate was set by Show_New_Edge_While_Move_Mouse
// edge in progress : the current corner coordinate was set
// by Show_New_Edge_While_Move_Mouse
if
(
zone
->
GetCornerPosition
(
ii
-
1
)
!=
zone
->
GetCornerPosition
(
ii
)
)
{
if
(
!
Drc_On
||
!
zone
->
IsOnCopperLayer
()
||
(
m_drc
->
Drc
(
zone
,
ii
-
1
)
==
OK_DRC
)
)
...
...
@@ -705,6 +706,9 @@ bool PCB_EDIT_FRAME::End_Zone( wxDC* DC )
return
true
;
}
// Remove the last corner if is is at the same location as the prevoius corner
zone
->
m_Poly
->
RemoveNullSegments
();
// Validate the current edge:
int
icorner
=
zone
->
GetNumCorners
()
-
1
;
if
(
zone
->
IsOnCopperLayer
()
)
...
...
polygon/PolyLine.cpp
View file @
92b43c74
...
...
@@ -32,6 +32,42 @@ CPolyLine::~CPolyLine()
UnHatch
();
}
/* Removes corners which create a null segment edge
* (i.e. when 2 successive corners are at the same location)
* returns the count of removed corners.
*/
int
CPolyLine
::
RemoveNullSegments
()
{
int
removed
=
0
;
unsigned
startcountour
=
0
;
for
(
unsigned
icnt
=
1
;
icnt
<
m_CornersList
.
size
();
icnt
++
)
{
unsigned
last
=
icnt
-
1
;
if
(
m_CornersList
[
icnt
].
end_contour
)
{
last
=
startcountour
;
startcountour
=
icnt
+
1
;
}
if
(
(
m_CornersList
[
last
].
x
==
m_CornersList
[
icnt
].
x
)
&&
(
m_CornersList
[
last
].
y
==
m_CornersList
[
icnt
].
y
)
)
{
DeleteCorner
(
icnt
);
icnt
--
;
removed
++
;
}
if
(
m_CornersList
[
icnt
].
end_contour
)
{
startcountour
=
icnt
+
1
;
icnt
++
;
}
}
return
removed
;
}
/**
* Function NormalizeAreaOutlines
...
...
@@ -65,6 +101,7 @@ int CPolyLine::NormalizeAreaOutlines( std::vector<CPolyLine*>* aNewPolygonList )
if
(
corner
.
end_contour
)
break
;
}
ClipperLib
::
SimplifyPolygon
(
raw_polygon
,
normalized_polygons
);
// enter main outline
...
...
@@ -148,6 +185,8 @@ int CPolyLine::NormalizeAreaOutlines( std::vector<CPolyLine*>* aNewPolygonList )
polyline
->
CloseLastContour
();
hole
++
;
}
polyline
->
RemoveNullSegments
();
}
return
outlines
.
size
();
...
...
polygon/PolyLine.h
View file @
92b43c74
...
...
@@ -103,7 +103,14 @@ public:
void
AppendCorner
(
int
x
,
int
y
);
void
InsertCorner
(
int
ic
,
int
x
,
int
y
);
void
DeleteCorner
(
int
ic
);
/**
* Function DeleteCorner
* remove the given corner. if it is the last point of a contour
* keep the controur closed by modifying the previous corner
* @param ic = the index of the corner to delete
*/
void
DeleteCorner
(
int
ic
);
void
MoveCorner
(
int
ic
,
int
x
,
int
y
);
void
CloseLastContour
();
void
RemoveContour
(
int
icont
);
...
...
@@ -137,6 +144,14 @@ public:
*/
CPolyLine
*
Fillet
(
unsigned
int
aRadius
,
unsigned
int
aSegments
);
/**
* Function RemoveNullSegments
* Removes corners which create a null segment edge
* (i.e. when 2 successive corners are at the same location)
* @return the count of removed corners.
*/
int
RemoveNullSegments
();
void
RemoveAllContours
(
void
);
// Remove or create hatch
...
...
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