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
86885a7a
Commit
86885a7a
authored
Dec 11, 2007
by
dickelbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dodge seg fault, caused by a bad layer number
parent
af80a3cb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
729 additions
and
649 deletions
+729
-649
plot_rtn.cpp
pcbnew/plot_rtn.cpp
+729
-649
No files found.
pcbnew/plot_rtn.cpp
View file @
86885a7a
/*********************************************************/
/*********************************************************/
/* Routines de trace: fonction communes aux diff formats */
/* Routines de trace: fonction communes aux diff formats */
/*********************************************************/
/*********************************************************/
/* Fichier PLOT_RTN.CPP*/
/* Fichier PLOT_RTN.CPP*/
...
@@ -19,588 +19,645 @@
...
@@ -19,588 +19,645 @@
/* Fonctions locales */
/* Fonctions locales */
static
void
Plot_Edges_Modules
(
BOARD
*
pcb
,
int
format_plot
,
int
masque_layer
);
static
void
Plot_Edges_Modules
(
BOARD
*
pcb
,
int
format_plot
,
int
masque_layer
);
static
void
PlotTextModule
(
TEXTE_MODULE
*
pt_texte
);
static
void
PlotTextModule
(
TEXTE_MODULE
*
pt_texte
);
/**********************************************************/
/**********************************************************/
void
WinEDA_BasePcbFrame
::
Plot_Serigraphie
(
int
format_plot
,
void
WinEDA_BasePcbFrame
::
Plot_Serigraphie
(
int
format_plot
,
FILE
*
File
,
int
masque_layer
)
FILE
*
File
,
int
masque_layer
)
/***********************************************************/
/***********************************************************/
/* Genere le trace des couches type serigraphie, en format HPGL ou GERBER*/
/* Genere le trace des couches type serigraphie, en format HPGL ou GERBER*/
{
{
wxPoint
pos
,
shape_pos
;
wxPoint
pos
,
shape_pos
;
wxSize
size
;
wxSize
size
;
bool
trace_val
,
trace_ref
;
bool
trace_val
,
trace_ref
;
MODULE
*
Module
;
MODULE
*
Module
;
D_PAD
*
pt_pad
;
D_PAD
*
pt_pad
;
TEXTE_MODULE
*
pt_texte
;
TEXTE_MODULE
*
pt_texte
;
EDA_BaseStruct
*
PtStruct
;
EDA_BaseStruct
*
PtStruct
;
wxString
msg
;
wxString
msg
;
/* Trace du contour du PCB et des Elements du type Drawings Pcb */
/* Trace du contour du PCB et des Elements du type Drawings Pcb */
PtStruct
=
m_Pcb
->
m_Drawings
;
PtStruct
=
m_Pcb
->
m_Drawings
;
for
(
;
PtStruct
!=
NULL
;
PtStruct
=
PtStruct
->
Pnext
)
for
(
;
PtStruct
!=
NULL
;
PtStruct
=
PtStruct
->
Pnext
)
{
{
switch
(
PtStruct
->
Type
()
)
switch
(
PtStruct
->
Type
()
)
{
{
case
TYPEDRAWSEGMENT
:
case
TYPEDRAWSEGMENT
:
PlotDrawSegment
(
(
DRAWSEGMENT
*
)
PtStruct
,
format_plot
,
masque_layer
);
PlotDrawSegment
(
(
DRAWSEGMENT
*
)
PtStruct
,
format_plot
,
masque_layer
);
// (Following line has been superceded by new commands elsewhere.)
// (Following line has been superceded by new commands elsewhere.)
// EDGE_LAYER | masque_layer );
// EDGE_LAYER | masque_layer );
break
;
break
;
case
TYPETEXTE
:
PlotTextePcb
(
(
TEXTE_PCB
*
)
PtStruct
,
format_plot
,
masque_layer
);
case
TYPETEXTE
:
PlotTextePcb
(
(
TEXTE_PCB
*
)
PtStruct
,
format_plot
,
masque_layer
);
// EDGE_LAYER | masque_layer );
// EDGE_LAYER | masque_layer );
break
;
break
;
case
TYPECOTATION
:
PlotCotation
(
(
COTATION
*
)
PtStruct
,
format_plot
,
masque_layer
);
case
TYPECOTATION
:
PlotCotation
(
(
COTATION
*
)
PtStruct
,
format_plot
,
masque_layer
);
// EDGE_LAYER | masque_layer );
// EDGE_LAYER | masque_layer );
break
;
break
;
case
TYPEMIRE
:
PlotMirePcb
(
(
MIREPCB
*
)
PtStruct
,
format_plot
,
masque_layer
);
case
TYPEMIRE
:
PlotMirePcb
(
(
MIREPCB
*
)
PtStruct
,
format_plot
,
masque_layer
);
// EDGE_LAYER | masque_layer );
// EDGE_LAYER | masque_layer );
break
;
break
;
case
TYPEMARKER
:
case
TYPEMARKER
:
break
;
break
;
default
:
default
:
DisplayError
(
this
,
wxT
(
"Plot_Serigraphie() error: unexpected Type()"
));
DisplayError
(
this
,
wxT
(
"Plot_Serigraphie() error: unexpected Type()"
)
);
break
;
break
;
}
}
}
}
/* trace des contours des MODULES : */
/* trace des contours des MODULES : */
Plot_Edges_Modules
(
m_Pcb
,
format_plot
,
masque_layer
);
Plot_Edges_Modules
(
m_Pcb
,
format_plot
,
masque_layer
);
/* Trace des MODULES : PADS */
/* Trace des MODULES : PADS */
if
(
PlotPadsOnSilkLayer
||
Plot_Pads_All_Layers
)
if
(
PlotPadsOnSilkLayer
||
Plot_Pads_All_Layers
)
{
{
nb_items
=
0
;
nb_items
=
0
;
Affiche_1_Parametre
(
this
,
56
,
wxT
(
"Pads"
),
wxEmptyString
,
GREEN
)
;
Affiche_1_Parametre
(
this
,
56
,
wxT
(
"Pads"
),
wxEmptyString
,
GREEN
);
Module
=
m_Pcb
->
m_Modules
;
Module
=
m_Pcb
->
m_Modules
;
for
(
;
Module
!=
NULL
;
Module
=
(
MODULE
*
)
Module
->
Pnext
)
for
(
;
Module
!=
NULL
;
Module
=
(
MODULE
*
)
Module
->
Pnext
)
{
{
pt_pad
=
(
D_PAD
*
)
Module
->
m_Pads
;
pt_pad
=
(
D_PAD
*
)
Module
->
m_Pads
;
for
(
;
pt_pad
!=
NULL
;
pt_pad
=
(
D_PAD
*
)
pt_pad
->
Pnext
)
for
(
;
pt_pad
!=
NULL
;
pt_pad
=
(
D_PAD
*
)
pt_pad
->
Pnext
)
{
{
/* Tst si layer OK */
/* Tst si layer OK */
if
(
(
pt_pad
->
m_Masque_Layer
&
masque_layer
)
==
0
)
if
(
(
pt_pad
->
m_Masque_Layer
&
masque_layer
)
==
0
)
{
{
if
(
!
Plot_Pads_All_Layers
)
continue
;
if
(
!
Plot_Pads_All_Layers
)
}
continue
;
}
shape_pos
=
pt_pad
->
ReturnShapePos
();
shape_pos
=
pt_pad
->
ReturnShapePos
();
pos
=
shape_pos
;
size
=
pt_pad
->
m_Size
;
pos
=
shape_pos
;
size
=
pt_pad
->
m_Size
;
switch
(
pt_pad
->
m_PadShape
&
0x7F
)
switch
(
pt_pad
->
m_PadShape
&
0x7F
)
{
{
case
CIRCLE
:
case
CIRCLE
:
switch
(
format_plot
)
{
switch
(
format_plot
)
case
PLOT_FORMAT_GERBER
:
{
PlotCircle
(
PLOT_FORMAT_GERBER
,
case
PLOT_FORMAT_GERBER
:
g_PlotLine_Width
,
pos
,
size
.
x
/
2
);
PlotCircle
(
PLOT_FORMAT_GERBER
,
break
;
g_PlotLine_Width
,
pos
,
size
.
x
/
2
);
break
;
case
PLOT_FORMAT_HPGL
:
trace_1_pastille_RONDE_HPGL
(
pos
,
size
.
x
,
FILAIRE
);
case
PLOT_FORMAT_HPGL
:
break
;
trace_1_pastille_RONDE_HPGL
(
pos
,
size
.
x
,
FILAIRE
);
break
;
case
PLOT_FORMAT_POST
:
trace_1_pastille_RONDE_POST
(
pos
,
size
.
x
,
FILAIRE
);
case
PLOT_FORMAT_POST
:
break
;
trace_1_pastille_RONDE_POST
(
pos
,
size
.
x
,
FILAIRE
);
}
break
;
break
;
}
case
OVALE
:
break
;
switch
(
format_plot
)
{
case
OVALE
:
case
PLOT_FORMAT_GERBER
:
trace_1_contour_GERBER
(
pos
,
size
,
wxSize
(
0
,
0
),
switch
(
format_plot
)
g_PlotLine_Width
,
{
pt_pad
->
m_Orient
);
case
PLOT_FORMAT_GERBER
:
break
;
trace_1_contour_GERBER
(
pos
,
size
,
wxSize
(
0
,
0
),
g_PlotLine_Width
,
case
PLOT_FORMAT_HPGL
:
pt_pad
->
m_Orient
);
trace_1_pastille_OVALE_HPGL
(
pos
,
size
,
break
;
pt_pad
->
m_Orient
,
FILAIRE
)
;
break
;
case
PLOT_FORMAT_HPGL
:
trace_1_pastille_OVALE_HPGL
(
pos
,
size
,
case
PLOT_FORMAT_POST
:
pt_pad
->
m_Orient
,
FILAIRE
);
trace_1_pastille_OVALE_POST
(
pos
,
size
,
break
;
pt_pad
->
m_Orient
,
FILAIRE
)
;
break
;
case
PLOT_FORMAT_POST
:
}
trace_1_pastille_OVALE_POST
(
pos
,
size
,
break
;
pt_pad
->
m_Orient
,
FILAIRE
);
break
;
case
TRAPEZE
:
}
{
wxSize
delta
;
break
;
delta
=
pt_pad
->
m_DeltaSize
;
case
TRAPEZE
:
switch
(
format_plot
)
{
{
wxSize
delta
;
case
PLOT_FORMAT_GERBER
:
delta
=
pt_pad
->
m_DeltaSize
;
trace_1_contour_GERBER
(
pos
,
size
,
delta
,
g_PlotLine_Width
,
switch
(
format_plot
)
(
int
)
pt_pad
->
m_Orient
);
{
break
;
case
PLOT_FORMAT_GERBER
:
trace_1_contour_GERBER
(
pos
,
size
,
delta
,
case
PLOT_FORMAT_HPGL
:
g_PlotLine_Width
,
trace_1_pad_TRAPEZE_HPGL
(
pos
,
size
,
(
int
)
pt_pad
->
m_Orient
);
delta
,
(
int
)
pt_pad
->
m_Orient
,
break
;
FILAIRE
)
;
break
;
case
PLOT_FORMAT_HPGL
:
trace_1_pad_TRAPEZE_HPGL
(
pos
,
size
,
case
PLOT_FORMAT_POST
:
delta
,
(
int
)
pt_pad
->
m_Orient
,
trace_1_pad_TRAPEZE_POST
(
pos
,
size
,
FILAIRE
);
delta
,
(
int
)
pt_pad
->
m_Orient
,
break
;
FILAIRE
)
;
break
;
case
PLOT_FORMAT_POST
:
}
trace_1_pad_TRAPEZE_POST
(
pos
,
size
,
break
;
delta
,
(
int
)
pt_pad
->
m_Orient
,
}
FILAIRE
);
break
;
case
RECT
:
}
default
:
switch
(
format_plot
)
break
;
{
}
case
PLOT_FORMAT_GERBER
:
trace_1_contour_GERBER
(
pos
,
size
,
wxSize
(
0
,
0
),
case
RECT
:
g_PlotLine_Width
,
default
:
(
int
)
pt_pad
->
m_Orient
);
break
;
switch
(
format_plot
)
{
case
PLOT_FORMAT_HPGL
:
case
PLOT_FORMAT_GERBER
:
PlotRectangularPad_HPGL
(
pos
,
size
,
pt_pad
->
m_Orient
,
FILAIRE
)
;
trace_1_contour_GERBER
(
pos
,
size
,
wxSize
(
0
,
0
),
break
;
g_PlotLine_Width
,
(
int
)
pt_pad
->
m_Orient
);
case
PLOT_FORMAT_POST
:
break
;
trace_1_pad_rectangulaire_POST
(
pos
,
size
,
(
int
)
pt_pad
->
m_Orient
,
FILAIRE
)
;
case
PLOT_FORMAT_HPGL
:
break
;
PlotRectangularPad_HPGL
(
pos
,
size
,
pt_pad
->
m_Orient
,
FILAIRE
);
}
break
;
break
;
}
case
PLOT_FORMAT_POST
:
nb_items
++
;
msg
.
Printf
(
wxT
(
"%d"
),
nb_items
)
;
trace_1_pad_rectangulaire_POST
(
pos
,
size
,
Affiche_1_Parametre
(
this
,
56
,
wxEmptyString
,
msg
,
GREEN
)
;
(
int
)
pt_pad
->
m_Orient
,
FILAIRE
);
}
break
;
}
}
}
/* Fin Sequence de trace des Pads */
break
;
/* Trace Textes MODULES */
}
nb_items
=
0
;
Affiche_1_Parametre
(
this
,
64
,
wxT
(
"TxtMod"
),
wxEmptyString
,
LIGHTBLUE
)
;
nb_items
++
;
msg
.
Printf
(
wxT
(
"%d"
),
nb_items
);
Module
=
m_Pcb
->
m_Modules
;
Affiche_1_Parametre
(
this
,
56
,
wxEmptyString
,
msg
,
GREEN
);
for
(
;
Module
!=
NULL
;
Module
=
(
MODULE
*
)
Module
->
Pnext
)
}
{
}
/* Analyse des autorisations de trace pour les textes VALEUR et REF */
}
/* Fin Sequence de trace des Pads */
trace_val
=
Sel_Texte_Valeur
;
trace_ref
=
Sel_Texte_Reference
;
// les 2 autorisations de tracer sont donnees
/* Trace Textes MODULES */
nb_items
=
0
;
Affiche_1_Parametre
(
this
,
64
,
wxT
(
"TxtMod"
),
wxEmptyString
,
LIGHTBLUE
);
if
(
(
g_TabOneLayerMask
[
Module
->
m_Reference
->
GetLayer
()]
&
masque_layer
)
==
0
)
trace_ref
=
FALSE
;
Module
=
m_Pcb
->
m_Modules
;
if
(
Module
->
m_Reference
->
m_NoShow
&&
!
Sel_Texte_Invisible
)
for
(
;
Module
!=
NULL
;
Module
=
(
MODULE
*
)
Module
->
Pnext
)
trace_ref
=
FALSE
;
{
/* Analyse des autorisations de trace pour les textes VALEUR et REF */
if
(
(
g_TabOneLayerMask
[
Module
->
m_Value
->
GetLayer
()]
&
masque_layer
)
==
0
)
trace_val
=
Sel_Texte_Valeur
;
trace_val
=
FALSE
;
trace_ref
=
Sel_Texte_Reference
;
// les 2 autorisations de tracer sont donnees
if
(
Module
->
m_Value
->
m_NoShow
&&
!
Sel_Texte_Invisible
)
trace_val
=
FALSE
;
TEXTE_MODULE
*
text
=
Module
->
m_Reference
;
int
textLayer
=
text
->
GetLayer
();
/* Trace effectif des textes */
if
(
trace_ref
)
wxASSERT
(
(
unsigned
)
textLayer
<
32
);
{
PlotTextModule
(
Module
->
m_Reference
);
if
(
(
(
1
<<
textLayer
)
&
masque_layer
)
==
0
)
nb_items
++
;
trace_ref
=
FALSE
;
msg
.
Printf
(
wxT
(
"%d"
),
nb_items
)
;
Affiche_1_Parametre
(
this
,
64
,
wxEmptyString
,
msg
,
LIGHTBLUE
)
;
if
(
text
->
m_NoShow
&&
!
Sel_Texte_Invisible
)
}
trace_ref
=
FALSE
;
if
(
trace_val
)
text
=
Module
->
m_Value
;
{
textLayer
=
text
->
GetLayer
();
PlotTextModule
(
Module
->
m_Value
);
nb_items
++
;
wxASSERT
(
(
unsigned
)
textLayer
<
32
);
msg
.
Printf
(
wxT
(
"%d"
),
nb_items
)
;
Affiche_1_Parametre
(
this
,
64
,
wxEmptyString
,
msg
,
LIGHTBLUE
)
;
if
(
(
(
1
<<
textLayer
)
&
masque_layer
)
==
0
)
}
trace_val
=
FALSE
;
pt_texte
=
(
TEXTE_MODULE
*
)
Module
->
m_Drawings
;
if
(
text
->
m_NoShow
&&
!
Sel_Texte_Invisible
)
for
(
;
pt_texte
!=
NULL
;
pt_texte
=
(
TEXTE_MODULE
*
)
pt_texte
->
Pnext
)
trace_val
=
FALSE
;
{
if
(
pt_texte
->
Type
()
!=
TYPETEXTEMODULE
)
continue
;
/* Trace effectif des textes */
if
(
trace_ref
)
if
(
!
Sel_Texte_Divers
)
continue
;
{
if
(
(
pt_texte
->
m_NoShow
)
&&
!
Sel_Texte_Invisible
)
PlotTextModule
(
Module
->
m_Reference
);
continue
;
nb_items
++
;
if
(
(
g_TabOneLayerMask
[
pt_texte
->
GetLayer
()]
&
masque_layer
)
==
0
)
msg
.
Printf
(
wxT
(
"%d"
),
nb_items
);
continue
;
Affiche_1_Parametre
(
this
,
64
,
wxEmptyString
,
msg
,
LIGHTBLUE
);
PlotTextModule
(
pt_texte
);
}
nb_items
++
;
msg
.
Printf
(
wxT
(
"%d"
),
nb_items
)
;
if
(
trace_val
)
Affiche_1_Parametre
(
this
,
64
,
wxEmptyString
,
msg
,
LIGHTBLUE
)
;
{
}
PlotTextModule
(
Module
->
m_Value
);
}
nb_items
++
;
msg
.
Printf
(
wxT
(
"%d"
),
nb_items
);
Affiche_1_Parametre
(
this
,
64
,
wxEmptyString
,
msg
,
LIGHTBLUE
);
}
pt_texte
=
(
TEXTE_MODULE
*
)
Module
->
m_Drawings
;
for
(
;
pt_texte
!=
NULL
;
pt_texte
=
(
TEXTE_MODULE
*
)
pt_texte
->
Pnext
)
{
if
(
pt_texte
->
Type
()
!=
TYPETEXTEMODULE
)
continue
;
if
(
!
Sel_Texte_Divers
)
continue
;
if
(
(
pt_texte
->
m_NoShow
)
&&
!
Sel_Texte_Invisible
)
continue
;
if
(
(
g_TabOneLayerMask
[
pt_texte
->
GetLayer
()]
&
masque_layer
)
==
0
)
continue
;
PlotTextModule
(
pt_texte
);
nb_items
++
;
msg
.
Printf
(
wxT
(
"%d"
),
nb_items
);
Affiche_1_Parametre
(
this
,
64
,
wxEmptyString
,
msg
,
LIGHTBLUE
);
}
}
}
}
/**************************************************/
/**************************************************/
static
void
PlotTextModule
(
TEXTE_MODULE
*
pt_texte
)
static
void
PlotTextModule
(
TEXTE_MODULE
*
pt_texte
)
/**************************************************/
/**************************************************/
{
{
wxSize
size
;
wxSize
size
;
wxPoint
pos
;
wxPoint
pos
;
int
orient
,
epaisseur
,
no_miroir
;
int
orient
,
epaisseur
,
no_miroir
;
/* calcul des parametres du texte :*/
/* calcul des parametres du texte :*/
size
=
pt_texte
->
m_Size
;
size
=
pt_texte
->
m_Size
;
pos
=
pt_texte
->
m_Pos
;
pos
=
pt_texte
->
m_Pos
;
orient
=
pt_texte
->
GetDrawRotation
();
orient
=
pt_texte
->
GetDrawRotation
();
no_miroir
=
pt_texte
->
m_Miroir
&
1
;
no_miroir
=
pt_texte
->
m_Miroir
&
1
;
epaisseur
=
pt_texte
->
m_Width
;
epaisseur
=
pt_texte
->
m_Width
;
if
(
Plot_Mode
==
FILAIRE
)
epaisseur
=
g_PlotLine_Width
;
if
(
Plot_Mode
==
FILAIRE
)
epaisseur
=
g_PlotLine_Width
;
if
(
no_miroir
==
0
)
size
.
y
=
-
size
.
y
;
// Text is mirrored
if
(
no_miroir
==
0
)
size
.
y
=
-
size
.
y
;
// Text is mirrored
Plot_1_texte
(
format_plot
,
pt_texte
->
m_Text
,
Plot_1_texte
(
format_plot
,
pt_texte
->
m_Text
,
orient
,
epaisseur
,
orient
,
epaisseur
,
pos
.
x
,
pos
.
y
,
size
.
x
,
size
.
y
);
pos
.
x
,
pos
.
y
,
size
.
x
,
size
.
y
);
}
}
/*******************************************************************************/
/*******************************************************************************/
void
PlotCotation
(
COTATION
*
Cotation
,
int
format_plot
,
int
masque_layer
)
void
PlotCotation
(
COTATION
*
Cotation
,
int
format_plot
,
int
masque_layer
)
/*******************************************************************************/
/*******************************************************************************/
{
{
DRAWSEGMENT
*
DrawTmp
;
DRAWSEGMENT
*
DrawTmp
;
if
(
(
g_TabOneLayerMask
[
Cotation
->
GetLayer
()]
&
masque_layer
)
==
0
)
return
;
if
(
(
g_TabOneLayerMask
[
Cotation
->
GetLayer
()]
&
masque_layer
)
==
0
)
return
;
DrawTmp
=
new
DRAWSEGMENT
(
NULL
);
DrawTmp
=
new
DRAWSEGMENT
(
NULL
);
// (Following command has been superceded by new commands elsewhere.)
// (Following command has been superceded by new commands elsewhere.)
// masque_layer |= EDGE_LAYER;
// masque_layer |= EDGE_LAYER;
DrawTmp
->
m_Width
=
Cotation
->
m_Width
;
DrawTmp
->
m_Width
=
Cotation
->
m_Width
;
DrawTmp
->
SetLayer
(
Cotation
->
GetLayer
()
);
DrawTmp
->
SetLayer
(
Cotation
->
GetLayer
()
);
PlotTextePcb
(
Cotation
->
m_Text
,
format_plot
,
masque_layer
);
PlotTextePcb
(
Cotation
->
m_Text
,
format_plot
,
masque_layer
);
DrawTmp
->
m_Start
.
x
=
Cotation
->
Barre_ox
;
DrawTmp
->
m_Start
.
y
=
Cotation
->
Barre_oy
;
DrawTmp
->
m_Start
.
x
=
Cotation
->
Barre_ox
;
DrawTmp
->
m_Start
.
y
=
Cotation
->
Barre_oy
;
DrawTmp
->
m_End
.
x
=
Cotation
->
Barre_fx
;
DrawTmp
->
m_End
.
y
=
Cotation
->
Barre_fy
;
DrawTmp
->
m_End
.
x
=
Cotation
->
Barre_fx
;
DrawTmp
->
m_End
.
y
=
Cotation
->
Barre_fy
;
PlotDrawSegment
(
DrawTmp
,
format_plot
,
masque_layer
);
PlotDrawSegment
(
DrawTmp
,
format_plot
,
masque_layer
);
DrawTmp
->
m_Start
.
x
=
Cotation
->
TraitG_ox
;
DrawTmp
->
m_Start
.
y
=
Cotation
->
TraitG_oy
;
DrawTmp
->
m_Start
.
x
=
Cotation
->
TraitG_ox
;
DrawTmp
->
m_Start
.
y
=
Cotation
->
TraitG_oy
;
DrawTmp
->
m_End
.
x
=
Cotation
->
TraitG_fx
;
DrawTmp
->
m_End
.
y
=
Cotation
->
TraitG_fy
;
DrawTmp
->
m_End
.
x
=
Cotation
->
TraitG_fx
;
DrawTmp
->
m_End
.
y
=
Cotation
->
TraitG_fy
;
PlotDrawSegment
(
DrawTmp
,
format_plot
,
masque_layer
);
PlotDrawSegment
(
DrawTmp
,
format_plot
,
masque_layer
);
DrawTmp
->
m_Start
.
x
=
Cotation
->
TraitD_ox
;
DrawTmp
->
m_Start
.
y
=
Cotation
->
TraitD_oy
;
DrawTmp
->
m_Start
.
x
=
Cotation
->
TraitD_ox
;
DrawTmp
->
m_Start
.
y
=
Cotation
->
TraitD_oy
;
DrawTmp
->
m_End
.
x
=
Cotation
->
TraitD_fx
;
DrawTmp
->
m_End
.
y
=
Cotation
->
TraitD_fy
;
DrawTmp
->
m_End
.
x
=
Cotation
->
TraitD_fx
;
DrawTmp
->
m_End
.
y
=
Cotation
->
TraitD_fy
;
PlotDrawSegment
(
DrawTmp
,
format_plot
,
masque_layer
);
PlotDrawSegment
(
DrawTmp
,
format_plot
,
masque_layer
);
DrawTmp
->
m_Start
.
x
=
Cotation
->
FlecheD1_ox
;
DrawTmp
->
m_Start
.
y
=
Cotation
->
FlecheD1_oy
;
DrawTmp
->
m_Start
.
x
=
Cotation
->
FlecheD1_ox
;
DrawTmp
->
m_Start
.
y
=
Cotation
->
FlecheD1_oy
;
DrawTmp
->
m_End
.
x
=
Cotation
->
FlecheD1_fx
;
DrawTmp
->
m_End
.
y
=
Cotation
->
FlecheD1_fy
;
DrawTmp
->
m_End
.
x
=
Cotation
->
FlecheD1_fx
;
DrawTmp
->
m_End
.
y
=
Cotation
->
FlecheD1_fy
;
PlotDrawSegment
(
DrawTmp
,
format_plot
,
masque_layer
);
PlotDrawSegment
(
DrawTmp
,
format_plot
,
masque_layer
);
DrawTmp
->
m_Start
.
x
=
Cotation
->
FlecheD2_ox
;
DrawTmp
->
m_Start
.
y
=
Cotation
->
FlecheD2_oy
;
DrawTmp
->
m_Start
.
x
=
Cotation
->
FlecheD2_ox
;
DrawTmp
->
m_Start
.
y
=
Cotation
->
FlecheD2_oy
;
DrawTmp
->
m_End
.
x
=
Cotation
->
FlecheD2_fx
;
DrawTmp
->
m_End
.
y
=
Cotation
->
FlecheD2_fy
;
DrawTmp
->
m_End
.
x
=
Cotation
->
FlecheD2_fx
;
DrawTmp
->
m_End
.
y
=
Cotation
->
FlecheD2_fy
;
PlotDrawSegment
(
DrawTmp
,
format_plot
,
masque_layer
);
PlotDrawSegment
(
DrawTmp
,
format_plot
,
masque_layer
);
DrawTmp
->
m_Start
.
x
=
Cotation
->
FlecheG1_ox
;
DrawTmp
->
m_Start
.
y
=
Cotation
->
FlecheG1_oy
;
DrawTmp
->
m_Start
.
x
=
Cotation
->
FlecheG1_ox
;
DrawTmp
->
m_Start
.
y
=
Cotation
->
FlecheG1_oy
;
DrawTmp
->
m_End
.
x
=
Cotation
->
FlecheG1_fx
;
DrawTmp
->
m_End
.
y
=
Cotation
->
FlecheG1_fy
;
DrawTmp
->
m_End
.
x
=
Cotation
->
FlecheG1_fx
;
DrawTmp
->
m_End
.
y
=
Cotation
->
FlecheG1_fy
;
PlotDrawSegment
(
DrawTmp
,
format_plot
,
masque_layer
);
PlotDrawSegment
(
DrawTmp
,
format_plot
,
masque_layer
);
DrawTmp
->
m_Start
.
x
=
Cotation
->
FlecheG2_ox
;
DrawTmp
->
m_Start
.
y
=
Cotation
->
FlecheG2_oy
;
DrawTmp
->
m_Start
.
x
=
Cotation
->
FlecheG2_ox
;
DrawTmp
->
m_Start
.
y
=
Cotation
->
FlecheG2_oy
;
DrawTmp
->
m_End
.
x
=
Cotation
->
FlecheG2_fx
;
DrawTmp
->
m_End
.
y
=
Cotation
->
FlecheG2_fy
;
DrawTmp
->
m_End
.
x
=
Cotation
->
FlecheG2_fx
;
DrawTmp
->
m_End
.
y
=
Cotation
->
FlecheG2_fy
;
PlotDrawSegment
(
DrawTmp
,
format_plot
,
masque_layer
);
PlotDrawSegment
(
DrawTmp
,
format_plot
,
masque_layer
);
delete
DrawTmp
;
delete
DrawTmp
;
}
}
/*****************************************************************/
/*****************************************************************/
void
PlotMirePcb
(
MIREPCB
*
Mire
,
int
format_plot
,
int
masque_layer
)
void
PlotMirePcb
(
MIREPCB
*
Mire
,
int
format_plot
,
int
masque_layer
)
/*****************************************************************/
/*****************************************************************/
{
{
DRAWSEGMENT
*
DrawTmp
;
DRAWSEGMENT
*
DrawTmp
;
int
dx1
,
dx2
,
dy1
,
dy2
,
rayon
;
int
dx1
,
dx2
,
dy1
,
dy2
,
rayon
;
if
(
(
g_TabOneLayerMask
[
Mire
->
GetLayer
()]
&
masque_layer
)
==
0
)
return
;
if
(
(
g_TabOneLayerMask
[
Mire
->
GetLayer
()]
&
masque_layer
)
==
0
)
return
;
DrawTmp
=
new
DRAWSEGMENT
(
NULL
);
DrawTmp
=
new
DRAWSEGMENT
(
NULL
);
// (Following command has been superceded by new commands elsewhere.)
// (Following command has been superceded by new commands elsewhere.)
// masque_layer |= EDGE_LAYER;
// masque_layer |= EDGE_LAYER;
DrawTmp
->
m_Width
=
Mire
->
m_Width
;
DrawTmp
->
m_Width
=
Mire
->
m_Width
;
DrawTmp
->
SetLayer
(
Mire
->
GetLayer
()
);
DrawTmp
->
SetLayer
(
Mire
->
GetLayer
()
);
DrawTmp
->
m_Start
.
x
=
Mire
->
m_Pos
.
x
;
DrawTmp
->
m_Start
.
y
=
Mire
->
m_Pos
.
y
;
DrawTmp
->
m_Start
.
x
=
Mire
->
m_Pos
.
x
;
DrawTmp
->
m_Start
.
y
=
Mire
->
m_Pos
.
y
;
DrawTmp
->
m_End
.
x
=
DrawTmp
->
m_Start
.
x
+
(
Mire
->
m_Size
/
4
);
DrawTmp
->
m_End
.
x
=
DrawTmp
->
m_Start
.
x
+
(
Mire
->
m_Size
/
4
);
DrawTmp
->
m_End
.
y
=
DrawTmp
->
m_Start
.
y
;
DrawTmp
->
m_End
.
y
=
DrawTmp
->
m_Start
.
y
;
DrawTmp
->
m_Shape
=
S_CIRCLE
;
DrawTmp
->
m_Shape
=
S_CIRCLE
;
PlotDrawSegment
(
DrawTmp
,
format_plot
,
masque_layer
);
PlotDrawSegment
(
DrawTmp
,
format_plot
,
masque_layer
);
DrawTmp
->
m_Shape
=
S_SEGMENT
;
DrawTmp
->
m_Shape
=
S_SEGMENT
;
/* Trace des 2 traits */
/* Trace des 2 traits */
rayon
=
Mire
->
m_Size
/
2
;
rayon
=
Mire
->
m_Size
/
2
;
dx1
=
rayon
,
dy1
=
0
;
dx2
=
0
,
dy2
=
rayon
;
dx1
=
rayon
,
dy1
=
0
;
dx2
=
0
,
dy2
=
rayon
;
if
(
Mire
->
m_Shape
)
/* Forme X */
if
(
Mire
->
m_Shape
)
/* Forme X */
{
{
dx1
=
dy1
=
(
rayon
*
7
)
/
5
;
dx2
=
dx1
;
dy2
=
-
dy1
;
dx1
=
dy1
=
(
rayon
*
7
)
/
5
;
dx2
=
dx1
;
dy2
=
-
dy1
;
}
}
DrawTmp
->
m_Start
.
x
=
Mire
->
m_Pos
.
x
-
dx1
;
DrawTmp
->
m_Start
.
y
=
Mire
->
m_Pos
.
y
-
dy1
;
DrawTmp
->
m_Start
.
x
=
Mire
->
m_Pos
.
x
-
dx1
;
DrawTmp
->
m_Start
.
y
=
Mire
->
m_Pos
.
y
-
dy1
;
DrawTmp
->
m_End
.
x
=
Mire
->
m_Pos
.
x
+
dx1
;
DrawTmp
->
m_End
.
y
=
Mire
->
m_Pos
.
y
+
dy1
;
DrawTmp
->
m_End
.
x
=
Mire
->
m_Pos
.
x
+
dx1
;
DrawTmp
->
m_End
.
y
=
Mire
->
m_Pos
.
y
+
dy1
;
PlotDrawSegment
(
DrawTmp
,
format_plot
,
masque_layer
);
PlotDrawSegment
(
DrawTmp
,
format_plot
,
masque_layer
);
DrawTmp
->
m_Start
.
x
=
Mire
->
m_Pos
.
x
-
dx2
;
DrawTmp
->
m_Start
.
y
=
Mire
->
m_Pos
.
y
-
dy2
;
DrawTmp
->
m_Start
.
x
=
Mire
->
m_Pos
.
x
-
dx2
;
DrawTmp
->
m_Start
.
y
=
Mire
->
m_Pos
.
y
-
dy2
;
DrawTmp
->
m_End
.
x
=
Mire
->
m_Pos
.
x
+
dx2
;
DrawTmp
->
m_End
.
y
=
Mire
->
m_Pos
.
y
+
dy2
;
DrawTmp
->
m_End
.
x
=
Mire
->
m_Pos
.
x
+
dx2
;
DrawTmp
->
m_End
.
y
=
Mire
->
m_Pos
.
y
+
dy2
;
PlotDrawSegment
(
DrawTmp
,
format_plot
,
masque_layer
);
PlotDrawSegment
(
DrawTmp
,
format_plot
,
masque_layer
);
delete
DrawTmp
;
delete
DrawTmp
;
}
}
/**********************************************************************/
/**********************************************************************/
void
Plot_Edges_Modules
(
BOARD
*
pcb
,
int
format_plot
,
int
masque_layer
)
void
Plot_Edges_Modules
(
BOARD
*
pcb
,
int
format_plot
,
int
masque_layer
)
/**********************************************************************/
/**********************************************************************/
/* Trace les contours des modules */
/* Trace les contours des modules */
{
{
int
nb_items
;
/* Pour affichage activite: nbr modules traites */
int
nb_items
;
/* Pour affichage activite: nbr modules traites */
MODULE
*
Module
;
MODULE
*
Module
;
EDGE_MODULE
*
PtEdge
;
EDGE_MODULE
*
PtEdge
;
wxString
msg
;
wxString
msg
;
nb_items
=
0
;
nb_items
=
0
;
Module
=
pcb
->
m_Modules
;
Module
=
pcb
->
m_Modules
;
for
(
;
Module
!=
NULL
;
Module
=
(
MODULE
*
)
Module
->
Pnext
)
for
(
;
Module
!=
NULL
;
Module
=
(
MODULE
*
)
Module
->
Pnext
)
{
{
PtEdge
=
(
EDGE_MODULE
*
)
Module
->
m_Drawings
;
PtEdge
=
(
EDGE_MODULE
*
)
Module
->
m_Drawings
;
for
(
;
PtEdge
!=
NULL
;
PtEdge
=
(
EDGE_MODULE
*
)
PtEdge
->
Pnext
)
for
(
;
PtEdge
!=
NULL
;
PtEdge
=
(
EDGE_MODULE
*
)
PtEdge
->
Pnext
)
{
{
if
(
PtEdge
->
Type
()
!=
TYPEEDGEMODULE
)
continue
;
if
(
PtEdge
->
Type
()
!=
TYPEEDGEMODULE
)
if
(
(
g_TabOneLayerMask
[
PtEdge
->
GetLayer
()]
&
masque_layer
)
==
0
)
continue
;
continue
;
Plot_1_EdgeModule
(
format_plot
,
PtEdge
);
if
(
(
g_TabOneLayerMask
[
PtEdge
->
GetLayer
()]
&
masque_layer
)
==
0
)
}
continue
;
/* Affichage du nombre de modules traites */
Plot_1_EdgeModule
(
format_plot
,
PtEdge
);
nb_items
++
;
}
msg
.
Printf
(
wxT
(
"%d"
),
nb_items
)
;
}
/* Affichage du nombre de modules traites */
nb_items
++
;
msg
.
Printf
(
wxT
(
"%d"
),
nb_items
);
}
}
}
/**************************************************************/
/**************************************************************/
void
Plot_1_EdgeModule
(
int
format_plot
,
EDGE_MODULE
*
PtEdge
)
void
Plot_1_EdgeModule
(
int
format_plot
,
EDGE_MODULE
*
PtEdge
)
/**************************************************************/
/**************************************************************/
/* Trace les contours des modules */
/* Trace les contours des modules */
{
{
int
type_trace
;
/* forme a tracer (segment, cercle) */
int
type_trace
;
/* forme a tracer (segment, cercle) */
int
epaisseur
;
/* epaisseur des segments */
int
epaisseur
;
/* epaisseur des segments */
int
rayon
;
/* rayon des cercles a tracer */
int
rayon
;
/* rayon des cercles a tracer */
int
StAngle
,
EndAngle
;
int
StAngle
,
EndAngle
;
wxPoint
pos
,
end
;
/* Coord des segments a tracer */
wxPoint
pos
,
end
;
/* Coord des segments a tracer */
if
(
PtEdge
->
Type
()
!=
TYPEEDGEMODULE
)
return
;
if
(
PtEdge
->
Type
()
!=
TYPEEDGEMODULE
)
type_trace
=
PtEdge
->
m_Shape
;
return
;
epaisseur
=
PtEdge
->
m_Width
;
type_trace
=
PtEdge
->
m_Shape
;
if
(
Plot_Mode
==
FILAIRE
)
epaisseur
=
g_PlotLine_Width
;
epaisseur
=
PtEdge
->
m_Width
;
if
(
Plot_Mode
==
FILAIRE
)
pos
=
PtEdge
->
m_Start
;
epaisseur
=
g_PlotLine_Width
;
end
=
PtEdge
->
m_End
;
pos
=
PtEdge
->
m_Start
;
switch
(
type_trace
)
end
=
PtEdge
->
m_End
;
{
case
S_SEGMENT
:
/* segment simple */
switch
(
type_trace
)
switch
(
format_plot
)
{
{
case
S_SEGMENT
:
case
PLOT_FORMAT_GERBER
:
PlotGERBERLine
(
pos
,
end
,
epaisseur
)
;
/* segment simple */
break
;
switch
(
format_plot
)
{
case
PLOT_FORMAT_HPGL
:
case
PLOT_FORMAT_GERBER
:
trace_1_segment_HPGL
(
pos
.
x
,
pos
.
y
,
end
.
x
,
end
.
y
,
epaisseur
)
;
PlotGERBERLine
(
pos
,
end
,
epaisseur
);
break
;
break
;
case
PLOT_FORMAT_POST
:
case
PLOT_FORMAT_HPGL
:
PlotFilledSegmentPS
(
pos
,
end
,
epaisseur
)
;
trace_1_segment_HPGL
(
pos
.
x
,
pos
.
y
,
end
.
x
,
end
.
y
,
epaisseur
);
break
;
break
;
}
break
;
/* Fin trace segment simple */
case
PLOT_FORMAT_POST
:
PlotFilledSegmentPS
(
pos
,
end
,
epaisseur
);
case
S_CIRCLE
:
break
;
rayon
=
(
int
)
hypot
((
double
)(
end
.
x
-
pos
.
x
),(
double
)(
end
.
y
-
pos
.
y
)
);
}
PlotCircle
(
format_plot
,
epaisseur
,
pos
,
rayon
)
;
break
;
break
;
/* Fin trace segment simple */
case
S_ARC
:
case
S_CIRCLE
:
rayon
=
(
int
)
hypot
((
double
)(
end
.
x
-
pos
.
x
),(
double
)(
end
.
y
-
pos
.
y
)
);
rayon
=
(
int
)
hypot
(
(
double
)
(
end
.
x
-
pos
.
x
),
(
double
)
(
end
.
y
-
pos
.
y
)
);
StAngle
=
ArcTangente
(
end
.
y
-
pos
.
y
,
end
.
x
-
pos
.
x
);
PlotCircle
(
format_plot
,
epaisseur
,
pos
,
rayon
);
EndAngle
=
StAngle
+
PtEdge
->
m_Angle
;
break
;
if
(
StAngle
>
EndAngle
)
EXCHG
(
StAngle
,
EndAngle
);
PlotArc
(
format_plot
,
pos
,
StAngle
,
EndAngle
,
rayon
,
epaisseur
);
case
S_ARC
:
break
;
rayon
=
(
int
)
hypot
(
(
double
)
(
end
.
x
-
pos
.
x
),
(
double
)
(
end
.
y
-
pos
.
y
)
);
StAngle
=
ArcTangente
(
end
.
y
-
pos
.
y
,
end
.
x
-
pos
.
x
);
case
S_POLYGON
:
EndAngle
=
StAngle
+
PtEdge
->
m_Angle
;
{
if
(
StAngle
>
EndAngle
)
// We must compute true coordinates from m_PolyList
EXCHG
(
StAngle
,
EndAngle
);
// which are relative to module position, orientation 0
PlotArc
(
format_plot
,
pos
,
StAngle
,
EndAngle
,
rayon
,
epaisseur
);
int
ii
,
*
source
,
*
ptr
,
*
ptr_base
;
break
;
MODULE
*
Module
=
NULL
;
if
(
PtEdge
->
m_Parent
&&
(
PtEdge
->
m_Parent
->
Type
()
==
TYPEMODULE
)
)
case
S_POLYGON
:
Module
=
(
MODULE
*
)
PtEdge
->
m_Parent
;
{
ptr
=
ptr_base
=
(
int
*
)
MyMalloc
(
2
*
PtEdge
->
m_PolyCount
*
sizeof
(
int
)
);
// We must compute true coordinates from m_PolyList
source
=
PtEdge
->
m_PolyList
;
// which are relative to module position, orientation 0
for
(
ii
=
0
;
ii
<
PtEdge
->
m_PolyCount
;
ii
++
)
int
ii
,
*
source
,
*
ptr
,
*
ptr_base
;
{
MODULE
*
Module
=
NULL
;
int
x
,
y
;
if
(
PtEdge
->
m_Parent
&&
(
PtEdge
->
m_Parent
->
Type
()
==
TYPEMODULE
)
)
x
=
*
source
;
source
++
;
y
=
*
source
;
source
++
;
Module
=
(
MODULE
*
)
PtEdge
->
m_Parent
;
if
(
Module
)
ptr
=
ptr_base
=
(
int
*
)
MyMalloc
(
2
*
PtEdge
->
m_PolyCount
*
sizeof
(
int
)
);
{
source
=
PtEdge
->
m_PolyList
;
RotatePoint
(
&
x
,
&
y
,
Module
->
m_Orient
);
for
(
ii
=
0
;
ii
<
PtEdge
->
m_PolyCount
;
ii
++
)
x
+=
Module
->
m_Pos
.
x
;
{
y
+=
Module
->
m_Pos
.
y
;
int
x
,
y
;
}
x
=
*
source
;
source
++
;
y
=
*
source
;
source
++
;
x
+=
PtEdge
->
m_Start0
.
x
;
if
(
Module
)
y
+=
PtEdge
->
m_Start0
.
y
;
{
*
ptr
=
x
;
ptr
++
;
*
ptr
=
y
;
ptr
++
;
RotatePoint
(
&
x
,
&
y
,
Module
->
m_Orient
);
}
x
+=
Module
->
m_Pos
.
x
;
PlotPolygon
(
format_plot
,
TRUE
,
PtEdge
->
m_PolyCount
,
ptr_base
);
y
+=
Module
->
m_Pos
.
y
;
free
(
ptr_base
);
}
break
;
x
+=
PtEdge
->
m_Start0
.
x
;
}
y
+=
PtEdge
->
m_Start0
.
y
;
*
ptr
=
x
;
ptr
++
;
*
ptr
=
y
;
ptr
++
;
}
}
PlotPolygon
(
format_plot
,
TRUE
,
PtEdge
->
m_PolyCount
,
ptr_base
);
free
(
ptr_base
);
break
;
}
}
}
}
/****************************************************************************/
/****************************************************************************/
void
PlotTextePcb
(
TEXTE_PCB
*
pt_texte
,
int
format_plot
,
int
masque_layer
)
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 */
/* Trace 1 Texte type PCB , c.a.d autre que les textes sur modules */
{
{
int
no_miroir
,
orient
,
epaisseur
;
int
no_miroir
,
orient
,
epaisseur
;
wxPoint
pos
;
wxPoint
pos
;
wxSize
size
;
wxSize
size
;
if
(
pt_texte
->
m_Text
.
IsEmpty
()
)
return
;
if
(
pt_texte
->
m_Text
.
IsEmpty
()
)
if
(
(
g_TabOneLayerMask
[
pt_texte
->
GetLayer
()]
&
masque_layer
)
==
0
)
return
;
return
;
if
(
(
g_TabOneLayerMask
[
pt_texte
->
GetLayer
()]
&
masque_layer
)
==
0
)
/* calcul des parametres du texte :*/
return
;
size
=
pt_texte
->
m_Size
;
pos
=
pt_texte
->
m_Pos
;
/* calcul des parametres du texte :*/
orient
=
pt_texte
->
m_Orient
;
size
=
pt_texte
->
m_Size
;
no_miroir
=
pt_texte
->
m_Miroir
&
1
;
pos
=
pt_texte
->
m_Pos
;
epaisseur
=
pt_texte
->
m_Width
;
orient
=
pt_texte
->
m_Orient
;
no_miroir
=
pt_texte
->
m_Miroir
&
1
;
if
(
no_miroir
==
FALSE
)
size
.
x
=
-
size
.
x
;
epaisseur
=
pt_texte
->
m_Width
;
Plot_1_texte
(
format_plot
,
pt_texte
->
m_Text
,
orient
,
if
(
no_miroir
==
FALSE
)
epaisseur
,
pos
.
x
,
pos
.
y
,
size
.
x
,
size
.
y
);
size
.
x
=
-
size
.
x
;
Plot_1_texte
(
format_plot
,
pt_texte
->
m_Text
,
orient
,
epaisseur
,
pos
.
x
,
pos
.
y
,
size
.
x
,
size
.
y
);
}
}
/**********************************************************************/
/**********************************************************************/
void
Plot_1_texte
(
int
format_plot
,
const
wxString
&
Text
,
int
angle
,
void
Plot_1_texte
(
int
format_plot
,
const
wxString
&
Text
,
int
angle
,
int
epaisseur
,
int
cX
,
int
cY
,
int
size_h
,
int
size_v
,
int
epaisseur
,
int
cX
,
int
cY
,
int
size_h
,
int
size_v
,
bool
centreX
,
bool
centreY
)
bool
centreX
,
bool
centreY
)
/***********************************************************************/
/***********************************************************************/
/*
/*
Trace de 1 texte:
*
Trace de 1 texte:
ptr = pointeur sur le texte
*
ptr = pointeur sur le texte
angle = angle d'orientation, dependant aussi du mode de trace (miroir..)
*
angle = angle d'orientation, dependant aussi du mode de trace (miroir..)
cX, cY = position du centre du texte
*
cX, cY = position du centre du texte
size_h , size_v = dimensions ( algebriques );
*
size_h , size_v = dimensions ( algebriques );
*/
*/
{
{
int
kk
=
0
,
k1
,
k2
,
end
;
int
kk
=
0
,
k1
,
k2
,
end
;
int
espacement
;
int
espacement
;
char
f_cod
,
plume
;
char
f_cod
,
plume
;
const
SH_CODE
*
ptcar
;
const
SH_CODE
*
ptcar
;
int
ox
,
oy
,
fx
,
fy
;
/* Coord de debut et fin des segments a tracer */
int
ox
,
oy
,
fx
,
fy
;
/* Coord de debut et fin des segments a tracer */
int
sx
,
sy
;
/* coord du debut du caractere courant */
int
sx
,
sy
;
/* coord du debut du caractere courant */
int
nbcodes
=
Text
.
Len
();
int
nbcodes
=
Text
.
Len
();
espacement
=
((
10
*
size_h
)
/
9
)
+
(
(
size_h
>=
0
)
?
epaisseur
:
-
epaisseur
);
espacement
=
(
(
10
*
size_h
)
/
9
)
+
(
(
size_h
>=
0
)
?
epaisseur
:
-
epaisseur
);
/* calcul de la position du debut du texte */
/* calcul de la position du debut du texte */
if
(
centreX
)
sx
=
cX
-
((
espacement
*
nbcodes
)
/
2
)
+
(
espacement
/
9
);
if
(
centreX
)
else
sx
=
cX
;
sx
=
cX
-
(
(
espacement
*
nbcodes
)
/
2
)
+
(
espacement
/
9
);
if
(
centreY
)
sy
=
cY
+
(
size_v
/
2
);
else
else
sy
=
cY
;
sx
=
cX
;
if
(
centreY
)
/* trace du texte */
sy
=
cY
+
(
size_v
/
2
);
for
(
;
kk
<
nbcodes
;
kk
++
)
else
{
sy
=
cY
;
int
code
=
Text
.
GetChar
(
kk
)
&
0xFF
;
ptcar
=
graphic_fonte_shape
[
code
]
;
/* ptcar pointe la description
/* trace du texte */
du caractere a dessiner */
for
(
;
kk
<
nbcodes
;
kk
++
)
{
plume
=
'U'
;
ox
=
sx
;
oy
=
sy
;
int
code
=
Text
.
GetChar
(
kk
)
&
0xFF
;
RotatePoint
(
&
ox
,
&
oy
,
cX
,
cY
,
angle
);
ptcar
=
graphic_fonte_shape
[
code
];
/* ptcar pointe la description
fx
=
ox
;
fy
=
oy
;
* du caractere a dessiner */
for
(
end
=
0
;
end
==
0
;
ptcar
++
)
plume
=
'U'
;
ox
=
sx
;
oy
=
sy
;
{
RotatePoint
(
&
ox
,
&
oy
,
cX
,
cY
,
angle
);
f_cod
=
*
ptcar
;
/* get code n de la forme selectionnee */
fx
=
ox
;
fy
=
oy
;
switch
(
f_cod
)
{
for
(
end
=
0
;
end
==
0
;
ptcar
++
)
case
'X'
:
end
=
1
;
/* fin du caractere */
{
break
;
f_cod
=
*
ptcar
;
case
'U'
:
/* get code n de la forme selectionnee */
case
'D'
:
plume
=
f_cod
;
break
;
switch
(
f_cod
)
{
default
:
case
'X'
:
k1
=
f_cod
;
// Coord X
end
=
1
;
/* fin du caractere */
k1
=
(
k1
*
size_v
)
/
9
;
break
;
ptcar
++
;
k2
=
*
ptcar
;
// Coord Y
case
'U'
:
k2
=
(
k2
*
size_h
)
/
8
;
case
'D'
:
plume
=
f_cod
;
break
;
fx
=
k2
+
sx
;
fy
=
-
k1
+
sy
;
RotatePoint
(
&
fx
,
&
fy
,
cX
,
cY
,
angle
);
default
:
k1
=
f_cod
;
// Coord X
/* Trace du segment */
k1
=
(
k1
*
size_v
)
/
9
;
if
(
plume
==
'D'
)
ptcar
++
;
{
k2
=
*
ptcar
;
// Coord Y
switch
(
format_plot
)
k2
=
(
k2
*
size_h
)
/
8
;
{
case
PLOT_FORMAT_GERBER
:
fx
=
k2
+
sx
;
fy
=
-
k1
+
sy
;
PlotGERBERLine
(
wxPoint
(
ox
,
oy
),
wxPoint
(
fx
,
fy
),
epaisseur
)
;
RotatePoint
(
&
fx
,
&
fy
,
cX
,
cY
,
angle
);
break
;
/* Trace du segment */
case
PLOT_FORMAT_HPGL
:
if
(
plume
==
'D'
)
trace_1_segment_HPGL
(
ox
,
oy
,
fx
,
fy
,
epaisseur
)
;
{
break
;
switch
(
format_plot
)
{
case
PLOT_FORMAT_POST
:
case
PLOT_FORMAT_GERBER
:
PlotFilledSegmentPS
(
wxPoint
(
ox
,
oy
),
wxPoint
(
fx
,
fy
),
epaisseur
)
;
PlotGERBERLine
(
wxPoint
(
ox
,
oy
),
wxPoint
(
fx
,
fy
),
epaisseur
);
break
;
break
;
}
case
PLOT_FORMAT_HPGL
:
}
trace_1_segment_HPGL
(
ox
,
oy
,
fx
,
fy
,
epaisseur
);
ox
=
fx
;
oy
=
fy
;
break
;
}
/* fin switch decodade matrice de forme */
case
PLOT_FORMAT_POST
:
}
/* end boucle for = end trace de 1 caractere */
PlotFilledSegmentPS
(
wxPoint
(
ox
,
oy
),
wxPoint
(
fx
,
fy
),
epaisseur
);
break
;
sx
+=
espacement
;
}
}
/* end trace du texte */
}
ox
=
fx
;
oy
=
fy
;
}
/* fin switch decodade matrice de forme */
}
/* end boucle for = end trace de 1 caractere */
sx
+=
espacement
;
}
/* end trace du texte */
}
}
/***********************************/
/***********************************/
void
Affiche_erreur
(
int
nb_err
)
void
Affiche_erreur
(
int
nb_err
)
/***********************************/
/***********************************/
/* Affiche le nombre d'erreurs commises ( segments traces avec plume trop grosse
/* Affiche le nombre d'erreurs commises ( segments traces avec plume trop grosse
ou autres */
*
ou autres */
{
{
// sprintf(msg,"%d",nb_err) ;
// sprintf(msg,"%d",nb_err) ;
// Affiche_1_Parametre(this, 30,"Err",msg,GREEN) ;
// Affiche_1_Parametre(this, 30,"Err",msg,GREEN) ;
...
@@ -608,180 +665,203 @@ void Affiche_erreur( int nb_err)
...
@@ -608,180 +665,203 @@ void Affiche_erreur( int nb_err)
/******************************************************************************/
/******************************************************************************/
void
PlotDrawSegment
(
DRAWSEGMENT
*
pt_segm
,
int
Format
,
int
masque_layer
)
void
PlotDrawSegment
(
DRAWSEGMENT
*
pt_segm
,
int
Format
,
int
masque_layer
)
/******************************************************************************/
/******************************************************************************/
/* Trace un element du type DRAWSEGMENT draw appartenant
/* Trace un element du type DRAWSEGMENT draw appartenant
aux couches specifiees par masque_layer
*
aux couches specifiees par masque_layer
*/
*/
{
{
wxPoint
start
,
end
;
wxPoint
start
,
end
;
int
epaisseur
;
int
epaisseur
;
int
rayon
=
0
,
StAngle
=
0
,
EndAngle
=
0
;
int
rayon
=
0
,
StAngle
=
0
,
EndAngle
=
0
;
if
(
(
g_TabOneLayerMask
[
pt_segm
->
GetLayer
()]
&
masque_layer
)
==
0
)
return
;
if
(
(
g_TabOneLayerMask
[
pt_segm
->
GetLayer
()]
&
masque_layer
)
==
0
)
return
;
epaisseur
=
pt_segm
->
m_Width
;
if
(
Plot_Mode
==
FILAIRE
)
epaisseur
=
g_PlotLine_Width
;
epaisseur
=
pt_segm
->
m_Width
;
if
(
Plot_Mode
==
FILAIRE
)
start
=
pt_segm
->
m_Start
;
end
=
pt_segm
->
m_End
;
epaisseur
=
g_PlotLine_Width
;
if
(
pt_segm
->
m_Shape
==
S_CIRCLE
)
start
=
pt_segm
->
m_Start
;
end
=
pt_segm
->
m_End
;
{
rayon
=
(
int
)
hypot
((
double
)(
end
.
x
-
start
.
x
),(
double
)(
end
.
y
-
start
.
y
)
);
if
(
pt_segm
->
m_Shape
==
S_CIRCLE
)
}
{
rayon
=
(
int
)
hypot
(
(
double
)
(
end
.
x
-
start
.
x
),
(
double
)
(
end
.
y
-
start
.
y
)
);
if
(
pt_segm
->
m_Shape
==
S_ARC
)
}
{
rayon
=
(
int
)
hypot
((
double
)(
end
.
x
-
start
.
x
),(
double
)(
end
.
y
-
start
.
y
)
);
if
(
pt_segm
->
m_Shape
==
S_ARC
)
StAngle
=
ArcTangente
(
end
.
y
-
start
.
y
,
end
.
x
-
start
.
x
);
{
EndAngle
=
StAngle
+
pt_segm
->
m_Angle
;
rayon
=
(
int
)
hypot
(
(
double
)
(
end
.
x
-
start
.
x
),
(
double
)
(
end
.
y
-
start
.
y
)
);
if
(
StAngle
>
EndAngle
)
EXCHG
(
StAngle
,
EndAngle
);
StAngle
=
ArcTangente
(
end
.
y
-
start
.
y
,
end
.
x
-
start
.
x
);
}
EndAngle
=
StAngle
+
pt_segm
->
m_Angle
;
if
(
StAngle
>
EndAngle
)
switch
(
Format
)
EXCHG
(
StAngle
,
EndAngle
);
{
}
case
PLOT_FORMAT_GERBER
:
if
(
pt_segm
->
m_Shape
==
S_CIRCLE
)
switch
(
Format
)
PlotCircle
(
PLOT_FORMAT_GERBER
,
epaisseur
,
start
,
rayon
)
;
{
else
if
(
pt_segm
->
m_Shape
==
S_ARC
)
case
PLOT_FORMAT_GERBER
:
PlotArc
(
PLOT_FORMAT_GERBER
,
start
,
if
(
pt_segm
->
m_Shape
==
S_CIRCLE
)
StAngle
,
EndAngle
,
rayon
,
epaisseur
);
PlotCircle
(
PLOT_FORMAT_GERBER
,
epaisseur
,
start
,
rayon
);
else
PlotGERBERLine
(
start
,
end
,
epaisseur
)
;
else
if
(
pt_segm
->
m_Shape
==
S_ARC
)
break
;
PlotArc
(
PLOT_FORMAT_GERBER
,
start
,
StAngle
,
EndAngle
,
rayon
,
epaisseur
);
case
PLOT_FORMAT_HPGL
:
else
if
(
pt_segm
->
m_Shape
==
S_CIRCLE
)
PlotGERBERLine
(
start
,
end
,
epaisseur
);
PlotCircle
(
PLOT_FORMAT_HPGL
,
epaisseur
,
start
,
rayon
)
;
break
;
else
if
(
pt_segm
->
m_Shape
==
S_ARC
)
PlotArc
(
PLOT_FORMAT_HPGL
,
start
,
StAngle
,
EndAngle
,
rayon
,
epaisseur
);
case
PLOT_FORMAT_HPGL
:
else
trace_1_segment_HPGL
(
start
.
x
,
start
.
y
,
end
.
x
,
end
.
y
,
epaisseur
)
;
if
(
pt_segm
->
m_Shape
==
S_CIRCLE
)
break
;
PlotCircle
(
PLOT_FORMAT_HPGL
,
epaisseur
,
start
,
rayon
);
else
if
(
pt_segm
->
m_Shape
==
S_ARC
)
case
PLOT_FORMAT_POST
:
PlotArc
(
PLOT_FORMAT_HPGL
,
start
,
StAngle
,
EndAngle
,
rayon
,
epaisseur
);
if
(
pt_segm
->
m_Shape
==
S_CIRCLE
)
else
PlotCircle
(
PLOT_FORMAT_POST
,
epaisseur
,
start
,
rayon
)
;
trace_1_segment_HPGL
(
start
.
x
,
start
.
y
,
end
.
x
,
end
.
y
,
epaisseur
);
else
if
(
pt_segm
->
m_Shape
==
S_ARC
)
break
;
PlotArc
(
PLOT_FORMAT_POST
,
start
,
StAngle
,
EndAngle
,
rayon
,
epaisseur
);
case
PLOT_FORMAT_POST
:
else
PlotFilledSegmentPS
(
start
,
end
,
epaisseur
)
;
if
(
pt_segm
->
m_Shape
==
S_CIRCLE
)
break
;
PlotCircle
(
PLOT_FORMAT_POST
,
epaisseur
,
start
,
rayon
);
}
else
if
(
pt_segm
->
m_Shape
==
S_ARC
)
PlotArc
(
PLOT_FORMAT_POST
,
start
,
StAngle
,
EndAngle
,
rayon
,
epaisseur
);
else
PlotFilledSegmentPS
(
start
,
end
,
epaisseur
);
break
;
}
}
}
/*****************************************************************************/
/*****************************************************************************/
void
PlotCircle
(
int
format_plot
,
int
epaisseur
,
wxPoint
centre
,
int
rayon
)
void
PlotCircle
(
int
format_plot
,
int
epaisseur
,
wxPoint
centre
,
int
rayon
)
/*****************************************************************************/
/*****************************************************************************/
/* routine de trace de 1 cercle de centre cx, cy */
/* routine de trace de 1 cercle de centre cx, cy */
{
{
switch
(
format_plot
)
switch
(
format_plot
)
{
{
case
PLOT_FORMAT_GERBER
:
case
PLOT_FORMAT_GERBER
:
PlotCircle_GERBER
(
centre
,
rayon
,
epaisseur
)
;
PlotCircle_GERBER
(
centre
,
rayon
,
epaisseur
)
;
break
;
break
;
case
PLOT_FORMAT_HPGL
:
case
PLOT_FORMAT_HPGL
:
trace_1_pastille_RONDE_HPGL
(
centre
,
rayon
*
2
,
FILAIRE
)
;
trace_1_pastille_RONDE_HPGL
(
centre
,
rayon
*
2
,
FILAIRE
)
;
break
;
break
;
case
PLOT_FORMAT_POST
:
case
PLOT_FORMAT_POST
:
PlotCircle_PS
(
centre
,
rayon
*
2
,
epaisseur
);
PlotCircle_PS
(
centre
,
rayon
*
2
,
epaisseur
);
break
;
break
;
}
}
}
}
/**********************************************************************/
/**********************************************************************/
void
PlotPolygon
(
int
format_plot
,
bool
Filled
,
int
nbpoints
,
int
*
coord
)
void
PlotPolygon
(
int
format_plot
,
bool
Filled
,
int
nbpoints
,
int
*
coord
)
/**********************************************************************/
/**********************************************************************/
/* plot a polygon */
/* plot a polygon */
{
{
switch
(
format_plot
)
switch
(
format_plot
)
{
{
case
PLOT_FORMAT_GERBER
:
case
PLOT_FORMAT_GERBER
:
PlotPolygon_GERBER
(
nbpoints
,
coord
,
Filled
)
;
PlotPolygon_GERBER
(
nbpoints
,
coord
,
Filled
)
;
break
;
break
;
case
PLOT_FORMAT_HPGL
:
case
PLOT_FORMAT_HPGL
:
PlotPolyHPGL
(
nbpoints
,
coord
,
Filled
);
PlotPolyHPGL
(
nbpoints
,
coord
,
Filled
);
break
;
break
;
case
PLOT_FORMAT_POST
:
case
PLOT_FORMAT_POST
:
PlotPolyPS
(
nbpoints
,
coord
,
Filled
);
PlotPolyPS
(
nbpoints
,
coord
,
Filled
);
break
;
break
;
}
}
}
}
/************************************************************************/
/************************************************************************/
void
PlotArc
(
int
format_plot
,
wxPoint
centre
,
int
start_angle
,
int
end_angle
,
void
PlotArc
(
int
format_plot
,
wxPoint
centre
,
int
start_angle
,
int
end_angle
,
int
rayon
,
int
epaisseur
)
int
rayon
,
int
epaisseur
)
/************************************************************************/
/************************************************************************/
/* Polt 1 arc
/* Polt 1 arc
start, end = angles in 1/10 degree for start and stop point
*
start, end = angles in 1/10 degree for start and stop point
*/
*/
{
{
int
ii
;
int
ii
;
int
ox
,
oy
,
fx
,
fy
;
int
ox
,
oy
,
fx
,
fy
;
int
delta
;
/* increment (en 0.1 degres) angulaire pour trace de cercles */
int
delta
;
/* increment (en 0.1 degres) angulaire pour trace de cercles */
if
(
Plot_Mode
==
FILAIRE
)
epaisseur
=
g_PlotLine_Width
;
if
(
Plot_Mode
==
FILAIRE
)
epaisseur
=
g_PlotLine_Width
;
if
(
format_plot
==
PLOT_FORMAT_POST
)
{
if
(
format_plot
==
PLOT_FORMAT_POST
)
PlotArcPS
(
centre
,
start_angle
,
end_angle
,
rayon
,
epaisseur
);
{
return
;
PlotArcPS
(
centre
,
start_angle
,
end_angle
,
rayon
,
epaisseur
);
}
return
;
}
// change due to Y axis is negative orientation on screen
start_angle
=
-
start_angle
;
// change due to Y axis is negative orientation on screen
end_angle
=
-
end_angle
;
start_angle
=
-
start_angle
;
EXCHG
(
start_angle
,
end_angle
);
end_angle
=
-
end_angle
;
EXCHG
(
start_angle
,
end_angle
);
/* Correction pour petits cercles par rapport a l'epaisseur du trait */
if
(
rayon
<
(
epaisseur
*
10
)
)
delta
=
225
;
/* 16 segm pour 360 deg */
/* Correction pour petits cercles par rapport a l'epaisseur du trait */
if
(
rayon
<
(
epaisseur
*
5
)
)
delta
=
300
;
/* 12 segm pour 360 deg */
if
(
rayon
<
(
epaisseur
*
10
)
)
delta
=
225
;
/* 16 segm pour 360 deg */
if
(
start_angle
>
end_angle
)
end_angle
+=
3600
;
if
(
rayon
<
(
epaisseur
*
5
)
)
ox
=
rayon
;
oy
=
0
;
delta
=
300
;
/* 12 segm pour 360 deg */
RotatePoint
(
&
ox
,
&
oy
,
start_angle
);
if
(
start_angle
>
end_angle
)
delta
=
120
;
/* un cercle sera trace en 3600/delta = 30 segments / cercle*/
end_angle
+=
3600
;
for
(
ii
=
start_angle
+
delta
;
ii
<
end_angle
;
ii
+=
delta
)
ox
=
rayon
;
oy
=
0
;
{
RotatePoint
(
&
ox
,
&
oy
,
start_angle
);
fx
=
rayon
;
fy
=
0
;
RotatePoint
(
&
fx
,
&
fy
,
ii
);
delta
=
120
;
/* un cercle sera trace en 3600/delta = 30 segments / cercle*/
switch
(
format_plot
)
for
(
ii
=
start_angle
+
delta
;
ii
<
end_angle
;
ii
+=
delta
)
{
{
case
PLOT_FORMAT_GERBER
:
fx
=
rayon
;
fy
=
0
;
PlotGERBERLine
(
wxPoint
(
centre
.
x
+
ox
,
centre
.
y
+
oy
),
RotatePoint
(
&
fx
,
&
fy
,
ii
);
wxPoint
(
centre
.
x
+
fx
,
centre
.
y
+
fy
),
epaisseur
)
;
break
;
switch
(
format_plot
)
{
case
PLOT_FORMAT_HPGL
:
case
PLOT_FORMAT_GERBER
:
trace_1_segment_HPGL
(
centre
.
x
+
ox
,
centre
.
y
+
oy
,
centre
.
x
+
fx
,
centre
.
y
+
fy
,
epaisseur
)
;
PlotGERBERLine
(
wxPoint
(
centre
.
x
+
ox
,
centre
.
y
+
oy
),
break
;
wxPoint
(
centre
.
x
+
fx
,
centre
.
y
+
fy
),
epaisseur
);
break
;
case
PLOT_FORMAT_POST
:
break
;
case
PLOT_FORMAT_HPGL
:
}
trace_1_segment_HPGL
(
centre
.
x
+
ox
,
ox
=
fx
;
oy
=
fy
;
centre
.
y
+
oy
,
}
centre
.
x
+
fx
,
centre
.
y
+
fy
,
fx
=
rayon
;
fy
=
0
;
epaisseur
);
RotatePoint
(
&
fx
,
&
fy
,
end_angle
);
break
;
switch
(
format_plot
)
{
case
PLOT_FORMAT_POST
:
case
PLOT_FORMAT_GERBER
:
break
;
PlotGERBERLine
(
wxPoint
(
centre
.
x
+
ox
,
centre
.
y
+
oy
),
}
wxPoint
(
centre
.
x
+
fx
,
centre
.
y
+
fy
),
epaisseur
)
;
break
;
ox
=
fx
;
oy
=
fy
;
}
case
PLOT_FORMAT_HPGL
:
trace_1_segment_HPGL
(
centre
.
x
+
ox
,
centre
.
y
+
oy
,
centre
.
x
+
fx
,
centre
.
y
+
fy
,
epaisseur
)
;
fx
=
rayon
;
fy
=
0
;
break
;
RotatePoint
(
&
fx
,
&
fy
,
end_angle
);
case
PLOT_FORMAT_POST
:
switch
(
format_plot
)
break
;
{
}
case
PLOT_FORMAT_GERBER
:
PlotGERBERLine
(
wxPoint
(
centre
.
x
+
ox
,
centre
.
y
+
oy
),
wxPoint
(
centre
.
x
+
fx
,
centre
.
y
+
fy
),
epaisseur
);
break
;
case
PLOT_FORMAT_HPGL
:
trace_1_segment_HPGL
(
centre
.
x
+
ox
,
centre
.
y
+
oy
,
centre
.
x
+
fx
,
centre
.
y
+
fy
,
epaisseur
);
break
;
case
PLOT_FORMAT_POST
:
break
;
}
}
}
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