KiCad PCB EDA Suite
PCBNEW_PRINTOUT Class Reference

#include <pcbnew_printout.h>

Inheritance diagram for PCBNEW_PRINTOUT:
BOARD_PRINTOUT

Public Member Functions

 PCBNEW_PRINTOUT (BOARD *aBoard, const PCBNEW_PRINTOUT_SETTINGS &aParams, const KIGFX::VIEW *aView, const wxString &aTitle)
 
bool OnPrintPage (int aPage) override
 
void GetPageInfo (int *minPage, int *maxPage, int *selPageFrom, int *selPageTo) override
 
bool HasPage (int aPage) override
 
virtual void DrawPage (const wxString &aLayerName=wxEmptyString, int aPageNum=1, int aPageCount=1)
 Print a page (or a set of pages). More...
 

Protected Member Functions

int milsToIU (double aMils) const override
 < Convert mils to internal units More...
 
void setupViewLayers (KIGFX::VIEW &aView, const LSET &aLayerSet) override
 Configures PAINTER object for a printout. More...
 
void setupPainter (KIGFX::PAINTER &aPainter) override
 Configures GAL object for a printout. More...
 
void setupGal (KIGFX::GAL *aGal) override
 Returns bounding box of the printed objects (excluding drawing-sheet frame) More...
 
EDA_RECT getBoundingBox () override
 Returns a PAINTER instance used to draw the items. More...
 
std::unique_ptr< KIGFX::PAINTERgetPainter (KIGFX::GAL *aGal) override
 Source VIEW object (note that actual printing only refers to this object) More...
 

Protected Attributes

const KIGFX::VIEWm_view
 Printout parameters. More...
 
BOARD_PRINTOUT_SETTINGS m_settings
 
bool m_gerbviewPrint
 True if the caller is Gerbview, false for Pcbnew. More...
 

Private Attributes

BOARDm_board
 
PCBNEW_PRINTOUT_SETTINGS m_pcbnewSettings
 

Detailed Description

Definition at line 52 of file pcbnew_printout.h.

Constructor & Destructor Documentation

◆ PCBNEW_PRINTOUT()

PCBNEW_PRINTOUT::PCBNEW_PRINTOUT ( BOARD aBoard,
const PCBNEW_PRINTOUT_SETTINGS aParams,
const KIGFX::VIEW aView,
const wxString &  aTitle 
)

Definition at line 75 of file pcbnew_printout.cpp.

76  :
77  BOARD_PRINTOUT( aParams, aView, aTitle ), m_pcbnewSettings( aParams )
78 {
79  m_board = aBoard;
80 }
PCBNEW_PRINTOUT_SETTINGS m_pcbnewSettings
BOARD_PRINTOUT(const BOARD_PRINTOUT_SETTINGS &aParams, const KIGFX::VIEW *aView, const wxString &aTitle)

References m_board.

Member Function Documentation

◆ DrawPage()

void BOARD_PRINTOUT::DrawPage ( const wxString &  aLayerName = wxEmptyString,
int  aPageNum = 1,
int  aPageCount = 1 
)
virtualinherited

Print a page (or a set of pages).

Note
This function prepares the print parameters for the function which actually prints the draw layers.
Parameters
aLayerNamea text which can be printed as layer name.
aPageNumthe number of the current page (only used to print this value).
aPageCountthe number of pages to print (only used to print this value).

Definition at line 87 of file board_printout.cpp.

88 {
89  wxDC* dc = GetDC();
91  std::unique_ptr<KIGFX::GAL_PRINT> galPrint = KIGFX::GAL_PRINT::Create( options, dc );
92  KIGFX::GAL* gal = galPrint->GetGAL();
93  KIGFX::PRINT_CONTEXT* printCtx = galPrint->GetPrintCtx();
94  std::unique_ptr<KIGFX::PAINTER> painter = getPainter( gal );
95  std::unique_ptr<KIGFX::VIEW> view( m_view->DataReference() );
96 
97  // Target paper size
98  wxRect pageSizePx = GetLogicalPageRect();
99  const VECTOR2D pageSizeIn( (double) pageSizePx.width / dc->GetPPI().x,
100  (double) pageSizePx.height / dc->GetPPI().y );
101  const VECTOR2D pageSizeIU( milsToIU( pageSizeIn.x * 1000 ), milsToIU( pageSizeIn.y * 1000 ) );
102 
103  galPrint->SetSheetSize( pageSizeIn );
104 
105  view->SetGAL( gal );
106  view->SetPainter( painter.get() );
107  view->SetScaleLimits( 10e9, 0.0001 );
108  view->SetScale( 1.0 );
109 
110 
111  // Set the color scheme
112  RENDER_SETTINGS* dstSettings = view->GetPainter()->GetSettings();
113  dstSettings->LoadColors( m_settings.m_colorSettings );
114 
116  {
117  for( int i = 0; i < LAYER_ID_COUNT; ++i )
118  dstSettings->SetLayerColor( i, COLOR4D::BLACK );
119  }
120  else // color enabled
121  {
122  for( int i = 0; i < LAYER_ID_COUNT; ++i )
123  {
124  // Cairo does not support translucent colors on PostScript surfaces
125  // see 'Features support by the PostScript surface' on
126  // https://www.cairographics.org/documentation/using_the_postscript_surface/
127  dstSettings->SetLayerColor( i, dstSettings->GetLayerColor( i ).WithAlpha( 1.0 ) );
128  }
129  }
130 
131  dstSettings->SetIsPrinting( true );
132 
133  setupPainter( *painter );
135 
136  wxSize sheetSizeMils = m_settings.m_pageInfo.GetSizeMils();
137  VECTOR2I sheetSizeIU( milsToIU( sheetSizeMils.GetWidth() ),
138  milsToIU( sheetSizeMils.GetHeight() ) );
139  BOX2I bBox;
140 
141  // Determine printout bounding box
143  {
144  bBox = BOX2I( VECTOR2I( 0, 0 ), VECTOR2I( sheetSizeIU ) );
145  view->SetLayerVisible( LAYER_DRAWINGSHEET, true );
146  }
147  else
148  {
149  EDA_RECT targetBbox = getBoundingBox();
150  bBox = BOX2I( targetBbox.GetOrigin(), targetBbox.GetSize() );
151  view->SetLayerVisible( LAYER_DRAWINGSHEET, false );
152  }
153 
154 
155  // Fit to page
156  if( m_settings.m_scale <= 0.0 )
157  {
158  if( bBox.GetWidth() == 0 || bBox.GetHeight() == 0 )
159  {
160  // Nothing to print
161  m_settings.m_scale = 1.0;
162  }
163  else
164  {
165  double scaleX = (double) pageSizeIU.x / bBox.GetWidth();
166  double scaleY = (double) pageSizeIU.y / bBox.GetHeight();
167  m_settings.m_scale = std::min( scaleX, scaleY );
168  }
169  }
170 
171  setupGal( gal );
172  galPrint->SetNativePaperSize( pageSizeIn, printCtx->HasNativeLandscapeRotation() );
173  gal->SetLookAtPoint( bBox.Centre() );
175 
176  gal->SetClearColor( dstSettings->GetBackgroundColor() );
177  gal->ClearScreen();
178 
179  if( m_gerbviewPrint )
180  // Mandatory in Gerbview to use the same order for printing as for screen redraw
181  // due to negative objects that need a specific order
182  view->UseDrawPriority( true );
183 
184  {
185  KIGFX::GAL_DRAWING_CONTEXT ctx( gal );
186  view->Redraw();
187  }
188 }
void SetClearColor(const COLOR4D &aColor)
BOX2< VECTOR2I > BOX2I
Definition: box2.h:506
const PAGE_INFO & m_pageInfo
Definition: printout.h:63
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
virtual std::unique_ptr< KIGFX::PAINTER > getPainter(KIGFX::GAL *aGal)=0
Source VIEW object (note that actual printing only refers to this object)
virtual const COLOR4D & GetBackgroundColor()=0
Return current background color settings.
const KIGFX::VIEW * m_view
Printout parameters.
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
COLOR4D WithAlpha(double aAlpha) const
Return a color with the same color, but the given alpha.
Definition: color4d.h:321
LSET m_LayerSet
Layers to print.
Definition: color4d.h:44
VECTOR2< int > VECTOR2I
Definition: vector2d.h:622
BOARD_PRINTOUT_SETTINGS m_settings
double m_scale
Printing scale.
Definition: printout.h:58
COLOR_SETTINGS * m_colorSettings
The color settings to be used for printing.
Definition: printout.h:66
bool m_gerbviewPrint
True if the caller is Gerbview, false for Pcbnew.
virtual int milsToIU(double aMils) const =0
< Convert mils to internal units
virtual void setupPainter(KIGFX::PAINTER &aPainter)
Configures GAL object for a printout.
const wxPoint GetOrigin() const
Definition: eda_rect.h:110
coord_type GetWidth() const
Definition: box2.h:180
virtual void setupGal(KIGFX::GAL *aGal)
Returns bounding box of the printed objects (excluding drawing-sheet frame)
void SetLayerColor(int aLayer, const COLOR4D &aColor)
Change the color used to draw a layer.
bool PrintBorderAndTitleBlock() const
Returns true if the drawing border and title block should be printed.
Definition: printout.h:55
const wxSize & GetSizeMils() const
Definition: page_info.h:135
drawingsheet frame and titleblock
Definition: layer_ids.h:224
virtual void setupViewLayers(KIGFX::VIEW &aView, const LSET &aLayerSet)
Configures PAINTER object for a printout.
bool m_blackWhite
Print in B&W or Color.
Definition: printout.h:60
std::unique_ptr< VIEW > DataReference() const
Return a new VIEW object that shares the same set of VIEW_ITEMs and LAYERs.
Definition: view.cpp:1506
virtual void ClearScreen()
Clear the screen.
Vec Centre() const
Definition: box2.h:63
virtual bool HasNativeLandscapeRotation() const =0
void SetIsPrinting(bool isPrinting)
Handle the component boundary box.
Definition: eda_rect.h:42
void SetZoomFactor(double aZoomFactor)
Set the zoom factor of the scene.
coord_type GetHeight() const
Definition: box2.h:181
void SetLookAtPoint(const VECTOR2D &aPoint)
Set the Point in world space to look at.
virtual void LoadColors(const COLOR_SETTINGS *aSettings)
virtual EDA_RECT getBoundingBox()=0
Returns a PAINTER instance used to draw the items.
#define LAYER_ID_COUNT
Must update this if you add any enums after GerbView!
Definition: layer_ids.h:436
const wxSize GetSize() const
Definition: eda_rect.h:100
Abstract interface for drawing on a 2D-surface.

References BLACK, BOX2< Vec >::Centre(), KIGFX::GAL::ClearScreen(), KIGFX::VIEW::DataReference(), KIGFX::RENDER_SETTINGS::GetBackgroundColor(), BOARD_PRINTOUT::getBoundingBox(), BOX2< Vec >::GetHeight(), KIGFX::RENDER_SETTINGS::GetLayerColor(), EDA_RECT::GetOrigin(), BOARD_PRINTOUT::getPainter(), EDA_RECT::GetSize(), PAGE_INFO::GetSizeMils(), BOX2< Vec >::GetWidth(), KIGFX::PRINT_CONTEXT::HasNativeLandscapeRotation(), LAYER_DRAWINGSHEET, LAYER_ID_COUNT, KIGFX::RENDER_SETTINGS::LoadColors(), PRINTOUT_SETTINGS::m_blackWhite, PRINTOUT_SETTINGS::m_colorSettings, BOARD_PRINTOUT::m_gerbviewPrint, BOARD_PRINTOUT_SETTINGS::m_LayerSet, PRINTOUT_SETTINGS::m_pageInfo, PRINTOUT_SETTINGS::m_scale, BOARD_PRINTOUT::m_settings, BOARD_PRINTOUT::m_view, BOARD_PRINTOUT::milsToIU(), PRINTOUT_SETTINGS::PrintBorderAndTitleBlock(), KIGFX::GAL::SetClearColor(), KIGFX::RENDER_SETTINGS::SetIsPrinting(), KIGFX::RENDER_SETTINGS::SetLayerColor(), KIGFX::GAL::SetLookAtPoint(), BOARD_PRINTOUT::setupGal(), BOARD_PRINTOUT::setupPainter(), BOARD_PRINTOUT::setupViewLayers(), KIGFX::GAL::SetZoomFactor(), and KIGFX::COLOR4D::WithAlpha().

Referenced by GERBVIEW_PRINTOUT::OnPrintPage(), and OnPrintPage().

◆ getBoundingBox()

EDA_RECT PCBNEW_PRINTOUT::getBoundingBox ( )
overrideprotectedvirtual

Returns a PAINTER instance used to draw the items.

Implements BOARD_PRINTOUT.

Definition at line 276 of file pcbnew_printout.cpp.

277 {
278  return m_board->ComputeBoundingBox();
279 }
EDA_RECT ComputeBoundingBox(bool aBoardEdgesOnly=false) const
Calculate the bounding box containing all board items (or board edge segments).
Definition: board.cpp:1085

References BOARD::ComputeBoundingBox(), and m_board.

◆ GetPageInfo()

void BOARD_PRINTOUT::GetPageInfo ( int *  minPage,
int *  maxPage,
int *  selPageFrom,
int *  selPageTo 
)
overrideinherited

Definition at line 77 of file board_printout.cpp.

78 {
79  *minPage = 1;
80  *selPageFrom = 1;
81 
82  *maxPage = m_settings.m_pageCount;
83  *selPageTo = m_settings.m_pageCount;
84 }
BOARD_PRINTOUT_SETTINGS m_settings
int m_pageCount
Number of pages to print.
Definition: printout.h:61

References PRINTOUT_SETTINGS::m_pageCount, and BOARD_PRINTOUT::m_settings.

◆ getPainter()

std::unique_ptr< KIGFX::PAINTER > PCBNEW_PRINTOUT::getPainter ( KIGFX::GAL aGal)
overrideprotectedvirtual

Source VIEW object (note that actual printing only refers to this object)

Implements BOARD_PRINTOUT.

Definition at line 282 of file pcbnew_printout.cpp.

283 {
284  return std::make_unique<KIGFX::PCB_PRINT_PAINTER>( aGal );
285 }

◆ HasPage()

bool BOARD_PRINTOUT::HasPage ( int  aPage)
inlineoverrideinherited

Definition at line 80 of file board_printout.h.

81  {
82  return aPage <= m_settings.m_pageCount;
83  }
BOARD_PRINTOUT_SETTINGS m_settings
int m_pageCount
Number of pages to print.
Definition: printout.h:61

References PRINTOUT_SETTINGS::m_pageCount, and BOARD_PRINTOUT::m_settings.

◆ milsToIU()

int PCBNEW_PRINTOUT::milsToIU ( double  aMils) const
overrideprotectedvirtual

< Convert mils to internal units

Enables layers visibility for a printout

Implements BOARD_PRINTOUT.

Definition at line 127 of file pcbnew_printout.cpp.

128 {
129  return KiROUND( IU_PER_MILS * aMils );
130 }
#define IU_PER_MILS
Definition: plotter.cpp:130
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:73

References IU_PER_MILS, and KiROUND().

◆ OnPrintPage()

bool PCBNEW_PRINTOUT::OnPrintPage ( int  aPage)
override

Definition at line 83 of file pcbnew_printout.cpp.

84 {
85  // Store the layerset, as it is going to be modified below and the original settings are
86  // needed.
87  LSET lset = m_settings.m_LayerSet;
88  int pageCount = lset.count();
89  wxString layerName;
90  PCB_LAYER_ID extractLayer;
91 
92  // compute layer mask from page number if we want one page per layer
94  {
95  // This sequence is TBD, call a different sequencer if needed, such as Seq().
96  // Could not find documentation on page order.
97  LSEQ seq = lset.UIOrder();
98 
99  // aPage starts at 1, not 0
100  if( unsigned( aPage - 1 ) < seq.size() )
101  m_settings.m_LayerSet = LSET( seq[ aPage - 1] );
102  }
103 
104  if( !m_settings.m_LayerSet.any() )
105  return false;
106 
107  extractLayer = m_settings.m_LayerSet.ExtractLayer();
108 
109  if( extractLayer == UNDEFINED_LAYER )
110  layerName = _( "Multiple Layers" );
111  else
112  layerName = LSET::Name( extractLayer );
113 
114  // In Pcbnew we can want the layer EDGE always printed
117 
118  DrawPage( layerName, aPage, pageCount );
119 
120  // Restore the original layer set, so the next page can be printed
121  m_settings.m_LayerSet = lset;
122 
123  return true;
124 }
LSET m_LayerSet
Layers to print.
virtual void DrawPage(const wxString &aLayerName=wxEmptyString, int aPageNum=1, int aPageCount=1)
Print a page (or a set of pages).
BOARD_PRINTOUT_SETTINGS m_settings
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:516
static const wxChar * Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
Definition: lset.cpp:82
#define _(s)
bool m_PrintEdgeCutsOnAllPages
Print board outline on each page.
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
Definition: layer_ids.h:477
PCB_LAYER_ID ExtractLayer() const
Find the first set PCB_LAYER_ID.
Definition: lset.cpp:670
PCBNEW_PRINTOUT_SETTINGS m_pcbnewSettings
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:65
LSEQ UIOrder() const
Definition: lset.cpp:904
enum PCBNEW_PRINTOUT_SETTINGS::PAGINATION_T m_Pagination

References _, BOARD_PRINTOUT::DrawPage(), Edge_Cuts, LSET::ExtractLayer(), PCBNEW_PRINTOUT_SETTINGS::LAYER_PER_PAGE, BOARD_PRINTOUT_SETTINGS::m_LayerSet, PCBNEW_PRINTOUT_SETTINGS::m_Pagination, m_pcbnewSettings, PCBNEW_PRINTOUT_SETTINGS::m_PrintEdgeCutsOnAllPages, BOARD_PRINTOUT::m_settings, LSET::Name(), LSET::UIOrder(), and UNDEFINED_LAYER.

◆ setupGal()

void PCBNEW_PRINTOUT::setupGal ( KIGFX::GAL aGal)
overrideprotectedvirtual

Returns bounding box of the printed objects (excluding drawing-sheet frame)

Reimplemented from BOARD_PRINTOUT.

Definition at line 269 of file pcbnew_printout.cpp.

270 {
271  BOARD_PRINTOUT::setupGal( aGal );
272  aGal->SetWorldUnitLength( 0.001/IU_PER_MM /* 1 nm */ / 0.0254 /* 1 inch in meters */ );
273 }
static constexpr double IU_PER_MM
Mock up a conversion function.
virtual void setupGal(KIGFX::GAL *aGal)
Returns bounding box of the printed objects (excluding drawing-sheet frame)
void SetWorldUnitLength(double aWorldUnitLength)
Set the unit length.

References IU_PER_MM, BOARD_PRINTOUT::setupGal(), and KIGFX::GAL::SetWorldUnitLength().

◆ setupPainter()

void PCBNEW_PRINTOUT::setupPainter ( KIGFX::PAINTER aPainter)
overrideprotectedvirtual

Configures GAL object for a printout.

Reimplemented from BOARD_PRINTOUT.

Definition at line 235 of file pcbnew_printout.cpp.

236 {
237  BOARD_PRINTOUT::setupPainter( aPainter );
238 
239  KIGFX::PCB_PRINT_PAINTER& painter = dynamic_cast<KIGFX::PCB_PRINT_PAINTER&>( aPainter );
240 
242  {
244  painter.SetDrillMarks( false, 0 );
245  break;
246 
248  painter.SetDrillMarks( false, Millimeter2iu( ADVANCED_CFG::GetCfg().m_SmallDrillMarkSize ) );
249 
253  break;
254 
256  painter.SetDrillMarks( true );
257 
261  break;
262  }
263 
266 }
enum PCBNEW_PRINTOUT_SETTINGS::DRILL_MARK_SHAPE_T m_DrillMarks
Special flavor of PCB_PAINTER that contains modifications to handle printing options.
Definition: color4d.h:44
to draw via holes (pad holes do not use this layer)
Definition: layer_ids.h:222
handle color for not plated holes (holes, not pads)
Definition: layer_ids.h:204
virtual PCB_RENDER_SETTINGS * GetSettings() override
Return a pointer to current settings that are going to be used when drawing items.
Definition: pcb_painter.h:247
virtual void setupPainter(KIGFX::PAINTER &aPainter)
Configures GAL object for a printout.
void SetLayerColor(int aLayer, const COLOR4D &aColor)
Change the color used to draw a layer.
void SetDrawIndividualViaLayers(bool aFlag)
Definition: pcb_painter.h:175
PCBNEW_PRINTOUT_SETTINGS m_pcbnewSettings
to draw pad holes (plated)
Definition: layer_ids.h:221
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
static constexpr int Millimeter2iu(double mm)
void SetDrillMarks(bool aRealSize, unsigned int aSize=0)
Set drill marks visibility and options.
enum PCBNEW_PRINTOUT_SETTINGS::PAGINATION_T m_Pagination

References BLACK, PCBNEW_PRINTOUT_SETTINGS::FULL_DRILL_SHAPE, ADVANCED_CFG::GetCfg(), KIGFX::PCB_PAINTER::GetSettings(), LAYER_NON_PLATEDHOLES, LAYER_PAD_PLATEDHOLES, PCBNEW_PRINTOUT_SETTINGS::LAYER_PER_PAGE, LAYER_VIA_HOLES, PCBNEW_PRINTOUT_SETTINGS::m_DrillMarks, PCBNEW_PRINTOUT_SETTINGS::m_Pagination, m_pcbnewSettings, Millimeter2iu(), PCBNEW_PRINTOUT_SETTINGS::NO_DRILL_SHAPE, KIGFX::PCB_RENDER_SETTINGS::SetDrawIndividualViaLayers(), KIGFX::PCB_PRINT_PAINTER::SetDrillMarks(), KIGFX::RENDER_SETTINGS::SetLayerColor(), BOARD_PRINTOUT::setupPainter(), and PCBNEW_PRINTOUT_SETTINGS::SMALL_DRILL_SHAPE.

◆ setupViewLayers()

void PCBNEW_PRINTOUT::setupViewLayers ( KIGFX::VIEW aView,
const LSET aLayerSet 
)
overrideprotectedvirtual

Configures PAINTER object for a printout.

Reimplemented from BOARD_PRINTOUT.

Definition at line 133 of file pcbnew_printout.cpp.

134 {
135  BOARD_PRINTOUT::setupViewLayers( aView, aLayerSet );
136 
137  for( PCB_LAYER_ID layer : m_settings.m_LayerSet.Seq() )
138  {
139  aView.SetLayerVisible( PCBNEW_LAYER_ID_START + layer, true );
140 
141  // Enable the corresponding zone layer (copper layers and other layers)
142  aView.SetLayerVisible( LAYER_ZONE_START + layer, true );
143  }
144 
145  RENDER_SETTINGS* renderSettings = aView.GetPainter()->GetSettings();
146  // A color to do not print objects on some layers, when the layer must be enabled
147  // to print some other objects
148  COLOR4D invisible_color = COLOR4D::UNSPECIFIED;
149 
151  {
152  auto setVisibility =
153  [&]( GAL_LAYER_ID aLayer )
154  {
155  if( m_board->IsElementVisible( aLayer ) )
156  aView.SetLayerVisible( aLayer, true );
157  else
158  renderSettings->SetLayerColor( aLayer, invisible_color );
159  };
160 
161  setVisibility( LAYER_MOD_FR );
162  setVisibility( LAYER_MOD_BK );
163  setVisibility( LAYER_MOD_VALUES );
164  setVisibility( LAYER_MOD_REFERENCES );
165  setVisibility( LAYER_MOD_TEXT );
166  setVisibility( LAYER_MOD_TEXT_INVISIBLE );
167  setVisibility( LAYER_PADS );
168  setVisibility( LAYER_PAD_FR );
169  setVisibility( LAYER_PAD_BK );
170  setVisibility( LAYER_PADS_TH );
171 
172  setVisibility( LAYER_TRACKS );
173  setVisibility( LAYER_VIAS );
174  setVisibility( LAYER_VIA_MICROVIA );
175  setVisibility( LAYER_VIA_BBLIND );
176  setVisibility( LAYER_VIA_THROUGH );
177  setVisibility( LAYER_ZONES );
178 
179  setVisibility( LAYER_NO_CONNECTS );
180  setVisibility( LAYER_DRC_WARNING );
181  setVisibility( LAYER_DRC_ERROR );
182  setVisibility( LAYER_DRC_EXCLUSION );
183  setVisibility( LAYER_ANCHOR );
184  setVisibility( LAYER_DRAWINGSHEET );
185  setVisibility( LAYER_GRID );
186  }
187  else
188  {
189  // Draw layers that must be not visible on printing are set to an invisible layer
190  // LAYER_PAD_FR, LAYER_PAD_BK and LAYER_PADS_TH must be enabled to print pads on
191  // technical layers, but not the pad on copper layer(s) if they are not enabled
192 
193  if( !aLayerSet.test( F_Cu ) )
194  renderSettings->SetLayerColor( LAYER_PAD_FR, invisible_color );
195 
196  if( !aLayerSet.test( B_Cu ) )
197  renderSettings->SetLayerColor( LAYER_PAD_BK, invisible_color );
198 
199  // Enable items on copper layers, but do not draw holes
201  {
202  if( ( aLayerSet & LSET::AllCuMask() ).any() ) // Items visible on any copper layer
203  aView.SetLayerVisible( layer, true );
204  else
205  renderSettings->SetLayerColor( layer, invisible_color );
206  }
207 
208  // Keep certain items always enabled/disabled and just rely on the layer visibility
209  // Note LAYER_PAD_FR, LAYER_PAD_BK, LAYER_PADS_TH are enabled here because paths must
210  // be drawn on some other (technical) layers.
211  const int alwaysEnabled[] =
212  {
215  LAYER_VIAS,
217  };
218 
219  for( int layer : alwaysEnabled )
220  aView.SetLayerVisible( layer, true );
221  }
222 
224  {
225  // Enable hole layers to draw drill marks
227  {
228  aView.SetLayerVisible( layer, true );
229  aView.SetTopLayer( layer, true );
230  }
231  }
232 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:759
smd pads, front layer
Definition: layer_ids.h:209
to draw micro vias
Definition: layer_ids.h:201
layer for drc markers with SEVERITY_ERROR
Definition: layer_ids.h:223
virtual void SetTopLayer(int aLayer, bool aEnabled=true)
Set given layer to be displayed on the top or sets back the default order of layers.
Definition: view.cpp:826
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
Meta control for all pads opacity/visibility (color ignored)
Definition: layer_ids.h:237
show footprints values (when texts are visible)
Definition: layer_ids.h:217
enum PCBNEW_PRINTOUT_SETTINGS::DRILL_MARK_SHAPE_T m_DrillMarks
GAL_LAYER_ID
GAL layers are "virtual" layers, i.e.
Definition: layer_ids.h:196
smd pads, back layer
Definition: layer_ids.h:210
anchor of items having an anchor point (texts, footprints)
Definition: layer_ids.h:208
LSET m_LayerSet
Layers to print.
show footprints on back
Definition: layer_ids.h:216
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Return an LSEQ from the union of this LSET and a desired sequence.
Definition: lset.cpp:411
to draw via holes (pad holes do not use this layer)
Definition: layer_ids.h:222
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:208
Control for copper zone opacity/visibility (color ignored)
Definition: layer_ids.h:238
BOARD_PRINTOUT_SETTINGS m_settings
to draw usual through hole vias
Definition: layer_ids.h:203
bool m_AsItemCheckboxes
Honor checkboxes in the Items tab of the Layers Manager.
handle color for not plated holes (holes, not pads)
Definition: layer_ids.h:204
Meta control for all vias opacity/visibility.
Definition: layer_ids.h:200
text marked as invisible
Definition: layer_ids.h:207
show footprints on front
Definition: layer_ids.h:215
Virtual layers for stacking zones and tracks on a given copper layer.
Definition: layer_ids.h:253
void SetLayerColor(int aLayer, const COLOR4D &aColor)
Change the color used to draw a layer.
void SetLayerVisible(int aLayer, bool aVisible=true)
Control the visibility of a particular layer.
Definition: view.h:388
drawingsheet frame and titleblock
Definition: layer_ids.h:224
virtual void setupViewLayers(KIGFX::VIEW &aView, const LSET &aLayerSet)
Configures PAINTER object for a printout.
show a marker on pads with no nets
Definition: layer_ids.h:214
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Test whether a given element category is visible.
Definition: board.cpp:533
show footprints references (when texts are visible)
Definition: layer_ids.h:218
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
multilayer pads, usually with holes
Definition: layer_ids.h:220
to draw blind/buried vias
Definition: layer_ids.h:202
layer for drc markers which have been individually excluded
Definition: layer_ids.h:243
PCBNEW_PRINTOUT_SETTINGS m_pcbnewSettings
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:65
Definition: layer_ids.h:71
layer for drc markers with SEVERITY_WARNING
Definition: layer_ids.h:242
to draw pad holes (plated)
Definition: layer_ids.h:221
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103

References LSET::AllCuMask(), B_Cu, F_Cu, KIGFX::VIEW::GetPainter(), KIGFX::PAINTER::GetSettings(), BOARD::IsElementVisible(), LAYER_ANCHOR, LAYER_DRAWINGSHEET, LAYER_DRC_ERROR, LAYER_DRC_EXCLUSION, LAYER_DRC_WARNING, LAYER_GRID, LAYER_MOD_BK, LAYER_MOD_FR, LAYER_MOD_REFERENCES, LAYER_MOD_TEXT, LAYER_MOD_TEXT_INVISIBLE, LAYER_MOD_VALUES, LAYER_NO_CONNECTS, LAYER_NON_PLATEDHOLES, LAYER_PAD_BK, LAYER_PAD_FR, LAYER_PAD_PLATEDHOLES, LAYER_PADS, LAYER_PADS_TH, LAYER_TRACKS, LAYER_VIA_BBLIND, LAYER_VIA_HOLES, LAYER_VIA_MICROVIA, LAYER_VIA_THROUGH, LAYER_VIAS, LAYER_ZONE_START, LAYER_ZONES, PCBNEW_PRINTOUT_SETTINGS::m_AsItemCheckboxes, m_board, PCBNEW_PRINTOUT_SETTINGS::m_DrillMarks, BOARD_PRINTOUT_SETTINGS::m_LayerSet, m_pcbnewSettings, BOARD_PRINTOUT::m_settings, PCBNEW_PRINTOUT_SETTINGS::NO_DRILL_SHAPE, PCBNEW_LAYER_ID_START, LSET::Seq(), KIGFX::RENDER_SETTINGS::SetLayerColor(), KIGFX::VIEW::SetLayerVisible(), KIGFX::VIEW::SetTopLayer(), and BOARD_PRINTOUT::setupViewLayers().

Member Data Documentation

◆ m_board

BOARD* PCBNEW_PRINTOUT::m_board
private

Definition at line 74 of file pcbnew_printout.h.

Referenced by getBoundingBox(), PCBNEW_PRINTOUT(), and setupViewLayers().

◆ m_gerbviewPrint

bool BOARD_PRINTOUT::m_gerbviewPrint
protectedinherited

True if the caller is Gerbview, false for Pcbnew.

Definition at line 124 of file board_printout.h.

Referenced by BOARD_PRINTOUT::BOARD_PRINTOUT(), BOARD_PRINTOUT::DrawPage(), and GERBVIEW_PRINTOUT::GERBVIEW_PRINTOUT().

◆ m_pcbnewSettings

PCBNEW_PRINTOUT_SETTINGS PCBNEW_PRINTOUT::m_pcbnewSettings
private

Definition at line 76 of file pcbnew_printout.h.

Referenced by OnPrintPage(), setupPainter(), and setupViewLayers().

◆ m_settings

◆ m_view

const KIGFX::VIEW* BOARD_PRINTOUT::m_view
protectedinherited

Printout parameters.

Definition at line 118 of file board_printout.h.

Referenced by BOARD_PRINTOUT::BOARD_PRINTOUT(), and BOARD_PRINTOUT::DrawPage().


The documentation for this class was generated from the following files: