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
eb94e66c
Commit
eb94e66c
authored
Sep 21, 2012
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pcbnew: some code cleanup in plot functions.
parent
b1c9c542
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
185 additions
and
194 deletions
+185
-194
gen_drill_report_files.cpp
pcbnew/gen_drill_report_files.cpp
+6
-13
pcbplot.h
pcbnew/pcbplot.h
+41
-20
plot_rtn.cpp
pcbnew/plot_rtn.cpp
+138
-161
No files found.
pcbnew/gen_drill_report_files.cpp
View file @
eb94e66c
...
@@ -41,7 +41,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
...
@@ -41,7 +41,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
wxPoint
offset
;
wxPoint
offset
;
PLOTTER
*
plotter
=
NULL
;
PLOTTER
*
plotter
=
NULL
;
const
PCB_PLOT_PARAMS
&
plot_opts
=
aPcb
->
GetPlotOptions
();
PCB_PLOT_PARAMS
plot_opts
;
// starts plotting with default options
LOCALE_IO
toggle
;
// use standard C notation for float numbers
LOCALE_IO
toggle
;
// use standard C notation for float numbers
...
@@ -131,33 +131,26 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
...
@@ -131,33 +131,26 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
plotter
->
SetDefaultLineWidth
(
10
*
IU_PER_DECIMILS
);
plotter
->
SetDefaultLineWidth
(
10
*
IU_PER_DECIMILS
);
plotter
->
StartPlot
(
aFile
);
plotter
->
StartPlot
(
aFile
);
// Draw items on edge layer
// Draw items on edge layer (not all, only items useful for drill map
BRDITEMS_PLOTTER
itemplotter
(
plotter
,
aPcb
,
plot_opts
);
itemplotter
.
SetLayerMask
(
EDGE_LAYER
);
for
(
EDA_ITEM
*
PtStruct
=
aPcb
->
m_Drawings
;
PtStruct
!=
NULL
;
PtStruct
=
PtStruct
->
Next
()
)
for
(
EDA_ITEM
*
PtStruct
=
aPcb
->
m_Drawings
;
PtStruct
!=
NULL
;
PtStruct
=
PtStruct
->
Next
()
)
{
{
switch
(
PtStruct
->
Type
()
)
switch
(
PtStruct
->
Type
()
)
{
{
case
PCB_LINE_T
:
case
PCB_LINE_T
:
PlotDrawSegment
(
plotter
,
plot_opts
,
(
DRAWSEGMENT
*
)
PtStruct
,
EDGE_LAYER
,
FILLED
);
itemplotter
.
PlotDrawSegment
(
(
DRAWSEGMENT
*
)
PtStruct
);
break
;
break
;
case
PCB_TEXT_T
:
case
PCB_TEXT_T
:
PlotTextePcb
(
plotter
,
plot_opts
,
(
TEXTE_PCB
*
)
PtStruct
,
EDGE_LAYER
,
FILLED
);
itemplotter
.
PlotTextePcb
(
(
TEXTE_PCB
*
)
PtStruct
);
break
;
break
;
case
PCB_DIMENSION_T
:
case
PCB_DIMENSION_T
:
PlotDimension
(
plotter
,
plot_opts
,
(
DIMENSION
*
)
PtStruct
,
EDGE_LAYER
,
FILLED
);
break
;
case
PCB_TARGET_T
:
case
PCB_TARGET_T
:
PlotPcbTarget
(
plotter
,
plot_opts
,
(
PCB_TARGET
*
)
PtStruct
,
EDGE_LAYER
,
FILLED
);
break
;
case
PCB_MARKER_T
:
// do not draw
case
PCB_MARKER_T
:
// do not draw
break
;
default:
default:
DisplayError
(
NULL
,
wxT
(
"WinEDA_DrillFrame::GenDrillMap() : Unexpected Draw Type"
)
);
break
;
break
;
}
}
}
}
...
...
pcbnew/pcbplot.h
View file @
eb94e66c
...
@@ -7,14 +7,16 @@
...
@@ -7,14 +7,16 @@
#include <pcb_plot_params.h>
#include <pcb_plot_params.h>
class
PLOTTER
;
class
PLOTTER
;
class
TEXTE_PCB
;
class
TEXTE_PCB
;
class
DRAWSEGMENT
;
class
DRAWSEGMENT
;
class
DIMENSION
;
class
DIMENSION
;
class
MODULE
;
class
EDGE_MODULE
;
class
EDGE_MODULE
;
class
PCB_TARGET
;
class
PCB_TARGET
;
class
TEXTE_MODULE
;
class
ZONE_CONTAINER
;
class
ZONE_CONTAINER
;
class
BOARD
;
// Shared Config keys for plot and print
// Shared Config keys for plot and print
...
@@ -43,25 +45,44 @@ class ZONE_CONTAINER;
...
@@ -43,25 +45,44 @@ class ZONE_CONTAINER;
// Small drill marks diameter value (in 1/10000 inch)
// Small drill marks diameter value (in 1/10000 inch)
#define SMALL_DRILL 150
#define SMALL_DRILL 150
// A helper class to plot board items
class
BRDITEMS_PLOTTER
:
public
PCB_PLOT_PARAMS
void
PlotTextePcb
(
PLOTTER
*
plotter
,
const
PCB_PLOT_PARAMS
&
aPlotOpts
,
TEXTE_PCB
*
pt_texte
,
int
masque_layer
,
{
EDA_DRAW_MODE_T
trace_mode
);
PLOTTER
*
m_plotter
;
BOARD
*
m_board
;
void
PlotDrawSegment
(
PLOTTER
*
plotter
,
const
PCB_PLOT_PARAMS
&
aPlotOpts
,
DRAWSEGMENT
*
PtSegm
,
int
masque_layer
,
int
m_layerMask
;
EDA_DRAW_MODE_T
trace_mode
);
public
:
void
PlotDimension
(
PLOTTER
*
plotter
,
const
PCB_PLOT_PARAMS
&
aPlotOpts
,
DIMENSION
*
Dimension
,
int
masque_layer
,
BRDITEMS_PLOTTER
(
PLOTTER
*
aPlotter
,
BOARD
*
aBoard
,
const
PCB_PLOT_PARAMS
&
aPlotOpts
)
EDA_DRAW_MODE_T
trace_mode
);
:
PCB_PLOT_PARAMS
(
aPlotOpts
)
{
void
PlotPcbTarget
(
PLOTTER
*
plotter
,
const
PCB_PLOT_PARAMS
&
aPlotOpts
,
PCB_TARGET
*
PtMire
,
int
masque_layer
,
m_plotter
=
aPlotter
;
EDA_DRAW_MODE_T
trace_mode
);
m_board
=
aBoard
;
m_layerMask
=
0
;
void
Plot_1_EdgeModule
(
PLOTTER
*
plotter
,
const
PCB_PLOT_PARAMS
&
aPlotOpts
,
EDGE_MODULE
*
PtEdge
,
}
EDA_DRAW_MODE_T
trace_mode
,
int
masque_layer
);
// Basic functions to plot a board item
void
PlotFilledAreas
(
PLOTTER
*
plotter
,
const
PCB_PLOT_PARAMS
&
aPlotOpts
,
ZONE_CONTAINER
*
aZone
,
void
SetLayerMask
(
int
aLayerMask
){
m_layerMask
=
aLayerMask
;
}
EDA_DRAW_MODE_T
trace_mode
);
void
Plot_Edges_Modules
();
void
Plot_1_EdgeModule
(
EDGE_MODULE
*
aEdge
);
void
PlotTextModule
(
TEXTE_MODULE
*
aTextMod
,
EDA_COLOR_T
aColor
);
bool
PlotAllTextsModule
(
MODULE
*
aModule
);
void
PlotDimension
(
DIMENSION
*
Dimension
);
void
PlotPcbTarget
(
PCB_TARGET
*
PtMire
);
void
PlotFilledAreas
(
ZONE_CONTAINER
*
aZone
);
void
PlotTextePcb
(
TEXTE_PCB
*
pt_texte
);
void
PlotDrawSegment
(
DRAWSEGMENT
*
PtSegm
);
/**
* Function getColor
* @return the layer color
* @param aLayer = the layer id
* White color is special: cannot be seen on a white paper
* and in B&W mode, is plotted as white but other colors are plotted in BLACK
* so the returned color is LIGHTGRAY when the layer color is WHITE
*/
EDA_COLOR_T
getColor
(
int
aLayer
);
};
PLOTTER
*
StartPlotBoard
(
BOARD
*
aBoard
,
PLOTTER
*
StartPlotBoard
(
BOARD
*
aBoard
,
PCB_PLOT_PARAMS
*
aPlotOpts
,
PCB_PLOT_PARAMS
*
aPlotOpts
,
...
...
pcbnew/plot_rtn.cpp
View file @
eb94e66c
This diff is collapsed.
Click to expand it.
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