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
3e477651
Commit
3e477651
authored
Mar 18, 2009
by
charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
finishing work on hpgl plotting functions
parent
f9642fd4
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
299 additions
and
358 deletions
+299
-358
pcbplot.h
pcbnew/pcbplot.h
+86
-78
plot_rtn.cpp
pcbnew/plot_rtn.cpp
+136
-95
plothpgl.cpp
pcbnew/plothpgl.cpp
+77
-185
No files found.
pcbnew/pcbplot.h
View file @
3e477651
/************/
/* pcbplot.h*/
/************/
/************/
/* pcbplot.h*/
/************/
#ifndef PCBPLOT_H
#define PCBPLOT_H
...
...
@@ -36,7 +36,7 @@ eda_global int g_Plot_Mode // = FILAIRE, FILL or SKETCH
=
FILLED
#endif
;
eda_global
bool
Plot_Set_MIROIR
;
eda_global
bool
Plot_Set_MIROIR
;
eda_global
bool
Sel_Rotate_Window
;
eda_global
bool
HPGL_Org_Centre
;
// TRUE si en HPGL, l'origine le centre de la feuille
eda_global
int
g_PlotPSColorOpt
;
// True for color Postscript output
...
...
@@ -66,11 +66,11 @@ eda_global bool PlotPadsOnSilkLayer /* Plot pads sur couche serigraphie */
#endif
;
eda_global
bool
Plot_Pads_All_Layers
;
/* Plot pads meme n'appartenant pas a la
couche ( utile pour serigraphie) */
*
couche ( utile pour serigraphie) */
/* Variables utiles */
/* Variables utiles */
eda_global
FILE
*
dest
;
eda_global
FILE
*
dest
;
/* Gestion des plumes en plot format HPGL */
eda_global
int
g_HPGL_Pen_Num
/* num de plume a charger */
...
...
@@ -87,11 +87,11 @@ eda_global int g_HPGL_Pen_Diam; /* diametre en mils */
eda_global
int
g_HPGL_Pen_Recouvrement
;
/* recouvrement en mils ( pour remplissages */
/* Gestion des cadrages et echelles de trace */
eda_global
float
Scale_X
,
Scale_Y
;
/* coeff d'agrandissement en X et Y demandes */
eda_global
float
Scale_X
,
Scale_Y
;
/* coeff d'agrandissement en X et Y demandes */
eda_global
wxPoint
g_PlotOffset
;
/* Offset de trace modifies par l'echelle */
eda_global
int
g_PlotLine_Width
;
/* Largeur du trait en mode filaire (utilise en serigraphie,
pour traces en mode sketch et filaire) */
*
pour traces en mode sketch et filaire) */
eda_global
int
g_PlotFormat
/* id for plot format (see enum PlotFormat in plot_common.h) */
#ifdef MAIN
...
...
@@ -99,9 +99,9 @@ eda_global int g_PlotFormat /* id for plot format (see enum PlotFormat in plot_
#endif
;
eda_global
int
g_PlotOrient
;
/* numero de code de l'orientation du trace ( voir
defines precedents):
0 = normal
PLOT_MIROIR = MIROIR
*
defines precedents):
*
0 = normal
*
PLOT_MIROIR = MIROIR
*/
eda_global
int
g_PlotScaleOpt
// 0 = automatique, >=1 echelle specifiee
#ifdef MAIN
...
...
@@ -111,14 +111,14 @@ eda_global int g_PlotScaleOpt // 0 = automatique, >=1 echelle specifiee
eda_global
int
g_DrillShapeOpt
#ifdef MAIN
=
1
// 0 = no drill mark, 1 = small mark, 2 = real drill
=
1
// 0 = no drill mark, 1 = small mark, 2 = real drill
#endif
;
/*************************************/
/* Constantes utiles en trace GERBER */
/*************************************/
/*************************************/
/* Constantes utiles en trace GERBER */
/*************************************/
/* codes de type de forme d'outils */
#define GERB_CIRCLE 1
...
...
@@ -128,56 +128,64 @@ eda_global int g_DrillShapeOpt
#define GERB_DONUT 5
/* PLOT_RTN.CC */
void
PlotTextePcb
(
TEXTE_PCB
*
pt_texte
,
int
format_plot
,
int
masque_layer
);
/* Trace 1 Texte type PCB , c.a.d autre que les textes sur modules,
prepare les parametres de trace de texte */
void
PlotArc
(
int
format_plot
,
wxPoint
centre
,
int
start_angle
,
int
end_angle
,
int
rayon
,
int
width
);
void
PlotCircle
(
int
format_plot
,
int
width
,
wxPoint
centre
,
int
rayon
);
void
PlotFilledPolygon
(
int
format_plot
,
int
nbpoints
,
int
*
coord
);
void
PlotPolygon
(
int
format_plot
,
int
nbpoints
,
int
*
coord
,
int
width
);
void
PlotTextePcb
(
TEXTE_PCB
*
pt_texte
,
int
format_plot
,
int
masque_layer
);
void
PlotDrawSegment
(
DRAWSEGMENT
*
PtSegm
,
int
format_plot
,
int
masque_layer
);
/* Trace 1 Texte type PCB , c.a.d autre que les textes sur modules,
* prepare les parametres de trace de texte */
void
PlotArc
(
int
format_plot
,
wxPoint
centre
,
int
start_angle
,
int
end_angle
,
int
rayon
,
int
width
);
void
PlotCircle
(
int
format_plot
,
int
width
,
wxPoint
centre
,
int
rayon
);
void
PlotFilledPolygon
(
int
format_plot
,
int
nbpoints
,
int
*
coord
);
void
PlotPolygon
(
int
format_plot
,
int
nbpoints
,
int
*
coord
,
int
width
);
void
PlotCotation
(
COTATION
*
Cotation
,
int
format_plot
,
int
masque_layer
);
void
PlotDrawSegment
(
DRAWSEGMENT
*
PtSegm
,
int
format_plot
,
int
masque_layer
);
void
PlotMirePcb
(
MIREPCB
*
PtMire
,
int
format_plot
,
int
masque_layer
);
void
PlotCotation
(
COTATION
*
Cotation
,
int
format_plot
,
int
masque_layer
);
void
Plot_1_EdgeModule
(
int
format_plot
,
EDGE_MODULE
*
PtEdge
);
void
PlotMirePcb
(
MIREPCB
*
PtMire
,
int
format_plot
,
int
masque_layer
);
void
PlotFilledAreas
(
ZONE_CONTAINER
*
aZone
,
int
aFormat
);
void
Plot_1_EdgeModule
(
int
format_plot
,
EDGE_MODULE
*
PtEdge
);
void
PlotFilledAreas
(
ZONE_CONTAINER
*
aZone
,
int
aFormat
);
/* PLOTGERB.CPP */
void
SelectD_CODE_For_LineDraw
(
int
aSize
);
void
trace_1_contour_GERBER
(
wxPoint
pos
,
wxSize
size
,
wxSize
delta
,
int
penwidth
,
int
orient
);
/* Trace 1 contour rectangulaire ou trapezoidal d'orientation quelconque
donne par son centre, ses dimensions,
ses variations, l'epaisseur du trait et son orientation orient */
void
trace_1_contour_GERBER
(
wxPoint
pos
,
wxSize
size
,
wxSize
delta
,
int
penwidth
,
int
orient
);
/* Trace 1 contour rectangulaire ou trapezoidal d'orientation quelconque
* donne par son centre, ses dimensions,
* ses variations, l'epaisseur du trait et son orientation orient */
/* PLOTHPGL.CC */
void
trace_1_segment_HPGL
(
int
pos_X0
,
int
pos_Y0
,
int
pos_X1
,
int
pos_Y1
,
int
hauteur
);
/* PLOTHPGL.CPP */
void
trace_1_pad_TRAPEZE_HPGL
(
wxPoint
padpos
,
wxSize
size
,
wxSize
delta
,
int
orient
,
int
modetrace
);
/** Function Plot a filled segment (track)
* @param aStart = starting point
* @param aEnd = ending point
* @param aWidth = segment width (thickness)
* @param aPlotMode = FILLED, SKETCH ..
* @return true if Ok, false if aWidth > pen size (the segment is always plotted)
*/
bool
Plot_Filled_Segment_HPGL
(
wxPoint
aStart
,
wxPoint
aEnd
,
int
aWidth
,
GRFillMode
aPlotMode
);
void
trace_1_pastille_RONDE_HPGL
(
wxPoint
padpos
,
int
diametre
,
int
modetrace
)
;
void
trace_1_pastille_OVALE_HPGL
(
wxPoint
padpos
,
wxSize
size
,
int
orient
,
int
modetrace
);
void
PlotRectangularPad_HPGL
(
wxPoint
padpos
,
wxSize
padsize
,
int
orient
,
int
modetrace
);
void
trace_1_pad_TRAPEZE_HPGL
(
wxPoint
padpos
,
wxSize
size
,
wxSize
delta
,
int
orient
,
int
modetrace
);
void
trace_1_pastille_RONDE_HPGL
(
wxPoint
padpos
,
int
diametre
,
int
modetrace
);
void
trace_1_pastille_OVALE_HPGL
(
wxPoint
padpos
,
wxSize
size
,
int
orient
,
int
modetrace
);
void
PlotRectangularPad_HPGL
(
wxPoint
padpos
,
wxSize
padsize
,
int
orient
,
int
modetrace
);
/**************/
/* PLOTPS.CPP */
/**************/
void
trace_1_pastille_OVALE_POST
(
wxPoint
centre
,
wxSize
size
,
int
orient
,
int
modetrace
);
void
trace_1_pastille_RONDE_POST
(
wxPoint
centre
,
int
diametre
,
int
modetrace
);
void
trace_1_pad_rectangulaire_POST
(
wxPoint
centre
,
wxSize
size
,
int
orient
,
int
modetrace
);
void
trace_1_contour_POST
(
wxPoint
centre
,
wxSize
size
,
wxSize
delta
,
int
dim_trait
,
int
orient
);
void
trace_1_pad_TRAPEZE_POST
(
wxPoint
centre
,
wxSize
size
,
wxSize
delta
,
int
orient
,
int
modetrace
);
void
trace_1_pastille_OVALE_POST
(
wxPoint
centre
,
wxSize
size
,
int
orient
,
int
modetrace
);
void
trace_1_pastille_RONDE_POST
(
wxPoint
centre
,
int
diametre
,
int
modetrace
);
void
trace_1_pad_rectangulaire_POST
(
wxPoint
centre
,
wxSize
size
,
int
orient
,
int
modetrace
);
void
trace_1_contour_POST
(
wxPoint
centre
,
wxSize
size
,
wxSize
delta
,
int
dim_trait
,
int
orient
);
void
trace_1_pad_TRAPEZE_POST
(
wxPoint
centre
,
wxSize
size
,
wxSize
delta
,
int
orient
,
int
modetrace
);
#endif
/* #define PCBPLOT_H */
pcbnew/plot_rtn.cpp
View file @
3e477651
...
...
@@ -107,6 +107,7 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( int format_plot,
trace_1_pastille_RONDE_POST
(
pos
,
size
.
x
,
FILAIRE
);
break
;
}
break
;
case
PAD_OVAL
:
...
...
@@ -129,6 +130,7 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( int format_plot,
pt_pad
->
m_Orient
,
FILAIRE
);
break
;
}
break
;
case
PAD_TRAPEZOID
:
...
...
@@ -156,6 +158,7 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( int format_plot,
FILAIRE
);
break
;
}
break
;
}
...
...
@@ -179,6 +182,7 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( int format_plot,
(
int
)
pt_pad
->
m_Orient
,
FILAIRE
);
break
;
}
break
;
}
}
...
...
@@ -200,7 +204,7 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( int format_plot,
wxString
errMsg
;
errMsg
.
Printf
(
_
(
"Your BOARD has a bad layer number of %u for module
\n
%s's
\"
reference
\"
text."
),
_
(
"Your BOARD has a bad layer number of %u for module
\n
%s's
\"
reference
\"
text."
),
textLayer
,
Module
->
GetReference
().
GetData
()
);
DisplayError
(
this
,
errMsg
);
goto
exit
;
...
...
@@ -220,7 +224,7 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( int format_plot,
wxString
errMsg
;
errMsg
.
Printf
(
_
(
"Your BOARD has a bad layer number of %u for module
\n
%s's
\"
value
\"
text."
),
_
(
"Your BOARD has a bad layer number of %u for module
\n
%s's
\"
value
\"
text."
),
textLayer
,
Module
->
GetReference
().
GetData
()
);
DisplayError
(
this
,
errMsg
);
goto
exit
;
...
...
@@ -260,13 +264,14 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( int format_plot,
wxString
errMsg
;
errMsg
.
Printf
(
_
(
"Your BOARD has a bad layer number of %u for module
\n
%s's
\"
module text
\"
text of %s."
),
_
(
"Your BOARD has a bad layer number of %u for module
\n
%s's
\"
module text
\"
text of %s."
),
textLayer
,
Module
->
GetReference
().
GetData
(),
pt_texte
->
m_Text
.
GetData
()
);
DisplayError
(
this
,
errMsg
);
goto
exit
;
}
if
(
!
(
(
1
<<
textLayer
)
&
masque_layer
)
)
if
(
!
(
(
1
<<
textLayer
)
&
masque_layer
)
)
continue
;
PlotTextModule
(
pt_texte
,
format_plot
);
...
...
@@ -276,10 +281,10 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( int format_plot,
/* Plot filled ares */
for
(
int
ii
=
0
;
ii
<
m_Pcb
->
GetAreaCount
();
ii
++
)
{
ZONE_CONTAINER
*
edge_zone
=
m_Pcb
->
GetArea
(
ii
);
if
(
(
(
1
<<
edge_zone
->
GetLayer
()
)
&
masque_layer
)
==
0
)
ZONE_CONTAINER
*
edge_zone
=
m_Pcb
->
GetArea
(
ii
);
if
(
(
(
1
<<
edge_zone
->
GetLayer
()
)
&
masque_layer
)
==
0
)
continue
;
PlotFilledAreas
(
edge_zone
,
format_plot
);
PlotFilledAreas
(
edge_zone
,
format_plot
);
}
exit
:
...
...
@@ -311,7 +316,7 @@ static void PlotTextModule( TEXTE_MODULE* pt_texte, int format_plot )
switch
(
format_plot
)
{
case
PLOT_FORMAT_GERBER
:
SelectD_CODE_For_LineDraw
(
thickness
);
SelectD_CODE_For_LineDraw
(
thickness
);
break
;
case
PLOT_FORMAT_HPGL
:
...
...
@@ -473,7 +478,7 @@ void Plot_1_EdgeModule( int format_plot, EDGE_MODULE* PtEdge )
if
(
g_Plot_Mode
==
FILAIRE
)
{
thickness
=
g_PlotLine_Width
;
wxLogDebug
(
wxT
(
"changing edgemodule thickness to g_PlotLine_Width"
)
);
wxLogDebug
(
wxT
(
"changing edgemodule thickness to g_PlotLine_Width"
)
);
}
pos
=
PtEdge
->
m_Start
;
...
...
@@ -487,12 +492,12 @@ void Plot_1_EdgeModule( int format_plot, EDGE_MODULE* PtEdge )
switch
(
format_plot
)
{
case
PLOT_FORMAT_GERBER
:
SelectD_CODE_For_LineDraw
(
thickness
);
SelectD_CODE_For_LineDraw
(
thickness
);
PlotGERBERLine
(
pos
,
end
,
thickness
);
break
;
case
PLOT_FORMAT_HPGL
:
trace_1_segment_HPGL
(
pos
.
x
,
pos
.
y
,
end
.
x
,
end
.
y
,
thickness
);
Plot_Filled_Segment_HPGL
(
pos
,
end
,
thickness
,
(
GRFillMode
)
g_Plot_Mode
);
break
;
case
PLOT_FORMAT_POST
:
...
...
@@ -582,7 +587,7 @@ void PlotTextePcb( TEXTE_PCB* pt_texte, int format_plot, int masque_layer )
switch
(
format_plot
)
{
case
PLOT_FORMAT_GERBER
:
SelectD_CODE_For_LineDraw
(
thickness
);
SelectD_CODE_For_LineDraw
(
thickness
);
break
;
case
PLOT_FORMAT_HPGL
:
...
...
@@ -602,10 +607,11 @@ void PlotTextePcb( TEXTE_PCB* pt_texte, int format_plot, int masque_layer )
/*********************************************************/
void
PlotFilledAreas
(
ZONE_CONTAINER
*
aZone
,
int
aFormat
)
void
PlotFilledAreas
(
ZONE_CONTAINER
*
aZone
,
int
aFormat
)
/*********************************************************/
/* Plot areas (given by .m_FilledPolysList member) in a zone
*/
*/
{
static
int
*
CornersBuffer
=
NULL
;
static
unsigned
CornersBufferSize
=
0
;
...
...
@@ -615,6 +621,8 @@ void PlotFilledAreas( ZONE_CONTAINER * aZone, int aFormat )
return
;
// We need a buffer to store corners coordinates:
imax
++
;
// provide room to sore an extra coordinte to close the ploygon
if
(
CornersBuffer
==
NULL
)
{
CornersBufferSize
=
imax
*
4
;
...
...
@@ -627,6 +635,8 @@ void PlotFilledAreas( ZONE_CONTAINER * aZone, int aFormat )
CornersBuffer
=
(
int
*
)
realloc
(
CornersBuffer
,
CornersBufferSize
*
sizeof
(
int
)
);
}
imax
--
;
// Plot all filled areas
int
corners_count
=
0
;
for
(
unsigned
ic
=
0
,
ii
=
0
;
ic
<
imax
;
ic
++
)
...
...
@@ -635,11 +645,21 @@ void PlotFilledAreas( ZONE_CONTAINER * aZone, int aFormat )
CornersBuffer
[
ii
++
]
=
corner
->
x
;
CornersBuffer
[
ii
++
]
=
corner
->
y
;
corners_count
++
;
if
(
corner
->
end_contour
)
{
// Plot the current filled area
if
(
aZone
->
m_FillMode
==
0
)
// We are using solid polygons (if != 0: using segments in m_Zone)
if
(
corner
->
end_contour
)
// Plot the current filled area outline
{
// First, close the outline
if
(
CornersBuffer
[
0
]
!=
CornersBuffer
[
ii
-
2
]
||
CornersBuffer
[
1
]
!=
CornersBuffer
[
ii
-
1
]
)
{
CornersBuffer
[
ii
++
]
=
CornersBuffer
[
0
];
CornersBuffer
[
ii
]
=
CornersBuffer
[
1
];
corners_count
++
;
}
// Plot the current filled area outline
if
(
aZone
->
m_FillMode
==
0
)
// We are using solid polygons (if != 0: using segments in m_Zone)
PlotFilledPolygon
(
aFormat
,
corners_count
,
CornersBuffer
);
if
(
aZone
->
m_ZoneMinThickness
>
0
)
if
(
aZone
->
m_ZoneMinThickness
>
0
)
PlotPolygon
(
aFormat
,
corners_count
,
CornersBuffer
,
aZone
->
m_ZoneMinThickness
);
corners_count
=
0
;
ii
=
0
;
...
...
@@ -647,6 +667,7 @@ void PlotFilledAreas( ZONE_CONTAINER * aZone, int aFormat )
}
}
/******************************************************************************/
void
PlotDrawSegment
(
DRAWSEGMENT
*
pt_segm
,
int
Format
,
int
masque_layer
)
/******************************************************************************/
...
...
@@ -686,7 +707,7 @@ void PlotDrawSegment( DRAWSEGMENT* pt_segm, int Format, int masque_layer )
switch
(
Format
)
{
case
PLOT_FORMAT_GERBER
:
SelectD_CODE_For_LineDraw
(
thickness
);
SelectD_CODE_For_LineDraw
(
thickness
);
if
(
pt_segm
->
m_Shape
==
S_CIRCLE
)
PlotCircle
(
PLOT_FORMAT_GERBER
,
thickness
,
start
,
radius
);
else
if
(
pt_segm
->
m_Shape
==
S_ARC
)
...
...
@@ -702,7 +723,7 @@ void PlotDrawSegment( DRAWSEGMENT* pt_segm, int Format, int masque_layer )
else
if
(
pt_segm
->
m_Shape
==
S_ARC
)
PlotArc
(
PLOT_FORMAT_HPGL
,
start
,
StAngle
,
EndAngle
,
radius
,
thickness
);
else
trace_1_segment_HPGL
(
start
.
x
,
start
.
y
,
end
.
x
,
end
.
y
,
thickness
);
Plot_Filled_Segment_HPGL
(
start
,
end
,
thickness
,
(
GRFillMode
)
g_Plot_Mode
);
break
;
case
PLOT_FORMAT_POST
:
...
...
@@ -726,7 +747,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
;
...
...
@@ -762,20 +783,44 @@ void PlotFilledPolygon( int format_plot, int nbpoints, int* coord )
}
}
/**********************************************************************/
void
PlotPolygon
(
int
format_plot
,
int
nbpoints
,
int
*
coord
,
int
width
)
/**********************************************************************/
/* plot a polygon */
/* plot a non filled polygon
*/
{
switch
(
format_plot
)
{
case
PLOT_FORMAT_GERBER
:
SelectD_CODE_For_LineDraw
(
width
);
SelectD_CODE_For_LineDraw
(
width
);
PlotPolygon_GERBER
(
nbpoints
,
coord
,
width
);
break
;
case
PLOT_FORMAT_HPGL
:
PlotPolyHPGL
(
nbpoints
,
coord
,
false
,
width
);
{
// Compute pen_dim (from g_HPGL_Pen_Diam in mils) in pcb units,
// with plot scale (if Scale is 2, pen diametre is always g_HPGL_Pen_Diam
// so apparent pen diam is real pen diam / Scale
int
pen_diam
=
(
int
)
round
(
(
g_HPGL_Pen_Diam
*
U_PCB
)
/
Scale_X
);
// Assume Scale_X # Scale_Y
wxString
msg
;
if
(
pen_diam
>=
width
)
PlotPolyHPGL
(
nbpoints
,
coord
,
false
,
width
);
// PlotPolyHPGL does not handle width
else
{
wxPoint
start
,
end
;
start
.
x
=
*
coord
++
;
start
.
y
=
*
coord
++
;
for
(
int
ii
=
1
;
ii
<
nbpoints
;
ii
++
)
{
end
.
x
=
*
coord
++
;
end
.
y
=
*
coord
++
;
Plot_Filled_Segment_HPGL
(
start
,
end
,
width
,
(
GRFillMode
)
g_Plot_Mode
);
start
=
end
;
}
}
}
break
;
case
PLOT_FORMAT_POST
:
...
...
@@ -826,8 +871,8 @@ 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
);
if
(
format_plot
==
PLOT_FORMAT_GERBER
)
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
)
...
...
@@ -845,11 +890,9 @@ void PlotArc( int format_plot, wxPoint centre, int start_angle, int end_angle,
break
;
case
PLOT_FORMAT_HPGL
:
trace_1_segment_HPGL
(
centre
.
x
+
ox
,
centre
.
y
+
oy
,
centre
.
x
+
fx
,
centre
.
y
+
fy
,
thickness
);
Plot_Filled_Segment_HPGL
(
wxPoint
(
centre
.
x
+
ox
,
centre
.
y
+
oy
),
wxPoint
(
centre
.
x
+
fx
,
centre
.
y
+
fy
),
thickness
,
(
GRFillMode
)
g_Plot_Mode
);
break
;
case
PLOT_FORMAT_POST
:
...
...
@@ -873,11 +916,9 @@ void PlotArc( int format_plot, wxPoint centre, int start_angle, int end_angle,
break
;
case
PLOT_FORMAT_HPGL
:
trace_1_segment_HPGL
(
centre
.
x
+
ox
,
centre
.
y
+
oy
,
centre
.
x
+
fx
,
centre
.
y
+
fy
,
thickness
);
Plot_Filled_Segment_HPGL
(
wxPoint
(
centre
.
x
+
ox
,
centre
.
y
+
oy
),
wxPoint
(
centre
.
x
+
fx
,
centre
.
y
+
fy
),
thickness
,
(
GRFillMode
)
g_Plot_Mode
);
break
;
case
PLOT_FORMAT_POST
:
...
...
pcbnew/plothpgl.cpp
View file @
3e477651
...
...
@@ -70,7 +70,7 @@ void WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer )
return
;
}
SetLocaleTo_C_standard
(
);
SetLocaleTo_C_standard
();
Affiche_1_Parametre
(
this
,
0
,
_
(
"File"
),
FullFileName
,
CYAN
);
...
...
@@ -186,7 +186,7 @@ void WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer )
/* fin */
CloseFileHPGL
(
dest
);
SetLocaleTo_Default
(
);
SetLocaleTo_Default
();
}
...
...
@@ -346,78 +346,86 @@ void WinEDA_BasePcbFrame::Plot_Layer_HPGL( FILE* File, int masque_layer,
if
(
pts
->
Type
()
==
TYPE_VIA
)
continue
;
if
(
(
g_TabOneLayerMask
[
pts
->
GetLayer
()]
&
masque_layer
)
==
0
)
continue
;
size
.
x
=
size
.
y
=
pts
->
m_Width
;
start
=
pts
->
m_Start
;
end
=
pts
->
m_End
;
if
(
size
.
x
>
pen_diam
)
/* c.a.d si largeur piste > diam plume */
trace_1_pastille_RONDE_HPGL
(
start
,
size
.
x
,
modetrace
);
/* Trace d'un segment de piste */
trace_1_segment_HPGL
(
start
.
x
,
start
.
y
,
end
.
x
,
end
.
y
,
size
.
x
);
/* Complement de Trace en mode Remplissage */
if
(
(
g_Plot_Mode
==
FILLED
)
&&
(
pen_diam
<=
size
.
x
)
)
{
while
(
(
size
.
x
-=
(
int
)
(
(
pen_rayon
-
pen_recouvrement
)
*
2
)
)
>
0
)
{
trace_1_segment_HPGL
(
start
.
x
,
start
.
y
,
end
.
x
,
end
.
y
,
MAX
(
size
.
x
,
pen_diam
)
);
}
}
if
(
size
.
x
>
pen_diam
)
trace_1_pastille_RONDE_HPGL
(
end
,
size
.
x
,
modetrace
);
if
(
(
g_TabOneLayerMask
[
pts
->
GetLayer
()]
&
masque_layer
)
)
Plot_Filled_Segment_HPGL
(
pts
->
m_Start
,
pts
->
m_End
,
pts
->
m_Width
,
(
GRFillMode
)
g_Plot_Mode
);
}
/* trace des segments pistes et zones */
for
(
pts
=
m_Pcb
->
m_Zone
;
pts
!=
NULL
;
pts
=
pts
->
Next
()
)
{
if
(
g_TabOneLayerMask
[
pts
->
GetLayer
()]
&
masque_layer
)
if
(
(
g_TabOneLayerMask
[
pts
->
GetLayer
()]
&
masque_layer
)
)
Plot_Filled_Segment_HPGL
(
pts
->
m_Start
,
pts
->
m_End
,
pts
->
m_Width
,
(
GRFillMode
)
g_Plot_Mode
);
}
/* Plot filled ares */
for
(
int
ii
=
0
;
ii
<
m_Pcb
->
GetAreaCount
();
ii
++
)
{
size
.
x
=
size
.
y
=
pts
->
m_Width
;
start
=
pts
->
m_Start
;
end
=
pts
->
m_End
;
ZONE_CONTAINER
*
zone
=
m_Pcb
->
GetArea
(
ii
);
if
(
(
(
1
<<
zone
->
GetLayer
()
)
&
masque_layer
)
==
0
)
continue
;
PlotFilledAreas
(
zone
,
PLOT_FORMAT_HPGL
);
}
}
if
(
size
.
x
>
pen_diam
)
/* c.a.d si largeur piste > diam plume */
trace_1_pastille_RONDE_HPGL
(
start
,
size
.
x
,
modetrace
);
/* Trace d'un segment de piste */
trace_1_segment_HPGL
(
start
.
x
,
start
.
y
,
end
.
x
,
end
.
y
,
size
.
x
);
/* Complement de Trace en mode Remplissage */
if
(
(
g_Plot_Mode
==
FILLED
)
&&
(
pen_diam
<=
size
.
x
)
)
{
while
(
(
size
.
x
-=
(
int
)
(
(
pen_rayon
-
pen_recouvrement
)
*
2
)
)
>
0
)
/*********************************************************************************************/
bool
Plot_Filled_Segment_HPGL
(
wxPoint
aStart
,
wxPoint
aEnd
,
int
aWidth
,
GRFillMode
aPlotMode
)
/*********************************************************************************************/
/** Function Plot a filled segment (track)
* @param aStart = starting point
* @param aEnd = ending point
* @param aWidth = segment width (thickness)
* @param aPlotMode = FILLED, SKETCH ..
* @return true if Ok, false if aWidth > pen size (the segment is always plotted)
*/
{
wxPoint
center
;
wxSize
size
;
int
orient
;
if
(
(
pen_diam
>=
aWidth
)
||
(
g_Plot_Mode
==
FILAIRE
)
)
/* just a line is Ok */
{
trace_1_segment_HPGL
(
start
.
x
,
start
.
y
,
end
.
x
,
end
.
y
,
MAX
(
size
.
x
,
pen_diam
)
);
}
Move_Plume_HPGL
(
aStart
,
'U'
);
Move_Plume_HPGL
(
aEnd
,
'D'
);
Plume_HPGL
(
'U'
);
return
pen_diam
<=
aWidth
;;
}
if
(
size
.
x
>
pen_diam
)
trace_1_pastille_RONDE_HPGL
(
end
,
size
.
x
,
modetrace
);
}
}
// A segment is like an oval pal, so use trace_1_pastille_OVALE_HPGL to do the work.
center
.
x
=
(
aStart
.
x
+
aEnd
.
x
)
/
2
;
center
.
y
=
(
aStart
.
y
+
aEnd
.
y
)
/
2
;
size
.
x
=
aEnd
.
x
-
aStart
.
x
;
size
.
y
=
aEnd
.
y
-
aStart
.
y
;
if
(
size
.
y
==
0
)
orient
=
0
;
else
if
(
size
.
x
==
0
)
orient
=
900
;
else
orient
=
-
(
int
)
(
atan2
(
(
double
)
size
.
y
,
(
double
)
size
.
x
)
*
1800.0
/
M_PI
);
size
.
x
=
(
int
)
sqrt
(
((
double
)
size
.
x
*
size
.
x
)
+
((
double
)
size
.
y
*
size
.
y
)
)
+
aWidth
;
// module.
size
.
y
=
aWidth
;
trace_1_pastille_OVALE_HPGL
(
center
,
size
,
orient
,
aPlotMode
);
return
pen_diam
<=
aWidth
;
}
/************************************************************************************/
void
trace_1_pastille_OVALE_HPGL
(
wxPoint
pos
,
wxSize
size
,
int
o
rient
,
int
modetrace
)
void
trace_1_pastille_OVALE_HPGL
(
wxPoint
pos
,
wxSize
size
,
int
aO
rient
,
int
modetrace
)
/************************************************************************************/
/* Trace 1 pastille PAD_OVAL en position pos_X,Y , de dim size.x, size.y */
{
int
rayon
,
deltaxy
,
cx
,
cy
;
int
trace_orient
=
orient
;
/* la pastille est ramenee a une pastille ovale avec size.y > size.x
* ( ovale vertical en orientation 0 ) */
if
(
size
.
x
>
size
.
y
)
{
EXCHG
(
size
.
x
,
size
.
y
);
trace_o
rient
+=
900
;
if
(
o
rient
>=
3600
)
trace_o
rient
-=
3600
;
EXCHG
(
size
.
x
,
size
.
y
);
aO
rient
+=
900
;
if
(
aO
rient
>=
3600
)
aO
rient
-=
3600
;
}
deltaxy
=
size
.
y
-
size
.
x
;
/* = distance entre centres de l'ovale */
rayon
=
size
.
x
/
2
;
...
...
@@ -425,41 +433,41 @@ void trace_1_pastille_OVALE_HPGL( wxPoint pos, wxSize size, int orient, int mode
if
(
modetrace
==
FILLED
)
{
PlotRectangularPad_HPGL
(
pos
,
wxSize
(
size
.
x
,
deltaxy
),
o
rient
,
modetrace
);
aO
rient
,
modetrace
);
cx
=
0
;
cy
=
deltaxy
/
2
;
RotatePoint
(
&
cx
,
&
cy
,
trace_o
rient
);
RotatePoint
(
&
cx
,
&
cy
,
aO
rient
);
trace_1_pastille_RONDE_HPGL
(
wxPoint
(
cx
+
pos
.
x
,
cy
+
pos
.
y
),
size
.
x
,
modetrace
);
Plume_HPGL
(
'U'
);
cx
=
0
;
cy
=
-
deltaxy
/
2
;
RotatePoint
(
&
cx
,
&
cy
,
trace_o
rient
);
RotatePoint
(
&
cx
,
&
cy
,
aO
rient
);
trace_1_pastille_RONDE_HPGL
(
wxPoint
(
cx
+
pos
.
x
,
cy
+
pos
.
y
),
size
.
x
,
modetrace
);
}
else
/* Trace en mode
FILAIRE
*/
else
/* Trace en mode
SKETCH
*/
{
cx
=
-
rayon
;
cy
=
-
deltaxy
/
2
;
RotatePoint
(
&
cx
,
&
cy
,
trace_o
rient
);
RotatePoint
(
&
cx
,
&
cy
,
aO
rient
);
Move_Plume_HPGL
(
wxPoint
(
cx
+
pos
.
x
,
cy
+
pos
.
y
),
'U'
);
cx
=
-
rayon
;
cy
=
deltaxy
/
2
;
RotatePoint
(
&
cx
,
&
cy
,
trace_o
rient
);
RotatePoint
(
&
cx
,
&
cy
,
aO
rient
);
Move_Plume_HPGL
(
wxPoint
(
cx
+
pos
.
x
,
cy
+
pos
.
y
),
'D'
);
cx
=
rayon
;
cy
=
-
deltaxy
/
2
;
RotatePoint
(
&
cx
,
&
cy
,
trace_o
rient
);
RotatePoint
(
&
cx
,
&
cy
,
aO
rient
);
Move_Plume_HPGL
(
wxPoint
(
cx
+
pos
.
x
,
cy
+
pos
.
y
),
'U'
);
cx
=
rayon
;
cy
=
deltaxy
/
2
;
RotatePoint
(
&
cx
,
&
cy
,
trace_o
rient
);
RotatePoint
(
&
cx
,
&
cy
,
aO
rient
);
Move_Plume_HPGL
(
wxPoint
(
cx
+
pos
.
x
,
cy
+
pos
.
y
),
'D'
);
Plume_HPGL
(
'U'
);
cx
=
0
;
cy
=
-
deltaxy
/
2
;
RotatePoint
(
&
cx
,
&
cy
,
trace_o
rient
);
cx
=
0
;
cy
=
deltaxy
/
2
;
RotatePoint
(
&
cx
,
&
cy
,
aO
rient
);
PlotArc
(
PLOT_FORMAT_HPGL
,
wxPoint
(
cx
+
pos
.
x
,
cy
+
pos
.
y
),
trace_orient
,
trace_orient
+
1800
,
-
aOrient
,
-
aOrient
-
1800
,
size
.
x
/
2
,
pen_diam
);
cx
=
0
;
cy
=
deltaxy
/
2
;
RotatePoint
(
&
cx
,
&
cy
,
trace_o
rient
);
cx
=
0
;
cy
=
-
deltaxy
/
2
;
RotatePoint
(
&
cx
,
&
cy
,
aO
rient
);
PlotArc
(
PLOT_FORMAT_HPGL
,
wxPoint
(
cx
+
pos
.
x
,
cy
+
pos
.
y
),
trace_orient
+
1800
,
trace_o
rient
,
-
aOrient
-
1800
,
-
aO
rient
,
size
.
x
/
2
,
pen_diam
);
}
...
...
@@ -648,7 +656,7 @@ void trace_1_pad_TRAPEZE_HPGL( wxPoint padpos, wxSize size, wxSize delta,
wxPoint
coord
[
4
];
/* coord reelles des sommets du trapeze a tracer */
float
fangle
;
/* angle d'inclinaison des cotes du trapeze */
int
rayon
;
/* rayon de la plume */
int
moveX
,
moveY
;
/* variation de position plume selon axe X et Y , lors
int
moveX
,
moveY
;
/* variation de position plume selon axe X et Y , lors
* du remplissage du trapeze */
rayon
=
(
int
)
pen_rayon
;
if
(
modetrace
==
FILAIRE
)
...
...
@@ -761,119 +769,3 @@ void trace_1_pad_TRAPEZE_HPGL( wxPoint padpos, wxSize size, wxSize delta,
Plume_HPGL
(
'U'
);
}
/********************************************************************/
void
trace_1_segment_HPGL
(
int
pos_X0
,
int
pos_Y0
,
int
pos_X1
,
int
pos_Y1
,
int
epaisseur
)
/********************************************************************/
/* Trace 1 rectangle donne par son axe et son epaisseur (piste rectangulaire)
* en mode SKETCH
*/
{
float
alpha
;
/* angle de l'axe du rectangle */
wxSize
size
;
/* coord relatives a l'origine du segment de sa fin */
int
dh
;
/* demi epaisseur du segment compte tenu de la
* largeur de la plume */
int
dx_rot
;
/* coord du segment en repere modifie ( size.y_rot etant nul )*/
float
sin_alpha
,
cos_alpha
;
size
.
x
=
pos_X1
-
pos_X0
;
size
.
y
=
pos_Y1
-
pos_Y0
;
dh
=
(
epaisseur
-
(
int
)
pen_diam
)
/
2
;
if
(
dh
<
0
)
{
dh
=
0
;
s_Nb_Plot_Errors
++
;
}
if
(
(
dh
==
0
)
||
(
g_Plot_Mode
==
FILAIRE
)
)
/* Le trace se reduit a 1 trait */
{
Move_Plume_HPGL
(
wxPoint
(
pos_X0
,
pos_Y0
),
'U'
);
Move_Plume_HPGL
(
wxPoint
(
pos_X1
,
pos_Y1
),
'D'
);
Plume_HPGL
(
'U'
);
return
;
}
if
(
size
.
x
<
0
)
{
EXCHG
(
pos_X0
,
pos_X1
);
EXCHG
(
pos_Y0
,
pos_Y1
);
size
.
y
=
-
size
.
y
;
size
.
x
=
-
size
.
x
;
}
if
(
size
.
y
==
0
)
/* segment horizontal */
{
Move_Plume_HPGL
(
wxPoint
(
pos_X0
,
pos_Y0
-
dh
),
'U'
);
Move_Plume_HPGL
(
wxPoint
(
pos_X1
,
pos_Y1
-
dh
),
'D'
);
Move_Plume_HPGL
(
wxPoint
(
pos_X1
,
pos_Y1
+
dh
),
'D'
);
Move_Plume_HPGL
(
wxPoint
(
pos_X0
,
pos_Y0
+
dh
),
'D'
);
Move_Plume_HPGL
(
wxPoint
(
pos_X0
,
pos_Y0
-
dh
),
'D'
);
}
else
if
(
size
.
x
==
0
)
/* vertical */
{
if
(
size
.
y
<
0
)
dh
=
-
dh
;
Move_Plume_HPGL
(
wxPoint
(
pos_X0
-
dh
,
pos_Y0
),
'U'
);
Move_Plume_HPGL
(
wxPoint
(
pos_X1
-
dh
,
pos_Y1
),
'D'
);
Move_Plume_HPGL
(
wxPoint
(
pos_X1
+
dh
,
pos_Y1
),
'D'
);
Move_Plume_HPGL
(
wxPoint
(
pos_X0
+
dh
,
pos_Y0
),
'D'
);
Move_Plume_HPGL
(
wxPoint
(
pos_X0
-
dh
,
pos_Y0
),
'D'
);
}
else
/* piste inclinee */
{
/* On calcule les coord des extremites du rectangle dans le repere
* a axe x confondu avec l'axe du rect. puis on revient dans le repere
* de trace par 2 rotations inverses
* coord : xrot = x*cos + y*sin
* yrot = y*cos - x*sin
*
* avec ici yrot = 0 puisque le segment est horizontal dans le nouveau repere
* Transformee inverse :
* coord : x = xrot*cos - yrot*sin
* y = yrot*cos + xrot*sin
*/
int
dx0
,
dy0
,
dx1
,
dy1
;
if
(
size
.
x
==
size
.
y
)
/* alpah = 45 degre */
{
sin_alpha
=
cos_alpha
=
0.70711
;
}
else
if
(
size
.
x
==
-
size
.
y
)
/* alpah = -45 degre */
{
cos_alpha
=
0.70711
;
sin_alpha
=
-
0.70711
;
}
else
{
alpha
=
atan2
(
(
double
)
size
.
y
,
(
double
)
size
.
x
);
sin_alpha
=
sin
(
alpha
);
cos_alpha
=
cos
(
alpha
);
}
dx_rot
=
(
int
)
(
size
.
x
*
cos_alpha
+
size
.
y
*
sin_alpha
);
/* size.y_rot = (int)(size.y * cos_alpha - size.x * sin_alpha) ; doit etre NULL */
/* calcul du point de coord 0,-dh */
dx0
=
(
int
)
(
dh
*
sin_alpha
);
dy0
=
(
int
)
(
-
dh
*
cos_alpha
);
Move_Plume_HPGL
(
wxPoint
(
pos_X0
+
dx0
,
pos_Y0
+
dy0
),
'U'
);
/* calcul du point de coord size.xrot,-dh */
dx1
=
(
int
)
(
dx_rot
*
cos_alpha
+
dh
*
sin_alpha
);
dy1
=
(
int
)
(
-
dh
*
cos_alpha
+
dx_rot
*
sin_alpha
);
Move_Plume_HPGL
(
wxPoint
(
pos_X0
+
dx1
,
pos_Y0
+
dy1
),
'D'
);
/* calcul du point de coord size.xrot,+dh */
dx1
=
(
int
)
(
dx_rot
*
cos_alpha
-
dh
*
sin_alpha
);
dy1
=
(
int
)
(
dh
*
cos_alpha
+
dx_rot
*
sin_alpha
);
Move_Plume_HPGL
(
wxPoint
(
pos_X0
+
dx1
,
pos_Y0
+
dy1
),
'D'
);
/* calcul du point de coord 0,+dh */
dx1
=
(
int
)
(
-
dh
*
sin_alpha
);
dy1
=
(
int
)
(
dh
*
cos_alpha
);
Move_Plume_HPGL
(
wxPoint
(
pos_X0
+
dx1
,
pos_Y0
+
dy1
),
'D'
);
/* retour au point de depart */
Move_Plume_HPGL
(
wxPoint
(
pos_X0
+
dx0
,
pos_Y0
+
dy0
),
'D'
);
}
Plume_HPGL
(
'U'
);
}
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