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
5fa61ecd
Commit
5fa61ecd
authored
Sep 25, 2012
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finishing code cleaning in plot functions.
parent
2d49ced7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
96 additions
and
94 deletions
+96
-94
pcbplot.h
pcbnew/pcbplot.h
+9
-1
plot_board_layers.cpp
pcbnew/plot_board_layers.cpp
+35
-90
plot_brditems_plotter.cpp
pcbnew/plot_brditems_plotter.cpp
+52
-3
No files found.
pcbnew/pcbplot.h
View file @
5fa61ecd
...
@@ -90,7 +90,15 @@ public:
...
@@ -90,7 +90,15 @@ public:
void
PlotDrawSegment
(
DRAWSEGMENT
*
PtSegm
);
void
PlotDrawSegment
(
DRAWSEGMENT
*
PtSegm
);
/**
/**
* lot items like text and graphics,
* Plot a pad.
* unlike other items, a pad had not a specific color,
* and be drawn as a non filled item although the plot mode is filled
* color and plot mode are needed by this function
*/
void
PlotPad
(
D_PAD
*
aPad
,
EDA_COLOR_T
aColor
,
EDA_DRAW_MODE_T
aPlotMode
);
/**
* plot items like text and graphics,
* but not tracks and modules
* but not tracks and modules
*/
*/
void
PlotBoardGraphicItems
();
void
PlotBoardGraphicItems
();
...
...
pcbnew/plot_board_layers.cpp
View file @
5fa61ecd
...
@@ -85,8 +85,6 @@ void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, long aLayerMask,
...
@@ -85,8 +85,6 @@ void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, long aLayerMask,
if
(
(
masklayer
&
layersmask_plotpads
)
==
0
)
if
(
(
masklayer
&
layersmask_plotpads
)
==
0
)
continue
;
continue
;
wxPoint
shape_pos
=
pad
->
ReturnShapePos
();
EDA_COLOR_T
color
=
ColorFromInt
(
0
);
EDA_COLOR_T
color
=
ColorFromInt
(
0
);
if
(
(
layersmask_plotpads
&
SILKSCREEN_LAYER_BACK
)
)
if
(
(
layersmask_plotpads
&
SILKSCREEN_LAYER_BACK
)
)
color
=
aBoard
->
GetLayerColor
(
SILKSCREEN_N_BACK
);
color
=
aBoard
->
GetLayerColor
(
SILKSCREEN_N_BACK
);
...
@@ -94,36 +92,7 @@ void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, long aLayerMask,
...
@@ -94,36 +92,7 @@ void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, long aLayerMask,
if
((
layersmask_plotpads
&
SILKSCREEN_LAYER_FRONT
)
)
if
((
layersmask_plotpads
&
SILKSCREEN_LAYER_FRONT
)
)
color
=
ColorFromInt
(
color
|
aBoard
->
GetLayerColor
(
SILKSCREEN_N_FRONT
)
);
color
=
ColorFromInt
(
color
|
aBoard
->
GetLayerColor
(
SILKSCREEN_N_FRONT
)
);
// Set plot color (change WHITE to LIGHTGRAY because
itemplotter
.
PlotPad
(
pad
,
color
,
LINE
);
// the white items are not seen on a white paper or screen
aPlotter
->
SetColor
(
color
!=
WHITE
?
color
:
LIGHTGRAY
);
switch
(
pad
->
GetShape
()
)
{
case
PAD_CIRCLE
:
aPlotter
->
FlashPadCircle
(
shape_pos
,
pad
->
GetSize
().
x
,
LINE
);
break
;
case
PAD_OVAL
:
aPlotter
->
FlashPadOval
(
shape_pos
,
pad
->
GetSize
(),
pad
->
GetOrientation
(),
LINE
);
break
;
case
PAD_TRAPEZOID
:
{
wxPoint
coord
[
4
];
pad
->
BuildPadPolygon
(
coord
,
wxSize
(
0
,
0
),
0
);
aPlotter
->
FlashPadTrapez
(
shape_pos
,
coord
,
pad
->
GetOrientation
(),
LINE
);
}
break
;
case
PAD_RECT
:
default:
aPlotter
->
FlashPadRect
(
shape_pos
,
pad
->
GetSize
(),
pad
->
GetOrientation
(),
LINE
);
break
;
}
}
}
}
}
}
}
...
@@ -302,15 +271,11 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
...
@@ -302,15 +271,11 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
if
(
(
pad
->
GetLayerMask
()
&
aLayerMask
)
==
0
)
if
(
(
pad
->
GetLayerMask
()
&
aLayerMask
)
==
0
)
continue
;
continue
;
wxPoint
shape_pos
=
pad
->
ReturnShapePos
();
wxSize
margin
;
wxSize
margin
;
double
width_adj
=
0
;
double
width_adj
=
0
;
if
(
aLayerMask
&
ALL_CU_LAYERS
)
if
(
aLayerMask
&
ALL_CU_LAYERS
)
{
width_adj
=
itemplotter
.
getFineWidthAdj
();
width_adj
=
itemplotter
.
getFineWidthAdj
();
}
switch
(
aLayerMask
&
switch
(
aLayerMask
&
(
SOLDERMASK_LAYER_BACK
|
SOLDERMASK_LAYER_FRONT
|
(
SOLDERMASK_LAYER_BACK
|
SOLDERMASK_LAYER_FRONT
|
...
@@ -330,12 +295,12 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
...
@@ -330,12 +295,12 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
break
;
break
;
}
}
wxSize
s
ize
;
wxSize
padPlotsS
ize
;
s
ize
.
x
=
pad
->
GetSize
().
x
+
(
2
*
margin
.
x
)
+
width_adj
;
padPlotsS
ize
.
x
=
pad
->
GetSize
().
x
+
(
2
*
margin
.
x
)
+
width_adj
;
s
ize
.
y
=
pad
->
GetSize
().
y
+
(
2
*
margin
.
y
)
+
width_adj
;
padPlotsS
ize
.
y
=
pad
->
GetSize
().
y
+
(
2
*
margin
.
y
)
+
width_adj
;
// Don't draw a null size item :
// Don't draw a null size item :
if
(
size
.
x
<=
0
||
s
ize
.
y
<=
0
)
if
(
padPlotsSize
.
x
<=
0
||
padPlotsS
ize
.
y
<=
0
)
continue
;
continue
;
EDA_COLOR_T
color
=
BLACK
;
EDA_COLOR_T
color
=
BLACK
;
...
@@ -346,43 +311,27 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
...
@@ -346,43 +311,27 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
if
((
pad
->
GetLayerMask
()
&
LAYER_FRONT
)
)
if
((
pad
->
GetLayerMask
()
&
LAYER_FRONT
)
)
color
=
ColorFromInt
(
color
|
aBoard
->
GetVisibleElementColor
(
PAD_FR_VISIBLE
)
);
color
=
ColorFromInt
(
color
|
aBoard
->
GetVisibleElementColor
(
PAD_FR_VISIBLE
)
);
// Set plot color (change WHITE to LIGHTGRAY because
// Temporary set the pad size to the required plot size:
// the white items are not seen on a white paper or screen
wxSize
tmppadsize
=
pad
->
GetSize
();
aPlotter
->
SetColor
(
color
!=
WHITE
?
color
:
LIGHTGRAY
);
pad
->
SetSize
(
padPlotsSize
);
switch
(
pad
->
GetShape
()
)
switch
(
pad
->
GetShape
()
)
{
{
case
PAD_CIRCLE
:
case
PAD_CIRCLE
:
if
(
aPlotOpt
.
GetSkipPlotNPTH_Pads
()
&&
(
pad
->
GetSize
()
==
pad
->
GetDrillSize
())
&&
(
pad
->
GetAttribute
()
==
PAD_HOLE_NOT_PLATED
)
)
break
;
aPlotter
->
FlashPadCircle
(
shape_pos
,
size
.
x
,
plotMode
);
break
;
case
PAD_OVAL
:
case
PAD_OVAL
:
if
(
aPlotOpt
.
GetSkipPlotNPTH_Pads
()
&&
if
(
aPlotOpt
.
GetSkipPlotNPTH_Pads
()
&&
(
pad
->
GetSize
()
==
pad
->
GetDrillSize
())
&&
(
pad
->
GetSize
()
==
pad
->
GetDrillSize
())
&&
(
pad
->
GetAttribute
()
==
PAD_HOLE_NOT_PLATED
)
)
(
pad
->
GetAttribute
()
==
PAD_HOLE_NOT_PLATED
)
)
break
;
break
;
aPlotter
->
FlashPadOval
(
shape_pos
,
size
,
pad
->
GetOrientation
(),
plotMode
);
// Fall through:
break
;
case
PAD_TRAPEZOID
:
case
PAD_TRAPEZOID
:
{
wxPoint
coord
[
4
];
pad
->
BuildPadPolygon
(
coord
,
margin
,
0
);
aPlotter
->
FlashPadTrapez
(
shape_pos
,
coord
,
pad
->
GetOrientation
(),
plotMode
);
}
break
;
case
PAD_RECT
:
case
PAD_RECT
:
default:
default:
aPlotter
->
FlashPadRect
(
shape_pos
,
size
,
pad
->
GetOrientation
()
,
plotMode
);
itemplotter
.
PlotPad
(
pad
,
color
,
plotMode
);
break
;
break
;
}
}
pad
->
SetSize
(
tmppadsize
);
// Restore the pad size
}
}
}
}
...
@@ -663,38 +612,34 @@ PLOTTER *StartPlotBoard( BOARD *aBoard, PCB_PLOT_PARAMS *aPlotOpts,
...
@@ -663,38 +612,34 @@ PLOTTER *StartPlotBoard( BOARD *aBoard, PCB_PLOT_PARAMS *aPlotOpts,
wxASSERT
(
false
);
wxASSERT
(
false
);
}
}
if
(
the_plotter
)
the_plotter
->
SetFilename
(
aFullFileName
);
{
the_plotter
->
SetFilename
(
aFullFileName
);
// Compute the viewport and set the other options
// Compute the viewport and set the other options
initializePlotter
(
the_plotter
,
aBoard
,
aPlotOpts
);
initializePlotter
(
the_plotter
,
aBoard
,
aPlotOpts
);
if
(
the_plotter
->
StartPlot
(
output_file
)
)
if
(
the_plotter
->
StartPlot
(
output_file
)
)
{
// Plot the frame reference if requested
if
(
aPlotOpts
->
GetPlotFrameRef
()
)
PlotWorkSheet
(
the_plotter
,
aBoard
->
GetTitleBlock
(),
aBoard
->
GetPageSettings
(),
1
,
1
,
// Only one page
aSheetDesc
,
aBoard
->
GetFileName
()
);
/* When plotting a negative board: draw a black rectangle
* (background for plot board in white) and switch the current
* color to WHITE; note the color inversion is actually done
* in the driver (if supported) */
if
(
aPlotOpts
->
GetNegative
()
)
{
{
// Plot the frame reference if requested
EDA_RECT
bbox
=
aBoard
->
ComputeBoundingBox
();
if
(
aPlotOpts
->
GetPlotFrameRef
()
)
FillNegativeKnockout
(
the_plotter
,
bbox
);
PlotWorkSheet
(
the_plotter
,
aBoard
->
GetTitleBlock
(),
aBoard
->
GetPageSettings
(),
1
,
1
,
// Only one page
aSheetDesc
,
aBoard
->
GetFileName
()
);
/* When plotting a negative board: draw a black rectangle
* (background for plot board in white) and switch the current
* color to WHITE; note the color inversion is actually done
* in the driver (if supported) */
if
(
aPlotOpts
->
GetNegative
()
)
{
EDA_RECT
bbox
=
aBoard
->
ComputeBoundingBox
();
FillNegativeKnockout
(
the_plotter
,
bbox
);
}
return
the_plotter
;
}
}
return
the_plotter
;
}
}
// error in start_plot( ) or before
// error in start_plot( )
wxMessageBox
(
_
(
"Error creating plot file"
)
);
delete
the_plotter
;
// will close also output_file
delete
the_plotter
;
return
NULL
;
return
NULL
;
}
}
pcbnew/plot_brditems_plotter.cpp
View file @
5fa61ecd
...
@@ -68,6 +68,55 @@ EDA_COLOR_T BRDITEMS_PLOTTER::getColor( int aLayer )
...
@@ -68,6 +68,55 @@ EDA_COLOR_T BRDITEMS_PLOTTER::getColor( int aLayer )
return
color
;
return
color
;
}
}
/*
* Plot a pad.
* unlike other items, a pad had not a specific color,
* and be drawn as a non filled item although the plot mode is filled
* color and plot mode are needed by this function
*/
void
BRDITEMS_PLOTTER
::
PlotPad
(
D_PAD
*
aPad
,
EDA_COLOR_T
aColor
,
EDA_DRAW_MODE_T
aPlotMode
)
{
wxPoint
shape_pos
=
aPad
->
ReturnShapePos
();
// Set plot color (change WHITE to LIGHTGRAY because
// the white items are not seen on a white paper or screen
m_plotter
->
SetColor
(
aColor
!=
WHITE
?
aColor
:
LIGHTGRAY
);
switch
(
aPad
->
GetShape
()
)
{
case
PAD_CIRCLE
:
m_plotter
->
FlashPadCircle
(
shape_pos
,
aPad
->
GetSize
().
x
,
aPlotMode
);
break
;
case
PAD_OVAL
:
m_plotter
->
FlashPadOval
(
shape_pos
,
aPad
->
GetSize
(),
aPad
->
GetOrientation
(),
aPlotMode
);
break
;
case
PAD_TRAPEZOID
:
{
wxPoint
coord
[
4
];
aPad
->
BuildPadPolygon
(
coord
,
wxSize
(
0
,
0
),
0
);
m_plotter
->
FlashPadTrapez
(
shape_pos
,
coord
,
aPad
->
GetOrientation
(),
aPlotMode
);
}
break
;
case
PAD_RECT
:
default
:
m_plotter
->
FlashPadRect
(
shape_pos
,
aPad
->
GetSize
(),
aPad
->
GetOrientation
(),
aPlotMode
);
break
;
}
}
/*
* Plot field of a module (footprint)
* Reference, Value, and other fields are plotted only if
* the corresponding option is enabled
* Invisible text fields are plotted only if PlotInvisibleText option is set
* usually they are not plotted.
*/
bool
BRDITEMS_PLOTTER
::
PlotAllTextsModule
(
MODULE
*
aModule
)
bool
BRDITEMS_PLOTTER
::
PlotAllTextsModule
(
MODULE
*
aModule
)
{
{
// see if we want to plot VALUE and REF fields
// see if we want to plot VALUE and REF fields
...
@@ -77,7 +126,7 @@ bool BRDITEMS_PLOTTER::PlotAllTextsModule( MODULE* aModule )
...
@@ -77,7 +126,7 @@ bool BRDITEMS_PLOTTER::PlotAllTextsModule( MODULE* aModule )
TEXTE_MODULE
*
textModule
=
aModule
->
m_Reference
;
TEXTE_MODULE
*
textModule
=
aModule
->
m_Reference
;
unsigned
textLayer
=
textModule
->
GetLayer
();
unsigned
textLayer
=
textModule
->
GetLayer
();
if
(
textLayer
>=
32
)
if
(
textLayer
>=
LAYER_COUNT
)
return
false
;
return
false
;
if
(
(
(
1
<<
textLayer
)
&
m_layerMask
)
==
0
)
if
(
(
(
1
<<
textLayer
)
&
m_layerMask
)
==
0
)
...
@@ -89,7 +138,7 @@ bool BRDITEMS_PLOTTER::PlotAllTextsModule( MODULE* aModule )
...
@@ -89,7 +138,7 @@ bool BRDITEMS_PLOTTER::PlotAllTextsModule( MODULE* aModule )
textModule
=
aModule
->
m_Value
;
textModule
=
aModule
->
m_Value
;
textLayer
=
textModule
->
GetLayer
();
textLayer
=
textModule
->
GetLayer
();
if
(
textLayer
>
32
)
if
(
textLayer
>
LAYER_COUNT
)
return
false
;
return
false
;
if
(
(
(
1
<<
textLayer
)
&
m_layerMask
)
==
0
)
if
(
(
(
1
<<
textLayer
)
&
m_layerMask
)
==
0
)
...
@@ -129,7 +178,7 @@ bool BRDITEMS_PLOTTER::PlotAllTextsModule( MODULE* aModule )
...
@@ -129,7 +178,7 @@ bool BRDITEMS_PLOTTER::PlotAllTextsModule( MODULE* aModule )
textLayer
=
textModule
->
GetLayer
();
textLayer
=
textModule
->
GetLayer
();
if
(
textLayer
>=
32
)
if
(
textLayer
>=
LAYER_COUNT
)
return
false
;
return
false
;
if
(
!
(
(
1
<<
textLayer
)
&
m_layerMask
)
)
if
(
!
(
(
1
<<
textLayer
)
&
m_layerMask
)
)
...
...
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