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
0d790e57
Commit
0d790e57
authored
Dec 29, 2008
by
dickelbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
polygon work, EDGE_MODULE::m_PolyPoints is now std::vector
parent
fadacffc
Changes
16
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
783 additions
and
657 deletions
+783
-657
CHANGELOG.txt
CHANGELOG.txt
+15
-4
drawtxt.cpp
common/drawtxt.cpp
+1
-1
gr_basic.cpp
common/gr_basic.cpp
+43
-54
class_hierarchical_PIN_sheet.cpp
eeschema/class_hierarchical_PIN_sheet.cpp
+39
-26
class_text-label.cpp
eeschema/class_text-label.cpp
+11
-9
classes_body_items.cpp
eeschema/classes_body_items.cpp
+3
-3
rs274d.cpp
gerbview/rs274d.cpp
+117
-29
tracepcb.cpp
gerbview/tracepcb.cpp
+114
-114
trpiste.cpp
gerbview/trpiste.cpp
+229
-218
gr_basic.h
include/gr_basic.h
+51
-7
class_edge_mod.cpp
pcbnew/class_edge_mod.cpp
+45
-53
class_edge_mod.h
pcbnew/class_edge_mod.h
+1
-2
class_pad_draw_functions.cpp
pcbnew/class_pad_draw_functions.cpp
+2
-2
class_zone.cpp
pcbnew/class_zone.cpp
+18
-28
muonde.cpp
pcbnew/muonde.cpp
+58
-75
plot_rtn.cpp
pcbnew/plot_rtn.cpp
+36
-32
No files found.
CHANGELOG.txt
View file @
0d790e57
...
...
@@ -5,18 +5,29 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2008-Dec-29 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
++all
* gr_basic.h DOXYGEN comments. made a couple functions static and removed
those from gr_basic.h since they are private to gr_basic.c. changed the
polygon code to use wxPoints since that is what the underlying wxWidgets
API uses.
++gerbview
More work on drawing polygons, erasure still work in progress. Will
probably switch to ZONEs from SEG_ZONEs for polygons.
2008-Dec-28 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
++Eeschema:
More about italic and bold texts options in fields and graphic texts
More about italic and bold texts options in fields and graphic texts
2008-Dec-22 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
++Pcbnew:
Added dialog box to edit graphic items (graphic segments, circles, arcs)
properties
Added dialog box to edit graphic items (graphic segments, circles, arcs)
properties
2008-Dec-22 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
...
...
@@ -24,7 +35,7 @@ email address.
++All
Cleaning code to draw/plot texts:
Now only one function is used to draw and plot texts in pcbnew in all formats
Italics texts are allowed in pcbnew (work in progress)
Italics texts are allowed in pcbnew (work in progress)
2008-Dec-14 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
...
...
common/drawtxt.cpp
View file @
0d790e57
...
...
@@ -269,7 +269,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* DC,
*
(
coordptr
+
2
),
*
(
coordptr
+
3
),
aWidth
,
aColor
);
}
else
GRPoly
(
&
aPanel
->
m_ClipBox
,
DC
,
ii
/
2
,
coord
,
0
,
GRPoly
(
&
aPanel
->
m_ClipBox
,
DC
,
ii
/
2
,
(
wxPoint
*
)
coord
,
0
,
aWidth
,
aColor
,
aColor
);
}
plume
=
f_cod
;
ii
=
0
;
...
...
common/gr_basic.cpp
View file @
0d790e57
...
...
@@ -828,21 +828,19 @@ void GRSCSegm( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int
}
static
bool
IsGRSPolyDrawable
(
EDA_Rect
*
ClipBox
,
int
n
,
int
*
Points
)
static
bool
IsGRSPolyDrawable
(
EDA_Rect
*
ClipBox
,
int
n
,
wxPoint
Points
[]
)
{
int
ii
;
int
Xmin
,
Xmax
,
Ymin
,
Ymax
;
Xmin
=
Xmax
=
Points
[
0
];
Ymin
=
Ymax
=
Points
[
1
]
;
Xmin
=
Xmax
=
Points
[
0
]
.
x
;
Ymin
=
Ymax
=
Points
[
0
].
y
;
for
(
ii
=
1
;
ii
<
n
;
ii
++
)
// calcul du rectangle d'encadrement
for
(
i
nt
i
i
=
1
;
ii
<
n
;
ii
++
)
// calcul du rectangle d'encadrement
{
int
jj
=
ii
*
2
;
Xmin
=
MIN
(
Xmin
,
Points
[
jj
]
);
Xmax
=
MAX
(
Xmax
,
Points
[
jj
]
);
Ymin
=
MIN
(
Ymin
,
Points
[
jj
+
1
]
);
Ymax
=
MAX
(
Ymax
,
Points
[
jj
+
1
]
);
Xmin
=
MIN
(
Xmin
,
Points
[
ii
].
x
);
Xmax
=
MAX
(
Xmax
,
Points
[
ii
].
x
);
Ymin
=
MIN
(
Ymin
,
Points
[
ii
].
y
);
Ymax
=
MAX
(
Ymax
,
Points
[
ii
].
y
);
}
xcliplo
=
ClipBox
->
GetX
();
...
...
@@ -866,7 +864,7 @@ static bool IsGRSPolyDrawable( EDA_Rect* ClipBox, int n, int* Points )
/************************************************************************/
/* Routine to draw a new polyline and fill it if Fill, in screen space. */
/************************************************************************/
void
GRSPoly
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
int
n
,
int
*
Points
,
bool
Fill
,
static
void
GRSPoly
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
int
n
,
wxPoint
Points
[]
,
bool
Fill
,
int
width
,
int
Color
,
int
BgColor
)
{
if
(
!
IsGRSPolyDrawable
(
ClipBox
,
n
,
Points
)
)
...
...
@@ -877,19 +875,19 @@ void GRSPoly( EDA_Rect* ClipBox, wxDC* DC, int n, int* Points, bool Fill,
if
(
Fill
&&
(
n
>
2
)
)
{
GRSetBrush
(
DC
,
BgColor
,
FILLED
);
DC
->
DrawPolygon
(
n
,
(
wxPoint
*
)
Points
);
DC
->
DrawPolygon
(
n
,
Points
);
}
else
{
int
endx
=
Points
[
n
*
2
-
2
];
int
endy
=
Points
[
n
*
2
-
1
];
wxPoint
endPt
=
Points
[
n
-
1
];
GRSetBrush
(
DC
,
Color
);
DC
->
DrawLines
(
n
,
(
wxPoint
*
)
Points
);
DC
->
DrawLines
(
n
,
Points
);
// The last point is not drawn by DrawLine and DrawLines
// Add it if the polygon is not closed
if
(
endx
!=
Points
[
0
]
||
endy
!=
Points
[
1
]
)
DC
->
DrawPoint
(
end
x
,
end
y
);
if
(
endPt
!=
Points
[
0
]
)
DC
->
DrawPoint
(
end
Pt
.
x
,
endPt
.
y
);
}
}
...
...
@@ -897,61 +895,56 @@ void GRSPoly( EDA_Rect* ClipBox, wxDC* DC, int n, int* Points, bool Fill,
/******************************************************************************/
/* Routine to draw a new closed polyline and fill it if Fill, in screen space */
/******************************************************************************/
void
GRSClosedPoly
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
int
n
,
int
*
Points
,
bool
Fill
,
int
Color
,
int
BgColor
)
{
GRSClosedPoly
(
ClipBox
,
DC
,
n
,
Points
,
Fill
,
0
,
Color
,
BgColor
);
}
void
GRSClosedPoly
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
int
n
,
int
*
Points
,
static
void
GRSClosedPoly
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
int
aPointCount
,
wxPoint
aPoints
[],
bool
Fill
,
int
width
,
int
Color
,
int
BgColor
)
{
int
startx
,
starty
;
if
(
!
IsGRSPolyDrawable
(
ClipBox
,
n
,
Points
)
)
if
(
!
IsGRSPolyDrawable
(
ClipBox
,
aPointCount
,
aPoints
)
)
return
;
GRSetColorPen
(
DC
,
Color
,
width
);
if
(
Fill
&&
(
n
>
2
)
)
if
(
Fill
&&
(
aPointCount
>
2
)
)
{
GRSMoveTo
(
Points
[
n
*
2
-
2
],
Points
[
n
*
2
-
1
]
);
GRSMoveTo
(
aPoints
[
aPointCount
-
1
].
x
,
aPoints
[
aPointCount
-
1
].
y
);
GRSetBrush
(
DC
,
BgColor
,
FILLED
);
DC
->
DrawPolygon
(
n
,
(
wxPoint
*
)
Points
,
0
,
0
,
wxODDEVEN_RULE
);
DC
->
DrawPolygon
(
aPointCount
,
a
Points
,
0
,
0
,
wxODDEVEN_RULE
);
}
else
{
startx
=
Points
[
n
*
2
-
2
];
starty
=
Points
[
n
*
2
-
1
];
GRSetBrush
(
DC
,
BgColor
);
DC
->
DrawLines
(
n
,
(
wxPoint
*
)
Points
);
DC
->
DrawLines
(
aPointCount
,
a
Points
);
/* Fermeture du polygone */
if
(
(
startx
!=
Points
[
0
])
||
(
starty
!=
Points
[
1
])
)
if
(
aPoints
[
aPointCount
-
1
]
!=
aPoints
[
0
]
)
{
GRSLine
(
ClipBox
,
DC
,
Points
[
0
],
Points
[
1
],
startx
,
starty
,
width
,
Color
);
GRSLine
(
ClipBox
,
DC
,
aPoints
[
0
].
x
,
aPoints
[
0
].
y
,
aPoints
[
aPointCount
-
1
].
x
,
aPoints
[
aPointCount
-
1
].
y
,
width
,
Color
);
}
}
}
/* not used
static void GRSClosedPoly( EDA_Rect* ClipBox, wxDC* DC, int n, wxPoint Points[],
bool Fill, int Color, int BgColor )
{
GRSClosedPoly( ClipBox, DC, n, Points, Fill, 0, Color, BgColor );
}
*/
/************************************************************************/
/* Routine to draw a new polyline and fill it if Fill, in drawing space. */
/************************************************************************/
void
GRPoly
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
int
n
,
int
*
Points
,
void
GRPoly
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
int
n
,
wxPoint
Points
[]
,
bool
Fill
,
int
width
,
int
Color
,
int
BgColor
)
{
int
ii
,
jj
;
width
=
ZoomValue
(
width
);
for
(
ii
=
0
;
ii
<
n
;
ii
++
)
for
(
int
i
=
0
;
i
<
n
;
++
i
)
{
jj
=
ii
<<
1
;
Points
[
jj
]
=
GRMapX
(
Points
[
jj
]
);
jj
++
;
Points
[
jj
]
=
GRMapY
(
Points
[
jj
]
);
Points
[
i
].
x
=
GRMapX
(
Points
[
i
].
x
);
Points
[
i
].
y
=
GRMapY
(
Points
[
i
].
y
);
}
width
=
ZoomValue
(
width
);
GRSPoly
(
ClipBox
,
DC
,
n
,
Points
,
Fill
,
width
,
Color
,
BgColor
);
}
...
...
@@ -959,27 +952,23 @@ void GRPoly( EDA_Rect* ClipBox, wxDC* DC, int n, int* Points,
/**************************************************************************/
/* Routine to draw a closed polyline and fill it if Fill, in object space */
/**************************************************************************/
void
GRClosedPoly
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
int
n
,
int
*
Points
,
void
GRClosedPoly
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
int
n
,
wxPoint
Points
[]
,
bool
Fill
,
int
Color
,
int
BgColor
)
{
GRClosedPoly
(
ClipBox
,
DC
,
n
,
Points
,
Fill
,
0
,
Color
,
BgColor
);
}
void
GRClosedPoly
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
int
n
,
int
*
Points
,
void
GRClosedPoly
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
int
n
,
wxPoint
Points
[]
,
bool
Fill
,
int
width
,
int
Color
,
int
BgColor
)
{
int
ii
,
jj
;
width
=
ZoomValue
(
width
);
for
(
ii
=
0
;
ii
<
n
;
ii
++
)
for
(
int
i
=
0
;
i
<
n
;
++
i
)
{
jj
=
ii
<<
1
;
Points
[
jj
]
=
GRMapX
(
Points
[
jj
]
);
jj
++
;
Points
[
jj
]
=
GRMapY
(
Points
[
jj
]
);
Points
[
i
].
x
=
GRMapX
(
Points
[
i
].
x
);
Points
[
i
].
y
=
GRMapY
(
Points
[
i
].
y
);
}
width
=
ZoomValue
(
width
);
GRSClosedPoly
(
ClipBox
,
DC
,
n
,
Points
,
Fill
,
width
,
Color
,
BgColor
);
}
...
...
eeschema/class_hierarchical_PIN_sheet.cpp
View file @
0d790e57
...
...
@@ -35,19 +35,20 @@
/*******************************************************************/
Hierarchical_PIN_Sheet_Struct
::
Hierarchical_PIN_Sheet_Struct
(
DrawSheetStruct
*
parent
,
const
wxPoint
&
pos
,
const
wxString
&
text
)
:
const
wxPoint
&
pos
,
const
wxString
&
text
)
:
SCH_ITEM
(
parent
,
DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE
),
EDA_TextStruct
(
text
)
/*******************************************************************/
{
wxASSERT
(
parent
);
wxASSERT
(
Pnext
==
NULL
);
m_Layer
=
LAYER_SHEETLABEL
;
m_Pos
=
pos
;
m_Edge
=
0
;
m_Shape
=
NET_INPUT
;
m_Layer
=
LAYER_SHEETLABEL
;
m_Pos
=
pos
;
m_Edge
=
0
;
m_Shape
=
NET_INPUT
;
m_IsDangling
=
TRUE
;
m_Number
=
2
;
m_Number
=
2
;
}
...
...
@@ -58,8 +59,8 @@ Hierarchical_PIN_Sheet_Struct* Hierarchical_PIN_Sheet_Struct::GenCopy()
Hierarchical_PIN_Sheet_Struct
*
newitem
=
new
Hierarchical_PIN_Sheet_Struct
(
(
DrawSheetStruct
*
)
m_Parent
,
m_Pos
,
m_Text
);
newitem
->
m_Edge
=
m_Edge
;
newitem
->
m_Shape
=
m_Shape
;
newitem
->
m_Edge
=
m_Edge
;
newitem
->
m_Shape
=
m_Shape
;
newitem
->
m_Number
=
m_Number
;
return
newitem
;
...
...
@@ -68,24 +69,31 @@ Hierarchical_PIN_Sheet_Struct* Hierarchical_PIN_Sheet_Struct::GenCopy()
/********************************************************************************************/
void
Hierarchical_PIN_Sheet_Struct
::
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
DrawMode
,
int
Color
)
int
DrawMode
,
int
Color
)
/********************************************************************************************/
/* Routine de dessin des Labels type hierarchie */
{
GRTextHorizJustifyType
side
;
EDA_Colors
txtcolor
;
GRTextHorizJustifyType
side
;
EDA_Colors
txtcolor
;
int
posx
,
tposx
,
posy
,
size2
;
wxSize
size
;
int
NbSegm
,
coord
[
20
];
int
NbSegm
;
// @todo use wxPoints here
int
coord
[
20
];
int
LineWidth
=
g_DrawMinimunLineWidth
;
if
(
Color
>=
0
)
txtcolor
=
(
EDA_Colors
)
Color
;
txtcolor
=
(
EDA_Colors
)
Color
;
else
txtcolor
=
ReturnLayerColor
(
m_Layer
);
GRSetDrawMode
(
DC
,
DrawMode
);
posx
=
m_Pos
.
x
+
offset
.
x
;
posy
=
m_Pos
.
y
+
offset
.
y
;
size
=
m_Size
;
posx
=
m_Pos
.
x
+
offset
.
x
;
posy
=
m_Pos
.
y
+
offset
.
y
;
size
=
m_Size
;
if
(
!
m_Text
.
IsEmpty
()
)
{
if
(
m_Edge
)
...
...
@@ -99,8 +107,8 @@ void Hierarchical_PIN_Sheet_Struct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, con
side
=
GR_TEXT_HJUSTIFY_LEFT
;
}
DrawGraphicText
(
panel
,
DC
,
wxPoint
(
tposx
,
posy
),
txtcolor
,
m_Text
,
TEXT_ORIENT_HORIZ
,
size
,
side
,
GR_TEXT_VJUSTIFY_CENTER
,
LineWidth
);
m_Text
,
TEXT_ORIENT_HORIZ
,
size
,
side
,
GR_TEXT_VJUSTIFY_CENTER
,
LineWidth
);
}
/* dessin du symbole de connexion */
...
...
@@ -110,8 +118,11 @@ void Hierarchical_PIN_Sheet_Struct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, con
size
.
y
=
-
size
.
y
;
}
coord
[
0
]
=
posx
;
coord
[
1
]
=
posy
;
size2
=
size
.
x
/
2
;
NbSegm
=
0
;
coord
[
0
]
=
posx
;
coord
[
1
]
=
posy
;
size2
=
size
.
x
/
2
;
NbSegm
=
0
;
switch
(
m_Shape
)
{
...
...
@@ -154,7 +165,8 @@ void Hierarchical_PIN_Sheet_Struct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, con
}
int
FillShape
=
FALSE
;
GRPoly
(
&
panel
->
m_ClipBox
,
DC
,
NbSegm
,
coord
,
FillShape
,
LineWidth
,
txtcolor
,
txtcolor
);
/* Poly Non rempli */
GRPoly
(
&
panel
->
m_ClipBox
,
DC
,
NbSegm
,
(
wxPoint
*
)
coord
,
FillShape
,
LineWidth
,
txtcolor
,
txtcolor
);
/* Poly Non rempli */
}
...
...
@@ -192,9 +204,9 @@ bool Hierarchical_PIN_Sheet_Struct::Save( FILE* aFile ) const
}
if
(
fprintf
(
aFile
,
"F%d
\"
%s
\"
%c %c %-3d %-3d %-3d
\n
"
,
m_Number
,
CONV_TO_UTF8
(
m_Text
),
type
,
side
,
m_Pos
.
x
,
m_Pos
.
y
,
m_Size
.
x
)
==
EOF
)
CONV_TO_UTF8
(
m_Text
),
type
,
side
,
m_Pos
.
x
,
m_Pos
.
y
,
m_Size
.
x
)
==
EOF
)
{
return
false
;
}
...
...
@@ -202,6 +214,7 @@ bool Hierarchical_PIN_Sheet_Struct::Save( FILE* aFile ) const
return
true
;
}
#if defined(DEBUG)
void
Hierarchical_PIN_Sheet_Struct
::
Show
(
int
nestLevel
,
std
::
ostream
&
os
)
{
...
...
@@ -209,12 +222,12 @@ void Hierarchical_PIN_Sheet_Struct::Show( int nestLevel, std::ostream& os )
wxString
s
=
GetClass
();
NestedSpace
(
nestLevel
,
os
)
<<
'<'
<<
s
.
Lower
().
mb_str
()
<<
">"
<<
" pin_name=
\"
"
<<
CONV_TO_UTF8
(
m_Text
)
<<
'"'
<<
"/>
\n
"
<<
std
::
flush
;
<<
" pin_name=
\"
"
<<
CONV_TO_UTF8
(
m_Text
)
<<
'"'
<<
"/>
\n
"
<<
std
::
flush
;
// NestedSpace( nestLevel, os ) << "</" << s.Lower().mb_str() << ">\n";
}
#endif
eeschema/class_text-label.cpp
View file @
0d790e57
...
...
@@ -393,15 +393,16 @@ void SCH_HIERLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offs
}
CreateGraphicShape
(
Poly
,
AnchorPos
);
GRPoly
(
&
panel
->
m_ClipBox
,
DC
,
Poly
[
0
],
Poly
+
1
,
0
,
width
,
color
,
color
);
GRPoly
(
&
panel
->
m_ClipBox
,
DC
,
Poly
[
0
],
(
wxPoint
*
)(
Poly
+
1
)
,
0
,
width
,
color
,
color
);
if
(
m_IsDangling
)
DrawDanglingSymbol
(
panel
,
DC
,
m_Pos
+
offset
,
color
);
}
/** function CreateGraphicShape
* Calculates the graphic shape (a polygon) associated to the text
/**
* Function CreateGraphicShape
* calculates the graphic shape (a polygon) associated to the text
* @param corner_list = coordinates list fill with polygon corners ooordinates (size > 20)
* @param Pos = Postion of the shape
* format list is
...
...
@@ -414,13 +415,14 @@ void SCH_HIERLABEL::CreateGraphicShape( int* corner_list, const wxPoint& Pos )
int
imax
=
*
Template
;
Template
++
;
*
corner_list
=
imax
;
corner_list
++
;
*
corner_list
++
=
imax
;
for
(
int
ii
=
0
;
ii
<
imax
;
ii
++
)
{
*
corner_list
=
(
HalfSize
*
(
*
Template
)
)
+
Pos
.
x
;
corner_list
++
;
Template
++
;
*
corner_list
=
(
HalfSize
*
(
*
Template
)
)
+
Pos
.
y
;
corner_list
++
;
Template
++
;
*
corner_list
++
=
(
HalfSize
*
(
*
Template
)
)
+
Pos
.
x
;
Template
++
;
*
corner_list
++
=
(
HalfSize
*
(
*
Template
)
)
+
Pos
.
y
;
Template
++
;
}
}
...
...
@@ -546,7 +548,7 @@ void SCH_GLOBALLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& dr
}
CreateGraphicShape
(
Poly
,
AnchorPos
);
GRPoly
(
&
panel
->
m_ClipBox
,
DC
,
Poly
[
0
],
Poly
+
1
,
0
,
width
,
color
,
color
);
GRPoly
(
&
panel
->
m_ClipBox
,
DC
,
Poly
[
0
],
(
wxPoint
*
)
(
Poly
+
1
)
,
0
,
width
,
color
,
color
);
if
(
m_IsDangling
)
DrawDanglingSymbol
(
panel
,
DC
,
AnchorPos
,
color
);
...
...
eeschema/classes_body_items.cpp
View file @
0d790e57
...
...
@@ -281,14 +281,14 @@ void LibDrawPolyline::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
if
(
fill
==
FILLED_WITH_BG_BODYCOLOR
)
GRPoly
(
&
aPanel
->
m_ClipBox
,
aDC
,
m_CornersCount
,
Buf_Poly_Drawings
,
1
,
linewidth
,
color
,
(
wxPoint
*
)
Buf_Poly_Drawings
,
1
,
linewidth
,
color
,
ReturnLayerColor
(
LAYER_DEVICE_BACKGROUND
)
);
else
if
(
fill
==
FILLED_SHAPE
)
GRPoly
(
&
aPanel
->
m_ClipBox
,
aDC
,
m_CornersCount
,
Buf_Poly_Drawings
,
1
,
linewidth
,
color
,
color
);
(
wxPoint
*
)
Buf_Poly_Drawings
,
1
,
linewidth
,
color
,
color
);
else
GRPoly
(
&
aPanel
->
m_ClipBox
,
aDC
,
m_CornersCount
,
Buf_Poly_Drawings
,
0
,
linewidth
,
color
,
color
);
(
wxPoint
*
)
Buf_Poly_Drawings
,
0
,
linewidth
,
color
,
color
);
}
...
...
gerbview/rs274d.cpp
View file @
0d790e57
This diff is collapsed.
Click to expand it.
gerbview/tracepcb.cpp
View file @
0d790e57
...
...
@@ -28,37 +28,37 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmaskl
/* Draw gerbview layers, for printing
*/
{
DISPLAY_OPTIONS
save_opt
;
int
DisplayPolygonsModeImg
;
save_opt
=
DisplayOpt
;
if
(
printmasklayer
&
ALL_CU_LAYERS
)
DisplayOpt
.
DisplayPadFill
=
FILLED
;
else
DisplayOpt
.
DisplayPadFill
=
SKETCH
;
DisplayOpt
.
DisplayPadNum
=
0
;
DisplayOpt
.
DisplayPadNoConn
=
0
;
DisplayOpt
.
DisplayPadIsol
=
0
;
DisplayOpt
.
DisplayModEdge
=
FILLED
;
DisplayOpt
.
DisplayModText
=
FILLED
;
DisplayOpt
.
DisplayPcbTrackFill
=
FILLED
;
DisplayOpt
.
DisplayTrackIsol
=
0
;
DisplayOpt
.
DisplayDrawItems
=
FILLED
;
DisplayOpt
.
DisplayZonesMode
=
0
;
DisplayPolygonsModeImg
=
g_DisplayPolygonsModeSketch
;
g_DisplayPolygonsModeSketch
=
0
;
m_PrintIsMirrored
=
aPrintMirrorMode
;
(
(
WinEDA_GerberFrame
*
)
m_Parent
)
->
Trace_Gerber
(
DC
,
GR_COPY
,
printmasklayer
);
if
(
Print_Sheet_Ref
)
m_Parent
->
TraceWorkSheet
(
DC
,
GetScreen
(),
0
);
m_PrintIsMirrored
=
false
;
DisplayOpt
=
save_opt
;
g_DisplayPolygonsModeSketch
=
DisplayPolygonsModeImg
;
DISPLAY_OPTIONS
save_opt
;
int
DisplayPolygonsModeImg
;
save_opt
=
DisplayOpt
;
if
(
printmasklayer
&
ALL_CU_LAYERS
)
DisplayOpt
.
DisplayPadFill
=
FILLED
;
else
DisplayOpt
.
DisplayPadFill
=
SKETCH
;
DisplayOpt
.
DisplayPadNum
=
0
;
DisplayOpt
.
DisplayPadNoConn
=
0
;
DisplayOpt
.
DisplayPadIsol
=
0
;
DisplayOpt
.
DisplayModEdge
=
FILLED
;
DisplayOpt
.
DisplayModText
=
FILLED
;
DisplayOpt
.
DisplayPcbTrackFill
=
FILLED
;
DisplayOpt
.
DisplayTrackIsol
=
0
;
DisplayOpt
.
DisplayDrawItems
=
FILLED
;
DisplayOpt
.
DisplayZonesMode
=
0
;
DisplayPolygonsModeImg
=
g_DisplayPolygonsModeSketch
;
g_DisplayPolygonsModeSketch
=
0
;
m_PrintIsMirrored
=
aPrintMirrorMode
;
(
(
WinEDA_GerberFrame
*
)
m_Parent
)
->
Trace_Gerber
(
DC
,
GR_COPY
,
printmasklayer
);
if
(
Print_Sheet_Ref
)
m_Parent
->
TraceWorkSheet
(
DC
,
GetScreen
(),
0
);
m_PrintIsMirrored
=
false
;
DisplayOpt
=
save_opt
;
g_DisplayPolygonsModeSketch
=
DisplayPolygonsModeImg
;
}
...
...
@@ -69,31 +69,31 @@ void WinEDA_GerberFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
/* Trace le PCB, et les elements complementaires ( axes, grille .. )
*/
{
PCB_SCREEN
*
screen
=
(
PCB_SCREEN
*
)
GetScreen
();
PCB_SCREEN
*
screen
=
(
PCB_SCREEN
*
)
GetScreen
();
if
(
!
m_Pcb
)
return
;
ActiveScreen
=
screen
;
GRSetDrawMode
(
DC
,
GR_COPY
);
if
(
!
m_Pcb
)
return
;
ActiveScreen
=
screen
;
GRSetDrawMode
(
DC
,
GR_COPY
);
if
(
EraseBg
)
DrawPanel
->
EraseScreen
(
DC
);
if
(
EraseBg
)
DrawPanel
->
EraseScreen
(
DC
);
DrawPanel
->
DrawBackGround
(
DC
);
DrawPanel
->
DrawBackGround
(
DC
);
Trace_Gerber
(
DC
,
GR_COPY
,
-
1
);
TraceWorkSheet
(
DC
,
screen
,
0
);
Affiche_Status_Box
();
Trace_Gerber
(
DC
,
GR_COPY
,
-
1
);
TraceWorkSheet
(
DC
,
screen
,
0
);
Affiche_Status_Box
();
if
(
DrawPanel
->
ManageCurseur
)
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
if
(
DrawPanel
->
ManageCurseur
)
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
DrawPanel
->
Trace_Curseur
(
DC
);
DrawPanel
->
Trace_Curseur
(
DC
);
}
/********************************************************************/
void
BOARD
::
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
DC
,
int
aDrawMode
,
const
wxPoint
&
offset
)
int
aDrawMode
,
const
wxPoint
&
offset
)
/********************************************************************/
/* Redraw the BOARD items but not cursors, axis or grid */
// @todo: replace WinEDA_GerberFrame::Trace_Gerber() by this function
...
...
@@ -110,72 +110,72 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay
* @param printmasklayer = mask for allowed layer (=-1 to draw all layers)
*/
{
if
(
!
m_Pcb
)
return
;
// Draw filled polygons
#define NBMAX 20000
int
nbpoints
=
0
;
int
nbpointsmax
=
NBMAX
;
int
*
coord
=
(
int
*
)
malloc
(
nbpointsmax
*
sizeof
(
int
)
*
2
);
int
*
ptcoord
=
coord
;
for
(
TRACK
*
track
=
m_Pcb
->
m_Zone
;
track
;
track
=
track
->
Next
()
)
{
if
(
!
(
track
->
ReturnMaskLayer
()
&
printmasklayer
)
)
continue
;
if
(
track
->
GetNet
()
==
0
)
// StartPoint
{
if
(
nbpoints
)
// we have found a new polygon: Draw the old polygon
{
int
Color
=
g_DesignSettings
.
m_LayerColor
[
track
->
GetLayer
()];
int
filled
=
(
g_DisplayPolygonsModeSketch
==
0
)
?
1
:
0
;
GRClosedPoly
(
&
DrawPanel
->
m_ClipBox
,
DC
,
nbpoints
,
coord
,
filled
,
Color
,
Color
);
}
nbpoints
=
2
;
ptcoord
=
coord
;
*
ptcoord
++
=
track
->
m_Start
.
x
;
*
ptcoord
++
=
track
->
m_Start
.
y
;
*
ptcoord
++
=
track
->
m_End
.
x
;
*
ptcoord
++
=
track
->
m_End
.
y
;
}
else
{
if
(
nbpoints
>=
nbpointsmax
)
{
nbpointsmax
*=
2
;
coord
=
(
int
*
)
realloc
(
coord
,
nbpointsmax
*
sizeof
(
int
)
*
2
)
;
ptcoord
=
coord
+
nbpointsmax
;
}
nbpoints
++
;
*
ptcoord
++
=
track
->
m_End
.
x
;
*
ptcoord
++
=
track
->
m_End
.
y
;
}
if
(
track
->
Next
()
==
NULL
)
// Last point
{
int
Color
=
g_DesignSettings
.
m_LayerColor
[
track
->
GetLayer
()];
int
filled
=
(
g_DisplayPolygonsModeSketch
==
0
)
?
1
:
0
;
GRClosedPoly
(
&
DrawPanel
->
m_ClipBox
,
DC
,
nbpoints
,
coord
,
filled
,
Color
,
Color
);
}
}
free
(
coord
);
// Draw tracks and flashes down here. This will probably not be a final solution to drawing order issues
Draw_Track_Buffer
(
DrawPanel
,
DC
,
m_Pcb
,
draw_mode
,
printmasklayer
);
if
(
DisplayOpt
.
DisplayPadNum
)
Affiche_DCodes_Pistes
(
DrawPanel
,
DC
,
m_Pcb
,
GR_COPY
);
GetScreen
()
->
ClrRefreshReq
();
if
(
!
m_Pcb
)
return
;
bool
erase
;
// Draw filled polygons
std
::
vector
<
wxPoint
>
coords
;
// minimize reallocations of the vector's internal array by starting with a good sized one.
coords
.
reserve
(
20000
);
for
(
TRACK
*
track
=
m_Pcb
->
m_Zone
;
track
;
track
=
track
->
Next
()
)
{
if
(
!
(
track
->
ReturnMaskLayer
()
&
printmasklayer
)
)
continue
;
if
(
track
->
GetNet
()
==
0
)
// StartPoint
{
if
(
coords
.
size
()
)
// we have found a new polygon: Draw the old polygon
{
int
Color
;
int
filled
;
if
(
erase
)
{
D
(
printf
(
"erase
\n
"
);)
Color
=
g_DrawBgColor
;
filled
=
true
;
}
else
{
D
(
printf
(
"NO erase
\n
"
);)
Color
=
g_DesignSettings
.
m_LayerColor
[
track
->
GetLayer
()]
;
filled
=
(
g_DisplayPolygonsModeSketch
==
0
)
?
1
:
0
;
}
GRClosedPoly
(
&
DrawPanel
->
m_ClipBox
,
DC
,
coords
.
size
(),
&
coords
[
0
],
filled
,
Color
,
Color
);
}
erase
=
(
track
->
m_Flags
&
DRAW_ERASED
)
?
true
:
false
;
coords
.
clear
();
coords
.
push_back
(
track
->
m_Start
)
;
coords
.
push_back
(
track
->
m_End
);
}
else
{
coords
.
push_back
(
track
->
m_End
);
}
if
(
track
->
Next
()
==
NULL
)
// Last point
{
int
Color
=
g_DesignSettings
.
m_LayerColor
[
track
->
GetLayer
()];
int
filled
=
(
g_DisplayPolygonsModeSketch
==
0
)
?
1
:
0
;
GRClosedPoly
(
&
DrawPanel
->
m_ClipBox
,
DC
,
coords
.
size
(),
&
coords
[
0
],
filled
,
Color
,
Color
);
}
}
// Draw tracks and flashes down here. This will probably not be a final solution to drawing order issues
Draw_Track_Buffer
(
DrawPanel
,
DC
,
m_Pcb
,
draw_mode
,
printmasklayer
);
if
(
DisplayOpt
.
DisplayPadNum
)
Affiche_DCodes_Pistes
(
DrawPanel
,
DC
,
m_Pcb
,
GR_COPY
);
GetScreen
()
->
ClrRefreshReq
();
}
gerbview/trpiste.cpp
View file @
0d790e57
This diff is collapsed.
Click to expand it.
include/gr_basic.h
View file @
0d790e57
...
...
@@ -95,13 +95,57 @@ void GRMoveRel(int x, int y);
void
GRSMoveRel
(
int
x
,
int
y
);
void
GRLineRel
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
int
x
,
int
y
,
int
width
,
int
Color
);
void
GRSLineRel
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
int
x
,
int
y
,
int
width
,
int
Color
);
void
GRPoly
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
int
n
,
int
*
Points
,
bool
Fill
,
int
width
,
int
Color
,
int
BgColor
);
void
GRClosedPoly
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
int
n
,
int
*
Points
,
bool
Fill
,
int
Color
,
int
BgColor
);
void
GRClosedPoly
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
int
n
,
int
*
Points
,
bool
Fill
,
int
width
,
int
Color
,
int
BgColor
);
void
GRSPoly
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
int
n
,
int
*
Points
,
bool
Fill
,
int
width
,
int
Color
,
int
BgColor
);
void
GRSClosedPoly
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
int
n
,
int
*
Points
,
bool
Fill
,
int
width
,
int
Color
,
int
BgColor
);
void
GRCircle
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
int
x
,
int
y
,
int
r
,
int
Color
);
void
GRPoly
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
int
n
,
wxPoint
Points
[],
bool
Fill
,
int
width
,
int
Color
,
int
BgColor
);
/**
* Function GRClosedPoly
* draws a closed polygon onto the drawing context \a aDC and optionally fills and/or
* draws a border around it.
* @param ClipBox defines a rectangular boundary outside of which no drawing will occur.
* @param aDC the device context into which drawing should occur.
* @param aPointCount the number of points in the array \a aPointArray.
* @param aPointArray an array holding the wxPoints in the polygon.
* @param doFill true if polygon is to be filled, else false and only the boundary is drawn.
* @param aPenColor the color index of the border.
* @param aFillColor the fill color of the polygon's interior.
*/
void
GRClosedPoly
(
EDA_Rect
*
ClipBox
,
wxDC
*
aDC
,
int
aPointCount
,
wxPoint
aPoints
[],
bool
doFill
,
int
aPenColor
,
int
aFillColor
);
// @todo could make these 2 closed polygons calls a single function and default the aPenWidth argument
/**
* Function GRClosedPoly
* draws a closed polygon onto the drawing context \a aDC and optionally fills and/or
* draws a border around it.
* @param ClipBox defines a rectangular boundary outside of which no drawing will occur.
* @param aDC the device context into which drawing should occur.
* @param aPointCount the number of points in the array \a aPointArray.
* @param aPointArray an array holding the wxPoints in the polygon.
* @param doFill true if polygon is to be filled, else false and only the boundary is drawn.
* @param aPenWidth is the width of the pen to use on the perimeter, can be zero.
* @param aPenColor the color index of the border.
* @param aFillColor the fill color of the polygon's interior.
*/
void
GRClosedPoly
(
EDA_Rect
*
ClipBox
,
wxDC
*
aDC
,
int
aPointCount
,
wxPoint
aPoints
[],
bool
doFill
,
int
aPenWidth
,
int
aPenColor
,
int
aFillColor
);
/**
* Function GRCircle
* draws a circle onto the drawing context \a aDC centered at the user coordinates (x,y)
*
* @param ClipBox defines a rectangular boundary outside of which no drawing will occur.
* @param aDC the device context into which drawing should occur.
* @param x The x coordinate in user space of the center of the circle.
* @param x The y coordinate in user space of the center of the circle.
* @param aRadius is the radis of the circle.
* @param aColor is an index into our color table of RGB colors.
* @see EDA_Colors and colors.h
*/
void
GRCircle
(
EDA_Rect
*
ClipBox
,
wxDC
*
aDC
,
int
x
,
int
y
,
int
aRadius
,
int
aColor
);
void
GRCircle
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
int
x
,
int
y
,
int
r
,
int
width
,
int
Color
);
void
GRFilledCircle
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
int
x
,
int
y
,
int
r
,
int
width
,
int
Color
,
int
BgColor
);
...
...
pcbnew/class_edge_mod.cpp
View file @
0d790e57
...
...
@@ -35,17 +35,11 @@ EDGE_MODULE::EDGE_MODULE( MODULE* parent ) :
m_Shape
=
S_SEGMENT
;
m_Angle
=
0
;
m_Width
=
120
;
m_PolyCount
=
0
;
// For polygons : number of points (> 2)
m_PolyList
=
NULL
;
// For polygons: coord list (1 point = 2 coord)
}
EDGE_MODULE
::~
EDGE_MODULE
()
{
if
(
m_PolyList
)
free
(
m_PolyList
);
m_PolyList
=
NULL
;
m_PolyCount
=
0
;
}
...
...
@@ -56,6 +50,7 @@ void EDGE_MODULE:: Copy( EDGE_MODULE* source ) // copy structure
if
(
source
==
NULL
)
return
;
// @todo why not just use "*this = source;" ?
m_Start
=
source
->
m_Start
;
m_End
=
source
->
m_End
;
m_Shape
=
source
->
m_Shape
;
...
...
@@ -64,18 +59,8 @@ void EDGE_MODULE:: Copy( EDGE_MODULE* source ) // copy structure
m_Angle
=
source
->
m_Angle
;
// pour les arcs de cercle: longueur de l'arc en 0,1 degres
m_Layer
=
source
->
m_Layer
;
m_Width
=
source
->
m_Width
;
if
(
m_PolyList
)
free
(
m_PolyList
);
m_PolyCount
=
0
;
m_PolyList
=
NULL
;
if
(
source
->
m_PolyCount
&&
source
->
m_PolyList
)
{
int
size
;
m_PolyCount
=
source
->
m_PolyCount
;
// For polygons : number of points
size
=
m_PolyCount
*
2
*
sizeof
(
int
);
// For polygons: 1 point = 2 coord
m_PolyList
=
(
int
*
)
MyMalloc
(
size
);
memcpy
(
m_PolyList
,
source
->
m_PolyList
,
size
);
}
m_PolyPoints
=
source
->
m_PolyPoints
;
}
/***********************************/
...
...
@@ -210,33 +195,32 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
break
;
case
S_POLYGON
:
{
// We must compute true coordinates from m_PolyList
// which are relative to module position, orientation 0
int
ii
,
*
source
,
*
ptr
,
*
ptr_base
;
ptr
=
ptr_base
=
(
int
*
)
MyMalloc
(
2
*
m_PolyCount
*
sizeof
(
int
)
);
source
=
m_PolyList
;
for
(
ii
=
0
;
ii
<
m_PolyCount
;
ii
++
)
{
int
x
,
y
;
x
=
*
source
;
source
++
;
y
=
*
source
;
source
++
;
if
(
Module
)
// We must compute true coordinates from m_PolyPoints
// which are relative to module position, orientation 0
std
::
vector
<
wxPoint
>
points
=
m_PolyPoints
;
for
(
unsigned
ii
=
0
;
ii
<
points
.
size
();
ii
++
)
{
RotatePoint
(
&
x
,
&
y
,
Module
->
m_Orient
);
x
+=
Module
->
m_Pos
.
x
;
y
+=
Module
->
m_Pos
.
y
;
wxPoint
&
pt
=
points
[
ii
];
if
(
Module
)
{
RotatePoint
(
&
pt
.
x
,
&
pt
.
y
,
Module
->
m_Orient
);
pt
.
x
+=
Module
->
m_Pos
.
x
;
pt
.
y
+=
Module
->
m_Pos
.
y
;
}
pt
.
x
+=
m_Start0
.
x
-
offset
.
x
;
pt
.
y
+=
m_Start0
.
y
-
offset
.
y
;
}
x
+=
m_Start0
.
x
-
offset
.
x
;
y
+=
m_Start0
.
y
-
offset
.
y
;
*
ptr
=
x
;
ptr
++
;
*
ptr
=
y
;
ptr
++
;
}
GRPoly
(
&
panel
->
m_ClipBox
,
DC
,
m_PolyCount
,
ptr_base
,
TRUE
,
m_Width
,
color
,
color
);
free
(
ptr_base
);
GRPoly
(
&
panel
->
m_ClipBox
,
DC
,
points
.
size
(),
&
points
[
0
]
,
TRUE
,
m_Width
,
color
,
color
);
}
break
;
}
}
}
...
...
@@ -306,13 +290,11 @@ bool EDGE_MODULE::Save( FILE* aFile ) const
ret
=
fprintf
(
aFile
,
"DP %d %d %d %d %d %d %d
\n
"
,
m_Start0
.
x
,
m_Start0
.
y
,
m_End0
.
x
,
m_End0
.
y
,
m_Poly
Count
,
m_Poly
Points
.
size
()
,
m_Width
,
m_Layer
);
int
*
pInt
;
pInt
=
m_PolyList
;
for
(
int
i
=
0
;
i
<
m_PolyCount
;
++
i
,
pInt
+=
2
)
fprintf
(
aFile
,
"Dl %d %d
\n
"
,
pInt
[
0
],
pInt
[
1
]
);
for
(
unsigned
i
=
0
;
i
<
m_PolyPoints
.
size
();
++
i
)
fprintf
(
aFile
,
"Dl %d %d
\n
"
,
m_PolyPoints
[
i
].
x
,
m_PolyPoints
[
i
].
y
);
break
;
default
:
...
...
@@ -345,11 +327,10 @@ int EDGE_MODULE::ReadDescr( char* Line, FILE* File,
*
*/
{
int
ii
,
*
ptr
;
int
ii
;
int
error
=
0
;
char
Buf
[
1024
];
switch
(
Line
[
1
]
)
{
case
'S'
:
...
...
@@ -394,26 +375,37 @@ int EDGE_MODULE::ReadDescr( char* Line, FILE* File,
break
;
case
S_POLYGON
:
int
pointCount
;
sscanf
(
Line
+
3
,
"%d %d %d %d %d %d %d"
,
&
m_Start0
.
x
,
&
m_Start0
.
y
,
&
m_End0
.
x
,
&
m_End0
.
y
,
&
m_PolyCount
,
&
m_Width
,
&
m_Layer
);
&
pointCount
,
&
m_Width
,
&
m_Layer
);
(
*
LineNum
)
++
;
m_PolyList
=
(
int
*
)
MyZMalloc
(
2
*
m_PolyCount
*
sizeof
(
int
)
);
for
(
ii
=
0
,
ptr
=
m_PolyList
;
ii
<
m_PolyCount
;
ii
++
)
m_PolyPoints
.
clear
();
m_PolyPoints
.
reserve
(
pointCount
);
for
(
ii
=
0
;
ii
<
pointCount
;
ii
++
)
{
if
(
GetLine
(
File
,
Buf
,
LineNum
,
sizeof
(
Buf
)
-
1
)
!=
NULL
)
{
if
(
strncmp
(
Buf
,
"Dl"
,
2
)
!=
0
)
{
error
=
1
;
break
;
error
=
1
;
break
;
}
sscanf
(
Buf
+
3
,
"%d %d
\n
"
,
ptr
,
ptr
+
1
);
(
*
LineNum
)
++
;
ptr
+=
2
;
int
x
;
int
y
;
sscanf
(
Buf
+
3
,
"%d %d
\n
"
,
&
x
,
&
y
);
m_PolyPoints
.
push_back
(
wxPoint
(
x
,
y
)
);
(
*
LineNum
)
++
;
}
else
{
error
=
1
;
break
;
error
=
1
;
break
;
}
}
...
...
pcbnew/class_edge_mod.h
View file @
0d790e57
...
...
@@ -20,8 +20,7 @@ public:
int
m_Angle
;
// pour les arcs de cercle: longueur de l'arc en 0,1 degres
int
m_PolyCount
;
// For polygons: number of points (> 2)
int
*
m_PolyList
;
// For polygons: coord list (1 point = 2 coord)
std
::
vector
<
wxPoint
>
m_PolyPoints
;
// For polygons: number of points (> 2)
// Coord are relative to Origin, orient 0
public
:
...
...
pcbnew/class_pad_draw_functions.cpp
View file @
0d790e57
...
...
@@ -280,7 +280,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
coord
[
ii
].
y
=
coord
[
ii
].
y
+
uy0
;
}
GRClosedPoly
(
&
panel
->
m_ClipBox
,
DC
,
4
,
(
int
*
)
coord
,
fillpad
,
color
,
color
);
GRClosedPoly
(
&
panel
->
m_ClipBox
,
DC
,
4
,
coord
,
fillpad
,
color
,
color
);
if
(
DisplayIsol
)
{
...
...
@@ -306,7 +306,7 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
coord
[
ii
].
y
=
coord
[
ii
].
y
+
uy0
;
}
GRClosedPoly
(
&
panel
->
m_ClipBox
,
DC
,
4
,
(
int
*
)
coord
,
0
,
color
,
color
);
GRClosedPoly
(
&
panel
->
m_ClipBox
,
DC
,
4
,
coord
,
0
,
color
,
color
);
}
}
break
;
...
...
pcbnew/class_zone.cpp
View file @
0d790e57
...
...
@@ -455,19 +455,6 @@ void ZONE_CONTAINER::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, con
}
}
/* this is local class to handle 2 integers that are a corner coordinate
* One could use wxPoint insteed.
* However, this class has only 2 integers
* if changes happen in wxPoint ( like virtual functions) they will be not suitable
* So i prefer use this simple class to handle a coordinate.
*/
class
corner_coord
{
public
:
int
x
;
int
y
;
};
/************************************************************************************/
void
ZONE_CONTAINER
::
DrawFilledArea
(
WinEDA_DrawPanel
*
panel
,
...
...
@@ -483,8 +470,8 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel,
* @param aDrawMode = GR_OR, GR_XOR, GR_COPY ..
*/
{
static
vector
<
char
>
CornersTypeBuffer
;
static
vector
<
corner_coord
>
CornersBuffer
;
static
vector
<
char
>
CornersTypeBuffer
;
static
vector
<
wxPoint
>
CornersBuffer
;
// outline_mode is false to show filled polys,
// and true to show polygons outlines only (test and debug purposes)
bool
outline_mode
=
DisplayOpt
.
DisplayZonesMode
==
2
?
true
:
false
;
...
...
@@ -535,19 +522,21 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel,
for
(
int
ic
=
0
;
ic
<=
imax
;
ic
++
)
{
CPolyPt
*
corner
=
&
m_FilledPolysList
[
ic
];
corner_coord
coord
;
wxPoint
coord
;
coord
.
x
=
corner
->
x
+
offset
.
x
;
coord
.
y
=
corner
->
y
+
offset
.
y
;
CornersBuffer
.
push_back
(
coord
);
CornersTypeBuffer
.
push_back
((
char
)
corner
->
utility
);
if
(
(
corner
->
end_contour
)
||
(
ic
==
imax
)
)
// the last corner of a filled area is found: draw it
{
/* Draw the current filled area: draw segments ouline first
* Curiously, draw segments ouline first and after draw filled polygons
* with oulines thickness = 0 is a faster than
* just draw filled polygons but with oulines thickness = m_ZoneMinThickness
* So DO NOT use draw filled polygons with oulines having a thickness > 0
* Note: Extra segments ( added by kbool to joint holes with external outline) are not drawn
*/
{
/* Draw the current filled area: draw segments ouline first
* Curiously, draw segments ouline first and after draw filled polygons
* with oulines thickness = 0 is a faster than
* just draw filled polygons but with oulines thickness = m_ZoneMinThickness
* So DO NOT use draw filled polygons with oulines having a thickness > 0
* Note: Extra segments ( added by kbool to joint holes with external outline) are not drawn
*/
{
// Draw outlines:
if
(
(
m_ZoneMinThickness
>
1
)
||
outline_mode
)
...
...
@@ -559,6 +548,7 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel,
int
y0
=
CornersBuffer
[
is
].
y
;
int
x1
=
CornersBuffer
[
ie
].
x
;
int
y1
=
CornersBuffer
[
ie
].
y
;
if
(
CornersTypeBuffer
[
ie
]
==
0
)
// Draw only basic outlines, not extra segments
{
if
(
(
!
DisplayOpt
.
DisplayPcbTrackFill
)
||
GetState
(
FORCE_SKETCH
)
)
...
...
@@ -573,12 +563,12 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel,
}
}
// Draw areas:
if
(
(
m_FillMode
==
0
)
&&
!
outline_mode
)
GRPoly
(
&
panel
->
m_ClipBox
,
DC
,
CornersBuffer
.
size
(),
(
int
*
)
&
CornersBuffer
[
0
].
x
,
true
,
0
,
color
,
color
);
if
(
(
m_FillMode
==
0
)
&&
!
outline_mode
)
GRPoly
(
&
panel
->
m_ClipBox
,
DC
,
CornersBuffer
.
size
(),
&
CornersBuffer
[
0
]
,
true
,
0
,
color
,
color
);
}
CornersTypeBuffer
.
clear
();
CornersBuffer
.
clear
();
CornersTypeBuffer
.
clear
();
CornersBuffer
.
clear
();
}
}
}
...
...
pcbnew/muonde.cpp
View file @
0d790e57
...
...
@@ -116,7 +116,7 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveComponent( int shape_type )
* the "gap" is isolation created between this 2 pads
*/
{
int
gap_size
,
oX
,
ii
;
int
oX
;
float
fcoeff
;
D_PAD
*
pad
;
MODULE
*
Module
;
...
...
@@ -126,7 +126,7 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveComponent( int shape_type )
bool
abort
;
/* Enter the size of the gap or stub*/
gap_size
=
g_DesignSettings
.
m_CurrentTrackWidth
;
// Valeur raisonnable
int
gap_size
=
g_DesignSettings
.
m_CurrentTrackWidth
;
// Valeur raisonnable
switch
(
shape_type
)
{
...
...
@@ -219,40 +219,39 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveComponent( int shape_type )
pad
->
m_Pos
.
y
+=
pad
->
m_Pos0
.
y
;
break
;
case
2
:
//Arc Stub created by a polygonal approach:
{
EDGE_MODULE
*
edge
;
int
*
ptr
,
theta
;
ii
=
angle
/
50
;
// Note : angles are in 0.1 degrees
edge
=
new
EDGE_MODULE
(
Module
);
Module
->
m_Drawings
.
PushFront
(
edge
);
edge
->
m_Shape
=
S_POLYGON
;
edge
->
SetLayer
(
LAYER_CMP_N
);
edge
->
m_PolyCount
=
ii
+
3
;
edge
->
m_PolyList
=
(
int
*
)
MyMalloc
(
edge
->
m_PolyCount
*
2
*
sizeof
(
int
)
);
ptr
=
edge
->
m_PolyList
;
edge
->
m_Start0
.
y
=
-
pad
->
m_Size
.
y
/
2
;
*
ptr
=
0
;
ptr
++
;
*
ptr
=
0
;
ptr
++
;
theta
=
-
angle
/
2
;
for
(
ii
=
1
;
ii
<
edge
->
m_PolyCount
-
1
;
ii
++
)
case
2
:
// Arc Stub created by a polygonal approach:
{
int
x
,
y
;
x
=
0
;
y
=
-
gap_size
;
RotatePoint
(
&
x
,
&
y
,
theta
);
*
ptr
=
x
;
ptr
++
;
*
ptr
=
y
;
ptr
++
;
theta
+=
50
;
if
(
theta
>
angle
/
2
)
theta
=
angle
/
2
;
}
EDGE_MODULE
*
edge
=
new
EDGE_MODULE
(
Module
);
Module
->
m_Drawings
.
PushFront
(
edge
);
edge
->
m_Shape
=
S_POLYGON
;
edge
->
SetLayer
(
LAYER_CMP_N
);
int
numPoints
=
angle
/
50
+
3
;
// Note : angles are in 0.1 degrees
edge
->
m_PolyPoints
.
reserve
(
numPoints
);
edge
->
m_Start0
.
y
=
-
pad
->
m_Size
.
y
/
2
;
edge
->
m_PolyPoints
.
push_back
(
wxPoint
(
0
,
0
)
);
int
theta
=
-
angle
/
2
;
for
(
int
ii
=
1
;
ii
<
numPoints
-
1
;
ii
++
)
{
wxPoint
pt
(
0
,
-
gap_size
);
// Close the polygon:
*
ptr
=
edge
->
m_PolyList
[
0
];
ptr
++
;
*
ptr
=
edge
->
m_PolyList
[
1
];
RotatePoint
(
&
pt
.
x
,
&
pt
.
y
,
theta
);
edge
->
m_PolyPoints
.
push_back
(
pt
);
theta
+=
50
;
if
(
theta
>
angle
/
2
)
theta
=
angle
/
2
;
}
// Close the polygon:
edge
->
m_PolyPoints
.
push_back
(
edge
->
m_PolyPoints
[
0
]
);
}
break
;
}
default
:
break
;
...
...
@@ -505,11 +504,13 @@ MODULE* WinEDA_PcbFrame::Create_MuWavePolygonShape( )
MODULE
*
Module
;
wxString
cmp_name
;
int
pad_count
=
2
;
EDGE_MODULE
*
edge
;
int
*
ptr
;
EDGE_MODULE
*
edge
;
int
ii
,
npoints
;
WinEDA_SetParamShapeFrame
*
frame
=
new
WinEDA_SetParamShapeFrame
(
this
,
wxPoint
(
-
1
,
-
1
)
);
int
ok
=
frame
->
ShowModal
();
frame
->
Destroy
();
int
ok
=
frame
->
ShowModal
();
frame
->
Destroy
();
DrawPanel
->
MouseToCursorSchema
();
...
...
@@ -524,6 +525,7 @@ MODULE* WinEDA_PcbFrame::Create_MuWavePolygonShape( )
if
(
PolyShapeType
==
2
)
// mirrored
ShapeScaleY
=
-
ShapeScaleY
;
ShapeSize
.
x
=
(
int
)
round
(
ShapeScaleX
);
ShapeSize
.
y
=
(
int
)
round
(
ShapeScaleY
);
...
...
@@ -558,69 +560,50 @@ MODULE* WinEDA_PcbFrame::Create_MuWavePolygonShape( )
edge
->
SetLayer
(
LAYER_CMP_N
);
npoints
=
PolyEdgesCount
;
switch
(
PolyShapeType
)
{
case
0
:
// Single
case
2
:
// Single, mirrored
edge
->
m_PolyCount
=
PolyEdgesCount
+
2
;
break
;
case
1
:
// Symetric
edge
->
m_PolyCount
=
(
2
*
PolyEdgesCount
)
+
2
;
break
;
}
edge
->
m_PolyList
=
(
int
*
)
MyMalloc
(
edge
->
m_PolyCount
*
2
*
sizeof
(
int
)
);
ptr
=
edge
->
m_PolyList
;
edge
->
m_PolyPoints
.
reserve
(
2
*
PolyEdgesCount
+
2
);
// Init start point coord:
*
ptr
=
pad1
->
m_Pos0
.
x
;
ptr
++
;
*
ptr
=
0
;
ptr
++
;
edge
->
m_PolyPoints
.
push_back
(
wxPoint
(
pad1
->
m_Pos0
.
x
,
0
)
);
double
*
dptr
=
PolyEdges
;
wxPoint
first_co
rdinate
,
last_c
ordinate
;
wxPoint
first_co
ordinate
,
last_co
ordinate
;
for
(
ii
=
0
;
ii
<
npoints
;
ii
++
)
// Copy points
{
last_cordinate
.
x
=
*
ptr
=
(
int
)
round
(
*
dptr
*
ShapeScaleX
)
+
pad1
->
m_Pos0
.
x
;
dptr
++
;
ptr
++
;
last_cordinate
.
y
=
*
ptr
=
-
(
int
)
round
(
*
dptr
*
ShapeScaleY
);
dptr
++
;
ptr
++
;
last_coordinate
.
x
=
(
int
)
round
(
*
dptr
++
*
ShapeScaleX
)
+
pad1
->
m_Pos0
.
x
;
last_coordinate
.
y
=
-
(
int
)
round
(
*
dptr
++
*
ShapeScaleY
);
edge
->
m_PolyPoints
.
push_back
(
last_coordinate
);
}
first_co
rdinate
.
y
=
edge
->
m_PolyList
[
3
]
;
first_co
ordinate
.
y
=
edge
->
m_PolyPoints
[
1
].
y
;
switch
(
PolyShapeType
)
{
int
*
ptr1
;
case
0
:
// Single
case
2
:
// Single mirrored
// Init end point coord:
*
ptr
=
pad2
->
m_Pos0
.
x
=
last_cordinate
.
x
;
ptr
++
;
*
ptr
=
0
;
pad1
->
m_Size
.
x
=
pad1
->
m_Size
.
y
=
ABS
(
first_cordinate
.
y
);
pad2
->
m_Size
.
x
=
pad2
->
m_Size
.
y
=
ABS
(
last_cordinate
.
y
);
pad1
->
m_Pos0
.
y
=
first_cordinate
.
y
/
2
;
pad2
->
m_Pos0
.
y
=
last_cordinate
.
y
/
2
;
pad2
->
m_Pos0
.
x
=
last_coordinate
.
x
;
edge
->
m_PolyPoints
.
push_back
(
wxPoint
(
last_coordinate
.
x
,
0
)
);
pad1
->
m_Size
.
x
=
pad1
->
m_Size
.
y
=
ABS
(
first_coordinate
.
y
);
pad2
->
m_Size
.
x
=
pad2
->
m_Size
.
y
=
ABS
(
last_coordinate
.
y
);
pad1
->
m_Pos0
.
y
=
first_coordinate
.
y
/
2
;
pad2
->
m_Pos0
.
y
=
last_coordinate
.
y
/
2
;
pad1
->
m_Pos
.
y
=
pad1
->
m_Pos0
.
y
+
Module
->
m_Pos
.
y
;
pad2
->
m_Pos
.
y
=
pad2
->
m_Pos0
.
y
+
Module
->
m_Pos
.
y
;
break
;
case
1
:
// Symetric
ptr1
=
ptr
-
2
;
for
(
ii
=
0
;
ii
<=
npoints
;
ii
++
)
for
(
int
ndx
=
edge
->
m_PolyPoints
.
size
()
-
1
;
ndx
>=
0
;
--
ndx
)
{
*
ptr
=
*
ptr1
;
// Copy X coord
ptr
++
;
*
ptr
=
-*
(
ptr1
+
1
);
// Copy Y coord, mirror X axis
ptr1
-=
2
;
ptr
++
;
}
wxPoint
pt
=
edge
->
m_PolyPoints
[
ndx
];
pad1
->
m_Size
.
x
=
pad1
->
m_Size
.
y
=
2
*
ABS
(
first_cordinate
.
y
);
pt
.
y
=
-
pt
.
y
;
// mirror about X axis
pad2
->
m_Size
.
x
=
pad2
->
m_Size
.
y
=
2
*
ABS
(
last_cordinate
.
y
);
edge
->
m_PolyPoints
.
push_back
(
pt
);
}
pad1
->
m_Size
.
x
=
pad1
->
m_Size
.
y
=
2
*
ABS
(
first_coordinate
.
y
);
pad2
->
m_Size
.
x
=
pad2
->
m_Size
.
y
=
2
*
ABS
(
last_coordinate
.
y
);
break
;
}
...
...
pcbnew/plot_rtn.cpp
View file @
0d790e57
...
...
@@ -325,9 +325,9 @@ static void PlotTextModule( TEXTE_MODULE* pt_texte, int format_plot )
size
.
x
=
-
size
.
x
;
// Text is mirrored
if
(
format_plot
==
PLOT_FORMAT_GERBER
)
SelectD_CODE_For_LineDraw
(
thickness
);
SelectD_CODE_For_LineDraw
(
thickness
);
PlotGraphicText
(
format_plot
,
pos
,
BLACK
,
PlotGraphicText
(
format_plot
,
pos
,
BLACK
,
pt_texte
->
m_Text
,
orient
,
size
,
pt_texte
->
m_HJustify
,
pt_texte
->
m_VJustify
,
...
...
@@ -472,6 +472,7 @@ void Plot_1_EdgeModule( int format_plot, EDGE_MODULE* PtEdge )
if
(
PtEdge
->
Type
()
!=
TYPE_EDGE_MODULE
)
return
;
type_trace
=
PtEdge
->
m_Shape
;
thickness
=
PtEdge
->
m_Width
;
if
(
Plot_Mode
==
FILAIRE
)
...
...
@@ -517,39 +518,42 @@ void Plot_1_EdgeModule( int format_plot, EDGE_MODULE* PtEdge )
break
;
case
S_POLYGON
:
{
// We must compute true coordinates from m_PolyList
// which are relative to module position, orientation 0
int
ii
,
*
source
,
*
ptr
,
*
ptr_base
;
MODULE
*
Module
=
NULL
;
if
(
PtEdge
->
GetParent
()
&&
(
PtEdge
->
GetParent
()
->
Type
()
==
TYPE_MODULE
)
)
Module
=
(
MODULE
*
)
PtEdge
->
GetParent
();
ptr
=
ptr_base
=
(
int
*
)
MyMalloc
(
2
*
PtEdge
->
m_PolyCount
*
sizeof
(
int
)
);
source
=
PtEdge
->
m_PolyList
;
for
(
ii
=
0
;
ii
<
PtEdge
->
m_PolyCount
;
ii
++
)
{
int
x
=
*
source
++
;
int
y
=
*
source
++
;
// We must compute true coordinates from m_PolyList
// which are relative to module position, orientation 0
MODULE
*
Module
=
NULL
;
if
(
PtEdge
->
GetParent
()
&&
(
PtEdge
->
GetParent
()
->
Type
()
==
TYPE_MODULE
)
)
Module
=
(
MODULE
*
)
PtEdge
->
GetParent
();
int
*
ptr_base
=
(
int
*
)
MyMalloc
(
2
*
PtEdge
->
m_PolyPoints
.
size
()
*
sizeof
(
int
)
);
int
*
ptr
=
ptr_base
;
if
(
Module
)
int
*
source
=
(
int
*
)
&
PtEdge
->
m_PolyPoints
[
0
];
for
(
unsigned
ii
=
0
;
ii
<
PtEdge
->
m_PolyPoints
.
size
();
ii
++
)
{
RotatePoint
(
&
x
,
&
y
,
Module
->
m_Orient
);
x
+=
Module
->
m_Pos
.
x
;
y
+=
Module
->
m_Pos
.
y
;
}
int
x
=
*
source
++
;
int
y
=
*
source
++
;
if
(
Module
)
{
RotatePoint
(
&
x
,
&
y
,
Module
->
m_Orient
);
x
+=
Module
->
m_Pos
.
x
;
y
+=
Module
->
m_Pos
.
y
;
}
x
+=
PtEdge
->
m_Start0
.
x
;
y
+=
PtEdge
->
m_Start0
.
y
;
x
+=
PtEdge
->
m_Start0
.
x
;
y
+=
PtEdge
->
m_Start0
.
y
;
*
ptr
++
=
x
;
*
ptr
++
=
y
;
}
*
ptr
++
=
x
;
*
ptr
++
=
y
;
}
PlotFilledPolygon
(
format_plot
,
PtEdge
->
m_PolyCount
,
ptr_base
);
free
(
ptr_base
);
PlotFilledPolygon
(
format_plot
,
PtEdge
->
m_PolyPoints
.
size
(),
ptr_base
);
free
(
ptr_base
);
}
break
;
}
}
}
...
...
@@ -577,9 +581,9 @@ void PlotTextePcb( TEXTE_PCB* pt_texte, int format_plot, int masque_layer )
size
.
x
=
-
size
.
x
;
if
(
format_plot
==
PLOT_FORMAT_GERBER
)
SelectD_CODE_For_LineDraw
(
thickness
);
SelectD_CODE_For_LineDraw
(
thickness
);
PlotGraphicText
(
format_plot
,
pos
,
BLACK
,
PlotGraphicText
(
format_plot
,
pos
,
BLACK
,
pt_texte
->
m_Text
,
orient
,
size
,
pt_texte
->
m_HJustify
,
pt_texte
->
m_VJustify
,
...
...
@@ -711,7 +715,7 @@ void PlotCircle( int format_plot, int thickness, wxPoint centre, int radius )
switch
(
format_plot
)
{
case
PLOT_FORMAT_GERBER
:
SelectD_CODE_For_LineDraw
(
thickness
);
SelectD_CODE_For_LineDraw
(
thickness
);
PlotCircle_GERBER
(
centre
,
radius
,
thickness
);
break
;
...
...
@@ -755,7 +759,7 @@ void PlotPolygon( int format_plot, int nbpoints, int* coord, int width )
switch
(
format_plot
)
{
case
PLOT_FORMAT_GERBER
:
SelectD_CODE_For_LineDraw
(
width
);
SelectD_CODE_For_LineDraw
(
width
);
PlotPolygon_GERBER
(
nbpoints
,
coord
,
width
);
break
;
...
...
@@ -812,7 +816,7 @@ void PlotArc( int format_plot, wxPoint centre, int start_angle, int end_angle,
RotatePoint
(
&
ox
,
&
oy
,
start_angle
);
if
(
format_plot
==
PLOT_FORMAT_GERBER
)
SelectD_CODE_For_LineDraw
(
thickness
);
SelectD_CODE_For_LineDraw
(
thickness
);
delta
=
120
;
/* un cercle sera trace en 3600/delta = 30 segments / cercle*/
for
(
ii
=
start_angle
+
delta
;
ii
<
end_angle
;
ii
+=
delta
)
...
...
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