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