KiCad PCB EDA Suite
plot_brditems_plotter.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, you may find one here:
18  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19  * or you may search the http://www.gnu.org website for the version 2 license,
20  * or you may write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22  */
23 
24 #include <algorithm> // for min
25 #include <bitset> // for bitset, operator&, __bi...
26 #include <math.h> // for abs
27 #include <stddef.h> // for NULL, size_t
28 #include <vector> // for vector, __vector_base<>...
29 
30 #include <eda_item.h>
32 #include <geometry/seg.h> // for SEG
33 #include <geometry/shape_circle.h>
34 #include <geometry/shape_line_chain.h> // for SHAPE_LINE_CHAIN
35 #include <geometry/shape_poly_set.h> // for SHAPE_POLY_SET, SHAPE_P...
36 #include <geometry/shape_segment.h>
37 #include <kicad_string.h>
38 #include <math/util.h> // for KiROUND, Clamp
39 #include <math/vector2d.h> // for VECTOR2I
40 #include <plotter.h>
41 #include <trigo.h>
42 
43 #include <board_design_settings.h> // for BOARD_DESIGN_SETTINGS
44 #include <core/typeinfo.h> // for dyn_cast, PCB_DIMENSION_T
45 #include <outline_mode.h>
46 #include <gal/color4d.h> // for COLOR4D, operator!=
47 #include <gbr_metadata.h>
48 #include <gbr_netlist_metadata.h> // for GBR_NETLIST_METADATA
49 #include <layers_id_colors_and_visibility.h> // for LSET, IsCopperLayer
50 #include <pad_shapes.h> // for PAD_ATTRIB_NPTH
51 #include <pcbplot.h>
52 #include <pcb_plot_params.h> // for PCB_PLOT_PARAMS, PCB_PL...
53 
54 #include <board.h>
55 #include <board_item.h> // for BOARD_ITEM, S_CIRCLE
56 #include <dimension.h>
57 #include <pcb_shape.h>
58 #include <fp_shape.h>
59 #include <footprint.h>
60 #include <fp_text.h>
61 #include <track.h>
62 #include <pad.h>
63 #include <pcb_target.h>
64 #include <pcb_text.h>
65 #include <zone.h>
66 
67 #include <wx/debug.h> // for wxASSERT_MSG
68 #include <wx/wx.h> // for wxPoint, wxSize, wxArra...
69 
70 
71 /* class BRDITEMS_PLOTTER is a helper class to plot board items
72  * and a group of board items
73  */
74 
76 {
77  COLOR4D color = ColorSettings()->GetColor( aLayer );
78 
79  // A hack to avoid plotting a white item in white color, expecting the paper
80  // is also white: use a non white color:
81  if( color == COLOR4D::WHITE )
82  color = COLOR4D( LIGHTGRAY );
83 
84  return color;
85 }
86 
87 
88 void BRDITEMS_PLOTTER::PlotPad( PAD* aPad, COLOR4D aColor, OUTLINE_MODE aPlotMode )
89 {
90  wxPoint shape_pos = aPad->ShapePos();
91  GBR_METADATA gbr_metadata;
92 
93  bool plotOnCopperLayer = ( m_layerMask & LSET::AllCuMask() ).any();
94  bool plotOnExternalCopperLayer = ( m_layerMask & LSET::ExternalCuMask() ).any();
95 
96  // Pad not on the solder mask layer cannot be soldered.
97  // therefore it can have a specific aperture attribute.
98  // Not yet in use.
99  // bool isPadOnBoardTechLayers = ( aPad->GetLayerSet() & LSET::AllBoardTechMask() ).any();
100 
101  gbr_metadata.SetCmpReference( aPad->GetParent()->GetReference() );
102 
103  if( plotOnCopperLayer )
104  {
105  gbr_metadata.SetNetAttribType( GBR_NETINFO_ALL );
106  gbr_metadata.SetCopper( true );
107  // Gives a default attribute, for instance for pads used as tracks in net ties:
108  // Connector pads and SMD pads are on external layers
109  // if on internal layers, they are certainly used as net tie
110  // and are similar to tracks: just conductor items
112 
113  const bool useUTF8 = false;
114  const bool useQuoting = false;
115  gbr_metadata.SetPadName( aPad->GetName(), useUTF8, useQuoting );
116 
117  if( !aPad->GetName().IsEmpty() )
118  gbr_metadata.SetPadPinFunction( aPad->GetPinFunction(), useUTF8, useQuoting );
119 
120  gbr_metadata.SetNetName( aPad->GetNetname() );
121 
122  // Some pads are mechanical pads ( through hole or smd )
123  // when this is the case, they have no pad name and/or are not plated.
124  // In this case gerber files have slightly different attributes.
125  if( aPad->GetAttribute() == PAD_ATTRIB_NPTH || aPad->GetName().IsEmpty() )
126  gbr_metadata.m_NetlistMetadata.m_NotInNet = true;
127 
128  if( !plotOnExternalCopperLayer )
129  {
130  // the .P object attribute (GBR_NETLIST_METADATA::GBR_NETINFO_PAD)
131  // is used on outer layers, unless the component is embedded
132  // or a "etched" component (fp only drawn, not a physical component)
133  // Currently, Pcbnew does not handle embedded component, so we disable the .P
134  // attribute on internal layers
135  // Note the Gerber doc is not really clear about through holes pads about the .P
138 
139  }
140 
141  // Some attributes are reserved to the external copper layers:
142  // GBR_APERTURE_ATTRIB_CONNECTORPAD and GBR_APERTURE_ATTRIB_SMDPAD_CUDEF
143  // for instance.
144  // Pad with type PAD_ATTRIB_CONN or PAD_ATTRIB_SMD that is not on outer layer
145  // has its aperture attribute set to GBR_APERTURE_ATTRIB_CONDUCTOR
146  switch( aPad->GetAttribute() )
147  {
148  case PAD_ATTRIB_NPTH: // Mechanical pad through hole
150  break;
151 
152  case PAD_ATTRIB_PTH : // Pad through hole, a hole is also expected
154  break;
155 
156  case PAD_ATTRIB_CONN: // Connector pads, no solder paste but with solder mask.
157  if( plotOnExternalCopperLayer )
159  break;
160 
161  case PAD_ATTRIB_SMD: // SMD pads (on external copper layer only)
162  // with solder paste and mask
163  if( plotOnExternalCopperLayer )
165  break;
166  }
167 
168  // Fabrication properties can have specific GBR_APERTURE_METADATA options
169  // that replace previous aperture attribute:
170  switch( aPad->GetProperty() )
171  {
172  case PAD_PROP_BGA: // Only applicable to outer layers
173  if( plotOnExternalCopperLayer )
175  break;
176 
179  break;
180 
183  break;
184 
185  case PAD_PROP_TESTPOINT: // Only applicable to outer layers
186  if( plotOnExternalCopperLayer )
188  break;
189 
190  case PAD_PROP_HEATSINK:
192  break;
193 
196  break;
197 
198  case PAD_PROP_NONE:
199  break;
200  }
201 
202  // Ensure NPTH pads have *always* the GBR_APERTURE_ATTRIB_WASHERPAD attribute
203  if( aPad->GetAttribute() == PAD_ATTRIB_NPTH )
205  }
206  else
207  {
209  }
210 
211  // Set plot color (change WHITE to LIGHTGRAY because
212  // the white items are not seen on a white paper or screen
213  m_plotter->SetColor( aColor != WHITE ? aColor : LIGHTGRAY);
214 
215  if( aPlotMode == SKETCH )
217 
218  switch( aPad->GetShape() )
219  {
220  case PAD_SHAPE_CIRCLE:
221  m_plotter->FlashPadCircle( shape_pos, aPad->GetSize().x, aPlotMode, &gbr_metadata );
222  break;
223 
224  case PAD_SHAPE_OVAL:
225  m_plotter->FlashPadOval( shape_pos, aPad->GetSize(),
226  aPad->GetOrientation(), aPlotMode, &gbr_metadata );
227  break;
228 
229  case PAD_SHAPE_RECT:
230  m_plotter->FlashPadRect( shape_pos, aPad->GetSize(), aPad->GetOrientation(), aPlotMode,
231  &gbr_metadata );
232  break;
233 
234  case PAD_SHAPE_ROUNDRECT:
235  m_plotter->FlashPadRoundRect( shape_pos, aPad->GetSize(), aPad->GetRoundRectCornerRadius(),
236  aPad->GetOrientation(), aPlotMode, &gbr_metadata );
237  break;
238 
239  case PAD_SHAPE_TRAPEZOID:
240  {
241  // Build the pad polygon in coordinates relative to the pad
242  // (i.e. for a pad at pos 0,0, rot 0.0). Needed to use aperture macros,
243  // to be able to create a pattern common to all trapezoid pads having the same shape
244  wxPoint coord[4];
245  // Order is lower left, lower right, upper right, upper left
246  wxSize half_size = aPad->GetSize()/2;
247  wxSize trap_delta = aPad->GetDelta()/2;
248 
249  coord[0] = wxPoint( -half_size.x - trap_delta.y, half_size.y + trap_delta.x );
250  coord[1] = wxPoint( half_size.x + trap_delta.y, half_size.y - trap_delta.x );
251  coord[2] = wxPoint( half_size.x - trap_delta.y, -half_size.y + trap_delta.x );
252  coord[3] = wxPoint( -half_size.x + trap_delta.y, -half_size.y - trap_delta.x );
253 
254  m_plotter->FlashPadTrapez( shape_pos, coord, aPad->GetOrientation(), aPlotMode,
255  &gbr_metadata );
256  }
257  break;
258 
261  {
262  static_cast<GERBER_PLOTTER*>( m_plotter )->FlashPadChamferRoundRect(
263  shape_pos, aPad->GetSize(),
264  aPad->GetRoundRectCornerRadius(),
265  aPad->GetChamferRectRatio(),
266  aPad->GetChamferPositions(),
267  aPad->GetOrientation(), aPlotMode, &gbr_metadata );
268  break;
269  }
271 
272  default:
273  case PAD_SHAPE_CUSTOM:
274  {
275  const std::shared_ptr<SHAPE_POLY_SET>& polygons = aPad->GetEffectivePolygon();
276 
277  if( polygons->OutlineCount() )
278  {
279  m_plotter->FlashPadCustom( shape_pos, aPad->GetSize(), polygons.get(), aPlotMode,
280  &gbr_metadata );
281  }
282  }
283  break;
284  }
285 }
286 
287 
289 {
290  FP_TEXT* textItem = &aFootprint->Reference();
291  LAYER_NUM textLayer = textItem->GetLayer();
292 
293  // Reference and value are specfic items, not in graphic items list
294  if( GetPlotReference() && m_layerMask[textLayer]
295  && ( textItem->IsVisible() || GetPlotInvisibleText() ) )
296  {
297  PlotFootprintTextItem( textItem, getColor( textLayer ) );
298  }
299 
300  textItem = &aFootprint->Value();
301  textLayer = textItem->GetLayer();
302 
303  if( GetPlotValue() && m_layerMask[textLayer]
304  && ( textItem->IsVisible() || GetPlotInvisibleText() ) )
305  {
306  PlotFootprintTextItem( textItem, getColor( textLayer ) );
307  }
308 
309  for( BOARD_ITEM* item : aFootprint->GraphicalItems() )
310  {
311  textItem = dyn_cast<FP_TEXT*>( item );
312 
313  if( !textItem )
314  continue;
315 
316  if( !textItem->IsVisible() )
317  continue;
318 
319  textLayer = textItem->GetLayer();
320 
321  if( textLayer == Edge_Cuts || textLayer >= PCB_LAYER_ID_COUNT )
322  continue;
323 
324  if( !m_layerMask[textLayer] )
325  continue;
326 
327  if( textItem->GetText() == wxT( "${REFERENCE}" ) && !GetPlotReference() )
328  continue;
329 
330  if( textItem->GetText() == wxT( "${VALUE}" ) && !GetPlotValue() )
331  continue;
332 
333  PlotFootprintTextItem( textItem, getColor( textLayer ) );
334  }
335 }
336 
337 
338 // plot items like text and graphics, but not tracks and footprints
340 {
341  for( BOARD_ITEM* item : m_board->Drawings() )
342  {
343  switch( item->Type() )
344  {
345  case PCB_SHAPE_T:
346  PlotPcbShape( (PCB_SHAPE*) item );
347  break;
348 
349  case PCB_TEXT_T:
350  if( item->GetLayer() != Edge_Cuts )
351  PlotPcbText( (PCB_TEXT*) item );
352 
353  break;
354 
355  case PCB_DIM_ALIGNED_T:
356  case PCB_DIM_CENTER_T:
358  case PCB_DIM_LEADER_T:
359  if( item->GetLayer() != Edge_Cuts )
360  PlotDimension( (DIMENSION_BASE*) item );
361 
362  break;
363 
364  case PCB_TARGET_T:
365  PlotPcbTarget( (PCB_TARGET*) item );
366  break;
367 
368  default:
369  break;
370  }
371  }
372 }
373 
375 {
376  if( aColor == COLOR4D::WHITE )
377  aColor = COLOR4D( LIGHTGRAY );
378 
379  m_plotter->SetColor( aColor );
380 
381  // calculate some text parameters :
382  wxSize size = aTextMod->GetTextSize();
383  wxPoint pos = aTextMod->GetTextPos();
384  double orient = aTextMod->GetDrawRotation();
385  int thickness = aTextMod->GetEffectiveTextPenWidth();
386 
387  if( aTextMod->IsMirrored() )
388  size.x = -size.x; // Text is mirrored
389 
390  // Non bold texts thickness is clamped at 1/6 char size by the low level draw function.
391  // but in Pcbnew we do not manage bold texts and thickness up to 1/4 char size
392  // (like bold text) and we manage the thickness.
393  // So we set bold flag to true
394  bool allow_bold = true;
395 
396  GBR_METADATA gbr_metadata;
398  FOOTPRINT* parent = static_cast<FOOTPRINT*> ( aTextMod->GetParent() );
399  gbr_metadata.SetCmpReference( parent->GetReference() );
400 
401  m_plotter->SetCurrentLineWidth( thickness );
402 
403  m_plotter->Text( pos, aColor, aTextMod->GetShownText(), orient, size,
404  aTextMod->GetHorizJustify(), aTextMod->GetVertJustify(), thickness,
405  aTextMod->IsItalic(), allow_bold, false, &gbr_metadata );
406 }
407 
408 
410 {
411  if( !m_layerMask[aDim->GetLayer()] )
412  return;
413 
414  PCB_SHAPE draw;
415 
416  draw.SetWidth( aDim->GetLineThickness() );
417  draw.SetLayer( aDim->GetLayer() );
418 
419  COLOR4D color = ColorSettings()->GetColor( aDim->GetLayer() );
420 
421  // Set plot color (change WHITE to LIGHTGRAY because
422  // the white items are not seen on a white paper or screen
424 
425  PlotPcbText( &aDim->Text() );
426 
427  for( const std::shared_ptr<SHAPE>& shape : aDim->GetShapes() )
428  {
429  switch( shape->Type() )
430  {
431  case SH_SEGMENT:
432  {
433  const SEG& seg = static_cast<const SHAPE_SEGMENT*>( shape.get() )->GetSeg();
434 
435  draw.SetShape( S_SEGMENT );
436  draw.SetStart( wxPoint( seg.A ) );
437  draw.SetEnd( wxPoint( seg.B ) );
438 
439  PlotPcbShape( &draw );
440  break;
441  }
442 
443  case SH_CIRCLE:
444  {
445  wxPoint start( shape->Centre() );
446  int radius = static_cast<const SHAPE_CIRCLE*>( shape.get() )->GetRadius();
447 
448  draw.SetShape( S_CIRCLE );
449  draw.SetFilled( false );
450  draw.SetStart( start );
451  draw.SetEnd( wxPoint( start.x + radius, start.y ) );
452 
453  PlotPcbShape( &draw );
454  break;
455  }
456 
457  default:
458  break;
459  }
460  }
461 }
462 
463 
465 {
466  int dx1, dx2, dy1, dy2, radius;
467 
468  if( !m_layerMask[aMire->GetLayer()] )
469  return;
470 
471  m_plotter->SetColor( getColor( aMire->GetLayer() ) );
472 
473  PCB_SHAPE draw;
474 
475  draw.SetShape( S_CIRCLE );
476  draw.SetFilled( false );
477  draw.SetWidth( aMire->GetWidth() );
478  draw.SetLayer( aMire->GetLayer() );
479  draw.SetStart( aMire->GetPosition() );
480  radius = aMire->GetSize() / 3;
481 
482  if( aMire->GetShape() ) // shape X
483  radius = aMire->GetSize() / 2;
484 
485  // Draw the circle
486  draw.SetEnd( wxPoint( draw.GetStart().x + radius, draw.GetStart().y ) );
487 
488  PlotPcbShape( &draw );
489 
490  draw.SetShape( S_SEGMENT );
491 
492  radius = aMire->GetSize() / 2;
493  dx1 = radius;
494  dy1 = 0;
495  dx2 = 0;
496  dy2 = radius;
497 
498  if( aMire->GetShape() ) // Shape X
499  {
500  dx1 = dy1 = radius;
501  dx2 = dx1;
502  dy2 = -dy1;
503  }
504 
505  wxPoint mirePos( aMire->GetPosition() );
506 
507  // Draw the X or + shape:
508  draw.SetStart( wxPoint( mirePos.x - dx1, mirePos.y - dy1 ) );
509  draw.SetEnd( wxPoint( mirePos.x + dx1, mirePos.y + dy1 ) );
510  PlotPcbShape( &draw );
511 
512  draw.SetStart( wxPoint( mirePos.x - dx2, mirePos.y - dy2 ) );
513  draw.SetEnd( wxPoint( mirePos.x + dx2, mirePos.y + dy2 ) );
514  PlotPcbShape( &draw );
515 }
516 
517 
518 // Plot footprints graphic items (outlines)
520 {
521  for( BOARD_ITEM* item : aFootprint->GraphicalItems() )
522  {
523  FP_SHAPE* edge = dynamic_cast<FP_SHAPE*>( item );
524 
525  if( edge && m_layerMask[ edge->GetLayer() ] )
526  PlotFootprintGraphicItem( edge );
527  }
528 }
529 
530 
531 //* Plot a graphic item (outline) relative to a footprint
533 {
534  if( aShape->Type() != PCB_FP_SHAPE_T )
535  return;
536 
537  m_plotter->SetColor( getColor( aShape->GetLayer() ) );
538 
539  bool sketch = GetPlotMode() == SKETCH;
540  int thickness = aShape->GetWidth();
541  wxPoint pos( aShape->GetStart() );
542  wxPoint end( aShape->GetEnd() );
543 
544  GBR_METADATA gbr_metadata;
546  FOOTPRINT* parent = static_cast<FOOTPRINT*> ( aShape->GetParent() );
547  gbr_metadata.SetCmpReference( parent->GetReference() );
548 
549  bool isOnCopperLayer = ( m_layerMask & LSET::AllCuMask() ).any();
550 
551  if( isOnCopperLayer )
552  {
553  gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_ETCHEDCMP );
554  gbr_metadata.SetCopper( true );
555  }
556  else if( aShape->GetLayer() == Edge_Cuts ) // happens also when plotting copper layers
557  {
558  gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_EDGECUT );
559  }
560 
561  int radius; // Circle/arc radius.
562 
563  switch( aShape->GetShape() )
564  {
565  case S_SEGMENT:
566  m_plotter->ThickSegment( pos, end, thickness, GetPlotMode(), &gbr_metadata );
567  break;
568 
569  case S_RECT:
570  {
571  std::vector<wxPoint> pts = aShape->GetRectCorners();
572 
573  if( sketch || thickness > 0 )
574  {
575  m_plotter->ThickSegment( pts[0], pts[1], thickness, GetPlotMode(), &gbr_metadata );
576  m_plotter->ThickSegment( pts[1], pts[2], thickness, GetPlotMode(), &gbr_metadata );
577  m_plotter->ThickSegment( pts[2], pts[3], thickness, GetPlotMode(), &gbr_metadata );
578  m_plotter->ThickSegment( pts[3], pts[0], thickness, GetPlotMode(), &gbr_metadata );
579  }
580 
581  if( !sketch && aShape->IsFilled() )
582  {
583  SHAPE_LINE_CHAIN poly;
584 
585  for( const wxPoint& pt : pts )
586  poly.Append( pt );
587 
588  m_plotter->PlotPoly( poly, FILL_TYPE::FILLED_SHAPE, -1, &gbr_metadata );
589  }
590  }
591  break;
592 
593  case S_CIRCLE:
594  radius = KiROUND( GetLineLength( end, pos ) );
595 
596  if( aShape->IsFilled() )
597  m_plotter->FilledCircle( pos, radius * 2 + thickness, GetPlotMode(), &gbr_metadata );
598  else
599  m_plotter->ThickCircle( pos, radius * 2, thickness, GetPlotMode(), &gbr_metadata );
600 
601  break;
602 
603  case S_ARC:
604  {
605  radius = KiROUND( GetLineLength( end, pos ) );
606  double startAngle = ArcTangente( end.y - pos.y, end.x - pos.x );
607  double endAngle = startAngle + aShape->GetAngle();
608 
609  // when startAngle == endAngle ThickArc() doesn't know whether it's 0 deg and 360 deg
610  if( std::abs( aShape->GetAngle() ) == 3600.0 )
611  {
612  m_plotter->ThickCircle( pos, radius * 2, thickness, GetPlotMode(), &gbr_metadata );
613  }
614  else
615  {
616  m_plotter->ThickArc( pos, -endAngle, -startAngle, radius, thickness, GetPlotMode(),
617  &gbr_metadata );
618  }
619  }
620  break;
621 
622  case S_POLYGON:
623  if( aShape->IsPolyShapeValid() )
624  {
625  const std::vector<wxPoint> &polyPoints = aShape->BuildPolyPointsList();
626 
627  // We must compute board coordinates from m_PolyList which are relative to the parent
628  // position at orientation 0
629  FOOTPRINT *parentFootprint = aShape->GetParentFootprint();
630 
631  std::vector<wxPoint> cornerList;
632 
633  cornerList.reserve( polyPoints.size() );
634 
635  for( wxPoint corner : polyPoints )
636  {
637  if( parentFootprint )
638  {
639  RotatePoint( &corner, parentFootprint->GetOrientation() );
640  corner += parentFootprint->GetPosition();
641  }
642 
643  cornerList.push_back( corner );
644  }
645 
646  if( sketch || thickness > 0 )
647  {
648  for( size_t i = 1; i < cornerList.size(); i++ )
649  {
650  m_plotter->ThickSegment( cornerList[i - 1], cornerList[i], thickness,
651  GetPlotMode(), &gbr_metadata );
652  }
653 
654  m_plotter->ThickSegment( cornerList.back(), cornerList.front(), thickness,
655  GetPlotMode(), &gbr_metadata );
656 
657  }
658 
659  if( !sketch && aShape->IsFilled() )
660  {
661  // This must be simplified and fractured to prevent overlapping polygons
662  // from generating invalid Gerber files
663 
664  SHAPE_LINE_CHAIN line( cornerList );
665  SHAPE_POLY_SET tmpPoly;
666 
667  line.SetClosed( true );
668  tmpPoly.AddOutline( line );
670 
671  for( int jj = 0; jj < tmpPoly.OutlineCount(); ++jj )
672  {
673  SHAPE_LINE_CHAIN &poly = tmpPoly.Outline( jj );
674  m_plotter->PlotPoly( poly, FILL_TYPE::FILLED_SHAPE, thickness, &gbr_metadata );
675  }
676  }
677  }
678  break;
679 
680  case S_CURVE:
681  m_plotter->BezierCurve( aShape->GetStart(), aShape->GetBezControl1(),
682  aShape->GetBezControl2(), aShape->GetEnd(), 0, thickness );
683  break;
684 
685  default:
686  wxASSERT_MSG( false, "Unhandled FP_SHAPE shape" );
687  break;
688  }
689 }
690 
691 
692 // Plot a PCB Text, i.e. a text found on a copper or technical layer
694 {
695  wxString shownText( aText->GetShownText() );
696 
697  if( shownText.IsEmpty() )
698  return;
699 
700  if( !m_layerMask[aText->GetLayer()] )
701  return;
702 
703  GBR_METADATA gbr_metadata;
704 
705  if( IsCopperLayer( aText->GetLayer() ) )
707 
708  COLOR4D color = getColor( aText->GetLayer() );
710 
711  wxSize size = aText->GetTextSize();
712  wxPoint pos = aText->GetTextPos();
713  double orient = aText->GetTextAngle();
714  int thickness = aText->GetEffectiveTextPenWidth();
715 
716  if( aText->IsMirrored() )
717  size.x = -size.x;
718 
719  // Non bold texts thickness is clamped at 1/6 char size by the low level draw function.
720  // but in Pcbnew we do not manage bold texts and thickness up to 1/4 char size
721  // (like bold text) and we manage the thickness.
722  // So we set bold flag to true
723  bool allow_bold = true;
724 
725  m_plotter->SetCurrentLineWidth( thickness );
726 
727  if( aText->IsMultilineAllowed() )
728  {
729  std::vector<wxPoint> positions;
730  wxArrayString strings_list;
731  wxStringSplit( shownText, strings_list, '\n' );
732  positions.reserve( strings_list.Count() );
733 
734  aText->GetLinePositions( positions, strings_list.Count() );
735 
736  for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
737  {
738  wxString& txt = strings_list.Item( ii );
739  m_plotter->Text( positions[ii], color, txt, orient, size, aText->GetHorizJustify(),
740  aText->GetVertJustify(), thickness, aText->IsItalic(),
741  allow_bold, false, &gbr_metadata );
742  }
743  }
744  else
745  {
746  m_plotter->Text( pos, color, shownText, orient, size, aText->GetHorizJustify(),
747  aText->GetVertJustify(), thickness, aText->IsItalic(), allow_bold,
748  false, &gbr_metadata );
749  }
750 }
751 
752 
754 {
755  if( polysList.IsEmpty() )
756  return;
757 
758  GBR_METADATA gbr_metadata;
759 
760  bool isOnCopperLayer = aZone->IsOnCopperLayer();
761 
762  if( isOnCopperLayer )
763  {
764  gbr_metadata.SetNetName( aZone->GetNetname() );
765  gbr_metadata.SetCopper( true );
766 
767  // Zones with no net name can exist.
768  // they are not used to connect items, so the aperture attribute cannot
769  // be set as conductor
770  if( aZone->GetNetname().IsEmpty() )
772  else
773  {
776  }
777  }
778 
779  // We need a buffer to store corners coordinates:
780  std::vector< wxPoint > cornerList;
781 
782  m_plotter->SetColor( getColor( aZone->GetLayer() ) );
783 
784  m_plotter->StartBlock( nullptr ); // Clean current object attributes
785 
786  /* Plot all filled areas: filled areas have a filled area and a thick
787  * outline (depending on the fill area option we must plot the filled area itself
788  * and plot the thick outline itself, if the thickness has meaning (at least is > 1)
789  *
790  * in non filled mode the outline is plotted, but not the filling items
791  */
792  int outline_thickness = aZone->GetFilledPolysUseThickness() ? aZone->GetMinThickness() : 0;
793 
794  for( int idx = 0; idx < polysList.OutlineCount(); ++idx )
795  {
796  SHAPE_LINE_CHAIN& outline = polysList.Outline( idx );
797 
798  cornerList.clear();
799  cornerList.reserve( outline.PointCount() );
800 
801  for( int ic = 0; ic < outline.PointCount(); ++ic )
802  {
803  cornerList.emplace_back( wxPoint( outline.CPoint( ic ) ) );
804  }
805 
806  if( cornerList.size() ) // Plot the current filled area outline
807  {
808  // First, close the outline
809  if( cornerList[0] != cornerList[cornerList.size() - 1] )
810  cornerList.push_back( cornerList[0] );
811 
812  // Plot the current filled area (as region for Gerber plotter
813  // to manage attributes) and its outline for thick outline
814  if( GetPlotMode() == FILLED )
815  {
817  {
818  if( outline_thickness > 0 )
819  m_plotter->PlotPoly( cornerList, FILL_TYPE::NO_FILL,
820  outline_thickness, &gbr_metadata );
821 
822  static_cast<GERBER_PLOTTER*>( m_plotter )->PlotGerberRegion(
823  cornerList, &gbr_metadata );
824  }
825  else
827  outline_thickness, &gbr_metadata );
828  }
829  else
830  {
831  if( outline_thickness )
832  {
833  for( unsigned jj = 1; jj < cornerList.size(); jj++ )
834  {
835  m_plotter->ThickSegment( cornerList[jj -1], cornerList[jj],
836  outline_thickness,
837  GetPlotMode(), &gbr_metadata );
838  }
839  }
840 
842  }
843  }
844  }
845 
846  m_plotter->EndBlock( nullptr ); // Clear object attributes
847 }
848 
849 
850 /* Plot items type PCB_SHAPE on layers allowed by aLayerMask
851  */
853 {
854  if( !m_layerMask[aShape->GetLayer()] )
855  return;
856 
857  int radius = 0;
858  double StAngle = 0, EndAngle = 0;
859  bool sketch = GetPlotMode() == SKETCH;
860  int thickness = aShape->GetWidth();
861 
862  m_plotter->SetColor( getColor( aShape->GetLayer() ) );
863 
864  wxPoint start( aShape->GetStart() );
865  wxPoint end( aShape->GetEnd() );
866 
867  GBR_METADATA gbr_metadata;
868 
869  if( aShape->GetLayer() == Edge_Cuts )
871 
872  if( IsCopperLayer( aShape->GetLayer() ) )
873  // Graphic items (PCB_SHAPE, TEXT) having no net have the NonConductor attribute
874  // Graphic items having a net have the Conductor attribute, but are not (yet?)
875  // supported in Pcbnew
876  gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_NONCONDUCTOR );
877 
878  switch( aShape->GetShape() )
879  {
880  case S_SEGMENT:
881  m_plotter->ThickSegment( start, end, thickness, GetPlotMode(), &gbr_metadata );
882  break;
883 
884  case S_CIRCLE:
885  radius = KiROUND( GetLineLength( end, start ) );
886 
887  if( aShape->IsFilled() )
888  m_plotter->FilledCircle( start, radius * 2 + thickness, GetPlotMode(), &gbr_metadata );
889  else
890  m_plotter->ThickCircle( start, radius * 2, thickness, GetPlotMode(), &gbr_metadata );
891 
892  break;
893 
894  case S_ARC:
895  radius = KiROUND( GetLineLength( end, start ) );
896  StAngle = ArcTangente( end.y - start.y, end.x - start.x );
897  EndAngle = StAngle + aShape->GetAngle();
898 
899  // when startAngle == endAngle ThickArc() doesn't know whether it's 0 deg and 360 deg
900  if( std::abs( aShape->GetAngle() ) == 3600.0 )
901  {
902  m_plotter->ThickCircle( start, radius * 2, thickness, GetPlotMode(), &gbr_metadata );
903  }
904  else
905  {
906  m_plotter->ThickArc( start, -EndAngle, -StAngle, radius, thickness, GetPlotMode(),
907  &gbr_metadata );
908  }
909  break;
910 
911  case S_CURVE:
912  m_plotter->BezierCurve( aShape->GetStart(), aShape->GetBezControl1(),
913  aShape->GetBezControl2(), aShape->GetEnd(), 0, thickness );
914  break;
915 
916  case S_POLYGON:
917  if( aShape->IsPolyShapeValid() )
918  {
919  if( sketch || thickness > 0 )
920  {
921  for( auto it = aShape->GetPolyShape().CIterateSegments( 0 ); it; it++ )
922  {
923  auto seg = it.Get();
924  m_plotter->ThickSegment( wxPoint( seg.A ), wxPoint( seg.B ),
925  thickness, GetPlotMode(), &gbr_metadata );
926  }
927  }
928 
929  if( !sketch && aShape->IsFilled() )
930  {
931  m_plotter->SetCurrentLineWidth( thickness, &gbr_metadata );
932  // Draw the polygon: only one polygon is expected
933  // However we provide a multi polygon shape drawing
934  // ( for the future or to show a non expected shape )
935  // This must be simplified and fractured to prevent overlapping polygons
936  // from generating invalid Gerber files
937  auto tmpPoly = SHAPE_POLY_SET( aShape->GetPolyShape() );
939 
940  for( int jj = 0; jj < tmpPoly.OutlineCount(); ++jj )
941  {
942  SHAPE_LINE_CHAIN& poly = tmpPoly.Outline( jj );
943  m_plotter->PlotPoly( poly, FILL_TYPE::FILLED_SHAPE, thickness, &gbr_metadata );
944  }
945  }
946  }
947  break;
948 
949  case S_RECT:
950  {
951  std::vector<wxPoint> pts = aShape->GetRectCorners();
952 
953  if( sketch || thickness > 0 )
954  {
955  m_plotter->ThickSegment( pts[0], pts[1], thickness, GetPlotMode(), &gbr_metadata );
956  m_plotter->ThickSegment( pts[1], pts[2], thickness, GetPlotMode(), &gbr_metadata );
957  m_plotter->ThickSegment( pts[2], pts[3], thickness, GetPlotMode(), &gbr_metadata );
958  m_plotter->ThickSegment( pts[3], pts[0], thickness, GetPlotMode(), &gbr_metadata );
959  }
960 
961  if( !sketch && aShape->IsFilled() )
962  {
963  SHAPE_LINE_CHAIN poly;
964 
965  for( const wxPoint& pt : pts )
966  poly.Append( pt );
967 
968  m_plotter->PlotPoly( poly, FILL_TYPE::FILLED_SHAPE, -1, &gbr_metadata );
969  }
970  }
971  break;
972 
973  default:
974  wxASSERT_MSG( false, "Unhandled PCB_SHAPE shape" );
975  m_plotter->ThickSegment( start, end, thickness, GetPlotMode(), &gbr_metadata );
976  }
977 }
978 
979 
983 void BRDITEMS_PLOTTER::plotOneDrillMark( PAD_DRILL_SHAPE_T aDrillShape, const wxPoint &aDrillPos,
984  wxSize aDrillSize, const wxSize &aPadSize,
985  double aOrientation, int aSmallDrill )
986 {
987  // Small drill marks have no significance when applied to slots
988  if( aSmallDrill && aDrillShape == PAD_DRILL_SHAPE_CIRCLE )
989  aDrillSize.x = std::min( aSmallDrill, aDrillSize.x );
990 
991  // Round holes only have x diameter, slots have both
992  aDrillSize.x -= getFineWidthAdj();
993  aDrillSize.x = Clamp( 1, aDrillSize.x, aPadSize.x - 1 );
994 
995  if( aDrillShape == PAD_DRILL_SHAPE_OBLONG )
996  {
997  aDrillSize.y -= getFineWidthAdj();
998  aDrillSize.y = Clamp( 1, aDrillSize.y, aPadSize.y - 1 );
999  m_plotter->FlashPadOval( aDrillPos, aDrillSize, aOrientation, GetPlotMode(), NULL );
1000  }
1001  else
1002  m_plotter->FlashPadCircle( aDrillPos, aDrillSize.x, GetPlotMode(), NULL );
1003 }
1004 
1005 
1007 {
1008  /* If small drills marks were requested prepare a clamp value to pass
1009  to the helper function */
1010  int small_drill = (GetDrillMarksType() == PCB_PLOT_PARAMS::SMALL_DRILL_SHAPE) ?
1011  SMALL_DRILL : 0;
1012 
1013  /* In the filled trace mode drill marks are drawn white-on-black to scrape
1014  the underlying pad. This works only for drivers supporting color change,
1015  obviously... it means that:
1016  - PS, SVG and PDF output is correct (i.e. you have a 'donut' pad)
1017  - In HPGL you can't see them
1018  - In gerbers you can't see them, too. This is arguably the right thing to
1019  do since having drill marks and high speed drill stations is a sure
1020  recipe for broken tools and angry manufacturers. If you *really* want them
1021  you could start a layer with negative polarity to scrape the film.
1022  - In DXF they go into the 'WHITE' layer. This could be useful.
1023  */
1024  if( GetPlotMode() == FILLED )
1025  m_plotter->SetColor( WHITE );
1026 
1027  for( auto pts : m_board->Tracks() )
1028  {
1029  const VIA* via = dyn_cast<const VIA*>( pts );
1030 
1031  if( via )
1032  {
1034  wxSize( via->GetDrillValue(), 0 ),
1035  wxSize( via->GetWidth(), 0 ), 0, small_drill );
1036  }
1037  }
1038 
1039  for( auto Module : m_board->Footprints() )
1040  {
1041  for( auto pad : Module->Pads() )
1042  {
1043  if( pad->GetDrillSize().x == 0 )
1044  continue;
1045 
1046  plotOneDrillMark( pad->GetDrillShape(),
1047  pad->GetPosition(), pad->GetDrillSize(),
1048  pad->GetSize(), pad->GetOrientation(),
1049  small_drill );
1050  }
1051  }
1052 
1053  if( GetPlotMode() == FILLED )
1054  m_plotter->SetColor( GetColor() );
1055 }
virtual double GetDrawRotation() const override
Definition: fp_text.cpp:247
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:750
bool IsPolyShapeValid() const
Definition: pcb_shape.cpp:1194
OUTLINE_MODE GetPlotMode() const
a class to handle special data (items attributes) during plot.
#define SMALL_DRILL
Definition: pcbplot.h:60
OUTLINE_MODE
Definition: outline_mode.h:24
const std::shared_ptr< SHAPE_POLY_SET > & GetEffectivePolygon(PCB_LAYER_ID=UNDEFINED_LAYER) const
Definition: pcbnew/pad.cpp:252
Definition: track.h:354
aperture used for etched components
Definition: gbr_metadata.h:83
bool IsFilled() const
Definition: pcb_shape.h:96
Plot settings, and plotting engines (PostScript, Gerber, HPGL and DXF)
class ALIGNED_DIMENSION, a linear dimension (graphic item)
Definition: typeinfo.h:101
class LEADER, a leader dimension (graphic item)
Definition: typeinfo.h:102
int OutlineCount() const
Returns the number of outlines in the set
aperture used for edge connector pad (outer layers)
Definition: gbr_metadata.h:94
EDA_TEXT_VJUSTIFY_T GetVertJustify() const
Definition: eda_text.h:206
bool IsMirrored() const
Definition: eda_text.h:195
double GetLineLength(const wxPoint &aPointA, const wxPoint &aPointB)
Return the length of a line segment defined by aPointA and aPointB.
Definition: trigo.h:209
virtual void FlashPadRoundRect(const wxPoint &aPadPos, const wxSize &aSize, int aCornerRadius, double aOrient, OUTLINE_MODE aTraceMode, void *aData)=0
virtual void EndBlock(void *aData)
calling this function allows one to define the end of a group of drawing items for instance in SVG or...
Definition: plotter.h:493
aperture used for heat sink pad (typically for SMDs)
Definition: gbr_metadata.h:99
no special fabrication property
Definition: pad_shapes.h:97
virtual void ThickCircle(const wxPoint &pos, int diametre, int width, OUTLINE_MODE tracemode, void *aData)
Definition: plotter.cpp:568
SHAPE_POLY_SET & GetPolyShape()
Definition: pcb_shape.h:259
const wxPoint & GetEnd() const
Function GetEnd returns the ending point of the graphic.
Definition: pcb_shape.h:155
virtual void SetLayer(PCB_LAYER_ID aLayer)
Function SetLayer sets the layer this item is on.
Definition: board_item.h:206
print info associated to a component (TO.C attribute)
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
Definition: board_item.h:86
virtual void SetColor(COLOR4D color)=0
const wxPoint & GetStart() const
Definition: track.h:116
int GetSize() const
Definition: pcb_target.h:67
void SetFilled(bool aFlag)
Definition: pcb_shape.h:94
bool IsVisible() const
Definition: eda_text.h:192
void SetNetAttribType(int aNetAttribType)
Definition: gbr_metadata.h:170
class CENTER_DIMENSION, a center point marking (graphic item)
Definition: typeinfo.h:103
void PlotPcbText(PCB_TEXT *aText)
a fiducial (usually a smd) for the full board
Definition: pad_shapes.h:99
int color
Definition: DXF_plotter.cpp:60
bool IsEmpty() const
Returns true if the set is empty (no polygons at all)
std::vector< wxPoint > GetRectCorners() const
Definition: pcb_shape.cpp:945
int GetWidth() const
Definition: pcb_shape.h:118
Smd pad, appears on the solder paste layer (default)
Definition: pad_shapes.h:81
virtual void FlashPadOval(const wxPoint &aPadPos, const wxSize &aSize, double aPadOrient, OUTLINE_MODE aTraceMode, void *aData)=0
PLOTTER * m_plotter
Definition: pcbplot.h:66
polygon (not yet used for tracks, but could be in microwave apps)
Definition: board_item.h:56
void PlotDrillMarks()
Function PlotDrillMarks Draw a drill mark for pads and vias.
double GetOrientation() const
Definition: footprint.h:204
virtual void StartBlock(void *aData)
calling this function allows one to define the beginning of a group of drawing items,...
Definition: plotter.h:484
double GetTextAngle() const
Definition: eda_text.h:180
class PCB_TEXT, text on a layer
Definition: typeinfo.h:92
void PlotFootprintTextItems(FOOTPRINT *aFootprint)
aperture used for through hole component on outer layer
Definition: gbr_metadata.h:89
usual segment : line with rounded ends
Definition: board_item.h:52
Smd pad, used in BGA footprints.
Definition: pad_shapes.h:98
virtual void FilledCircle(const wxPoint &pos, int diametre, OUTLINE_MODE tracemode, void *aData)
Definition: plotter.cpp:584
wxString GetNetname() const
Function GetNetname.
virtual void PlotPoly(const std::vector< wxPoint > &aCornerList, FILL_TYPE aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=NULL)=0
Draw a polygon ( filled or not )
Arcs (with rounded ends)
Definition: board_item.h:54
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:94
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
Definition: macros.h:83
PAD_SHAPE_T GetShape() const
Definition: pad.h:159
virtual void BezierCurve(const wxPoint &aStart, const wxPoint &aControl1, const wxPoint &aControl2, const wxPoint &aEnd, int aTolerance, int aLineThickness=USE_DEFAULT_LINE_WIDTH)
Generic fallback: Cubic Bezier curve rendered as a polyline In KiCad the bezier curves have 4 control...
Definition: plotter.cpp:203
aperture used for castellated pads in copper layer files
Definition: gbr_metadata.h:100
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
like PAD_PTH, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:85
a pad used as heat sink, usually in SMD footprints
Definition: pad_shapes.h:102
segment with non rounded ends
Definition: board_item.h:53
int PointCount() const
Function PointCount()
PAD_DRILL_SHAPE_T
Enum PAD_DRILL_SHAPE_T is the set of pad drill shapes, used with PAD::{Set,Get}DrillShape()
Definition: pad_shapes.h:66
BOARD * m_board
Definition: pcbplot.h:67
virtual void ThickSegment(const wxPoint &start, const wxPoint &end, int width, OUTLINE_MODE tracemode, void *aData)
Definition: plotter.cpp:506
int GetEffectiveTextPenWidth(int aDefaultWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultWidth.
Definition: eda_text.cpp:157
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
virtual void FlashPadTrapez(const wxPoint &aPadPos, const wxPoint *aCorners, double aPadOrient, OUTLINE_MODE aTraceMode, void *aData)=0
Flash a trapezoidal pad.
FP_TEXT & Value()
read/write accessors:
Definition: footprint.h:480
a pad with a castellated through hole
Definition: pad_shapes.h:103
void SetPadPinFunction(const wxString &aPadPinFunction, bool aUseUTF8, bool aEscapeString)
Definition: gbr_metadata.h:187
int GetLineThickness() const
Definition: dimension.h:187
PAD_ATTR_T GetAttribute() const
Definition: pad.h:348
virtual void Text(const wxPoint &aPos, const COLOR4D aColor, const wxString &aText, double aOrient, const wxSize &aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold, bool aMultilineAllowed=false, void *aData=NULL)
Draws text with the plotter.
Definition: gr_text.cpp:219
Board plot function definition file.
bool IsItalic() const
Definition: eda_text.h:186
FP_TEXT & Reference()
Definition: footprint.h:481
wxPoint GetPosition() const override
Definition: pcb_target.h:61
wxString GetShownText(int aDepth=0) const override
Return the string actually shown after processing of the base text.
Definition: pcb_text.cpp:52
const VECTOR2I & CPoint(int aIndex) const
Function Point()
const std::vector< wxPoint > BuildPolyPointsList() const
Build and return the list of corners in a std::vector<wxPoint> It must be used only to convert the SH...
Definition: pcb_shape.cpp:1177
void SetClosed(bool aClosed)
Function SetClosed()
aperture used for BGA pad with a solder mask defined by the solder mask
Definition: gbr_metadata.h:93
int GetWidth() const
Definition: pcb_target.h:70
wxPoint ShapePos() const
Definition: pcbnew/pad.cpp:609
aperture used for fiducial pad (outer layers), at board level
Definition: gbr_metadata.h:97
virtual void FlashPadRect(const wxPoint &aPadPos, const wxSize &aSize, double aPadOrient, OUTLINE_MODE aTraceMode, void *aData)=0
const std::vector< std::shared_ptr< SHAPE > > & GetShapes() const
Definition: dimension.h:215
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:205
int GetMinThickness() const
Definition: zone.h:242
#define NULL
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in a variety of units (the basic call r...
Definition: pad.h:334
void SetShape(PCB_SHAPE_TYPE_T aShape)
Definition: pcb_shape.h:128
int GetDrillValue() const
Function GetDrillValue "calculates" the drill value for vias (m-Drill if > 0, or default drill value ...
Definition: track.cpp:170
void PlotPcbTarget(PCB_TARGET *PtMire)
SHAPE_POLY_SET.
void SetPadName(const wxString &aPadname, bool aUseUTF8=false, bool aEscapeString=false)
Definition: gbr_metadata.h:182
SHAPE_LINE_CHAIN & Outline(int aIndex)
Returns the reference to aIndex-th outline in the set
virtual PCB_LAYER_ID GetLayer() const override
Function GetLayer returns the primary layer this item is on.
Definition: zone.cpp:215
virtual PLOT_FORMAT GetPlotterType() const =0
Returns the effective plot engine in use.
void PlotBoardGraphicItems()
plot items like text and graphics, but not tracks and footprints
COLOR4D GetColor() const
const wxSize & GetTextSize() const
Definition: eda_text.h:245
FOOTPRINTS & Footprints()
Definition: board.h:283
const wxSize & GetSize() const
Definition: pad.h:226
PCB_TEXT & Text()
Definition: dimension.h:209
const wxPoint & GetStart() const
Function GetStart returns the starting point of the graphic.
Definition: pcb_shape.h:144
const wxString & GetName() const
Definition: pad.h:127
virtual void FlashPadCustom(const wxPoint &aPadPos, const wxSize &aSize, SHAPE_POLY_SET *aPolygons, OUTLINE_MODE aTraceMode, void *aData)=0
static LSET ExternalCuMask()
Return a mask holding the Front and Bottom layers.
Definition: lset.cpp:780
void PlotFootprintTextItem(FP_TEXT *aText, COLOR4D aColor)
void PlotFootprintGraphicItems(FOOTPRINT *aFootprint)
DRAWINGS & GraphicalItems()
Definition: footprint.h:185
ZONE handles a list of polygons defining a copper zone.
Definition: zone.h:57
aperture used for mechanical pads (NPTH)
Definition: gbr_metadata.h:95
const wxString GetReference() const
Function GetReference.
Definition: footprint.h:440
Like smd, does not appear on the solder paste layer (default) note also has a special attribute in Ge...
Definition: pad_shapes.h:82
void Fracture(POLYGON_MODE aFastMode)
Converts a set of polygons with holes to a singe outline with "slits"/"fractures" connecting the oute...
PAD_PROP_T GetProperty() const
Definition: pad.h:351
bool IsMultilineAllowed() const
Definition: eda_text.h:203
line chain (polyline)
Definition: shape.h:46
aperture used for connected items like tracks (not vias)
Definition: gbr_metadata.h:84
class PCB_TARGET, a target (graphic item)
Definition: typeinfo.h:105
int LAYER_NUM
This can be replaced with int and removed.
void wxStringSplit(const wxString &aText, wxArrayString &aStrings, wxChar aSplitter)
Split aString to a string list separated at aSplitter.
Definition: string.cpp:796
bool GetPlotValue() const
aperture used for test point pad (outer layers)
Definition: gbr_metadata.h:96
int GetRoundRectCornerRadius() const
Definition: pcbnew/pad.cpp:221
Definition: color4d.h:49
const wxSize & GetDelta() const
Definition: pad.h:233
FOOTPRINT * GetParent() const
void PlotFilledAreas(ZONE *aZone, SHAPE_POLY_SET &aPolysList)
Definition: seg.h:39
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new outline to the set and returns its index
void PlotPad(PAD *aPad, COLOR4D aColor, OUTLINE_MODE aPlotMode)
Plot a pad.
void SetNetName(const wxString &aNetname)
Definition: gbr_metadata.h:180
COLOR4D GetColor(int aLayer) const
a fiducial (usually a smd) local to the parent footprint
Definition: pad_shapes.h:100
int GetWidth() const
Definition: track.h:110
Board layer functions and definitions.
double GetChamferRectRatio() const
Definition: pad.h:511
void plotOneDrillMark(PAD_DRILL_SHAPE_T aDrillShape, const wxPoint &aDrillPos, wxSize aDrillSize, const wxSize &aPadSize, double aOrientation, int aSmallDrill)
Helper function to plot a single drill mark.
FOOTPRINT * GetParentFootprint() const
Function GetParentFootprint returns a pointer to the parent footprint, or NULL if PCB_SHAPE does not ...
Definition: pcb_shape.cpp:457
void SetStart(const wxPoint &aStart)
Definition: pcb_shape.h:147
SHAPE_LINE_CHAIN.
void PlotPcbShape(PCB_SHAPE *aShape)
LSET m_layerMask
Definition: pcbplot.h:68
void PlotFootprintGraphicItem(FP_SHAPE *aShape)
const wxPoint & GetBezControl2() const
Definition: pcb_shape.h:135
VECTOR2I A
Definition: seg.h:47
double GetAngle() const
Definition: pcb_shape.h:126
Plated through hole pad.
Definition: pad_shapes.h:80
int GetShape() const
Definition: pcb_target.h:64
bool IsOnCopperLayer() const override
Function IsOnCopperLayer.
Definition: zone.cpp:221
void SetWidth(int aWidth)
Definition: pcb_shape.h:117
aperture used for fiducial pad (outer layers), at footprint level
Definition: gbr_metadata.h:98
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:68
aperture used for SMD pad with a solder mask defined by the solder mask
Definition: gbr_metadata.h:91
const T & Clamp(const T &lower, const T &value, const T &upper)
Function Clamp limits value within the range lower <= value <= upper.
Definition: util.h:46
bool GetPlotInvisibleText() const
wxPoint GetPosition() const override
Definition: footprint.h:200
int GetSketchPadLineWidth() const
virtual void ThickArc(const wxPoint &centre, double StAngle, double EndAngle, int rayon, int width, OUTLINE_MODE tracemode, void *aData)
Definition: plotter.cpp:530
void GetLinePositions(std::vector< wxPoint > &aPositions, int aLineCount) const
Populate aPositions with the position of each line of a multiline text, according to the vertical jus...
Definition: eda_text.cpp:424
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
ring
Definition: board_item.h:55
int GetChamferPositions() const
Definition: pad.h:519
const wxPoint & GetTextPos() const
Definition: eda_text.h:254
void SetApertureAttrib(GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB aApertAttribute)
Definition: gbr_metadata.h:160
COLOR_SETTINGS * ColorSettings() const
class ORTHOGONAL_DIMENSION, a linear dimension constrained to x/y
Definition: typeinfo.h:104
bool m_NotInNet
true if a pad of a footprint cannot be connected (for instance a mechanical NPTH, ot a not named pad)...
int getFineWidthAdj()
Definition: pcbplot.h:83
GBR_NETLIST_METADATA m_NetlistMetadata
a item to handle object attribute:
Definition: gbr_metadata.h:212
PCB_SHAPE_TYPE_T GetShape() const
Definition: pcb_shape.h:129
CONST_SEGMENT_ITERATOR CIterateSegments(int aFirst, int aLast, bool aIterateHoles=false) const
Returns an iterator object, for iterating between aFirst and aLast outline, with or without holes (de...
double ArcTangente(int dy, int dx)
Definition: trigo.cpp:162
aperture used for not connected items (texts, outlines on copper)
Definition: gbr_metadata.h:86
Definition: pad.h:59
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:179
void SetCopper(bool aValue)
Definition: gbr_metadata.h:202
virtual wxString GetShownText(int aDepth=0) const override
Return the string actually shown after processing of the base text.
Definition: fp_text.cpp:422
DrillMarksType GetDrillMarksType() const
Abstract dimension API.
Definition: dimension.h:95
a test point pad
Definition: pad_shapes.h:101
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:91
Bezier Curve.
Definition: board_item.h:57
print info associated to a net (TO.N attribute)
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
Definition: board_item.h:185
const wxString & GetPinFunction() const
Definition: pad.h:133
const wxPoint & GetBezControl1() const
Definition: pcb_shape.h:132
bool GetPlotReference() const
void PlotDimension(DIMENSION_BASE *Dimension)
DRAWINGS & Drawings()
Definition: board.h:286
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:133
void SetCmpReference(const wxString &aComponentRef)
Definition: gbr_metadata.h:192
COLOR4D getColor(LAYER_NUM aLayer)
Function getColor.
TRACKS & Tracks()
Definition: board.h:280
virtual void FlashPadCircle(const wxPoint &aPadPos, int aDiameter, OUTLINE_MODE aTraceMode, void *aData)=0
void SetEnd(const wxPoint &aEnd)
Definition: pcb_shape.h:158
#define GBR_NETINFO_ALL
KICAD_T Type() const
Function Type()
Definition: eda_item.h:181
axis-aligned rectangle
Definition: shape.h:44
bool GetFilledPolysUseThickness() const
Definition: zone.h:704
virtual void SetCurrentLineWidth(int width, void *aData=NULL)=0
Set the line width for the next drawing.
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:100
VECTOR2I B
Definition: seg.h:48