KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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-2023 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
28#include <geometry/seg.h> // for SEG
30#include <geometry/shape_line_chain.h> // for SHAPE_LINE_CHAIN
31#include <geometry/shape_poly_set.h> // for SHAPE_POLY_SET, SHAPE_P...
33#include <string_utils.h>
34#include <macros.h>
35#include <math/util.h> // for KiROUND, Clamp
36#include <math/vector2d.h> // for VECTOR2I
38#include <trigo.h>
39
40#include <core/typeinfo.h> // for dyn_cast, PCB_DIMENSION_T
41#include <gbr_metadata.h>
42#include <gbr_netlist_metadata.h> // for GBR_NETLIST_METADATA
43#include <layer_ids.h> // for LSET, IsCopperLayer
44#include <pcbplot.h>
45#include <pcb_plot_params.h> // for PCB_PLOT_PARAMS, PCB_PL...
46#include <advanced_config.h>
47
48#include <pcb_dimension.h>
49#include <pcb_shape.h>
50#include <footprint.h>
51#include <pcb_track.h>
52#include <pad.h>
53#include <pcb_target.h>
54#include <pcb_text.h>
55#include <pcb_textbox.h>
56#include <pcb_tablecell.h>
57#include <pcb_table.h>
58#include <zone.h>
59
60#include <wx/debug.h> // for wxASSERT_MSG
61
62
64{
65 COLOR4D color = ColorSettings()->GetColor( aLayer );
66
67 // A hack to avoid plotting a white item in white color on white paper
68 if( color == COLOR4D::WHITE )
70
71 return color;
72}
73
74
75void BRDITEMS_PLOTTER::PlotPad( const PAD* aPad, const COLOR4D& aColor, OUTLINE_MODE aPlotMode )
76{
77 VECTOR2I shape_pos = aPad->ShapePos();
78 GBR_METADATA metadata;
79
80 bool plotOnCopperLayer = ( m_layerMask & LSET::AllCuMask() ).any();
81 bool plotOnExternalCopperLayer = ( m_layerMask & LSET::ExternalCuMask() ).any();
82
83 // Pad not on the solder mask layer cannot be soldered.
84 // therefore it can have a specific aperture attribute.
85 // Not yet in use.
86 // bool isPadOnBoardTechLayers = ( aPad->GetLayerSet() & LSET::AllBoardTechMask() ).any();
87
88 metadata.SetCmpReference( aPad->GetParentFootprint()->GetReference() );
89
90 if( plotOnCopperLayer )
91 {
93 metadata.SetCopper( true );
94
95 // Gives a default attribute, for instance for pads used as tracks in net ties:
96 // Connector pads and SMD pads are on external layers
97 // if on internal layers, they are certainly used as net tie
98 // and are similar to tracks: just conductor items
100
101 const bool useUTF8 = false;
102 const bool useQuoting = false;
103 metadata.SetPadName( aPad->GetNumber(), useUTF8, useQuoting );
104
105 if( !aPad->GetNumber().IsEmpty() )
106 metadata.SetPadPinFunction( aPad->GetPinFunction(), useUTF8, useQuoting );
107
108 metadata.SetNetName( aPad->GetNetname() );
109
110 // Some pads are mechanical pads ( through hole or smd )
111 // when this is the case, they have no pad name and/or are not plated.
112 // In this case gerber files have slightly different attributes.
113 if( aPad->GetAttribute() == PAD_ATTRIB::NPTH || aPad->GetNumber().IsEmpty() )
114 metadata.m_NetlistMetadata.m_NotInNet = true;
115
116 if( !plotOnExternalCopperLayer )
117 {
118 // the .P object attribute (GBR_NETLIST_METADATA::GBR_NETINFO_PAD)
119 // is used on outer layers, unless the component is embedded
120 // or a "etched" component (fp only drawn, not a physical component)
121 // Currently, Pcbnew does not handle embedded component, so we disable the .P
122 // attribute on internal layers
123 // Note the Gerber doc is not really clear about through holes pads about the .P
126
127 }
128
129 // Some attributes are reserved to the external copper layers:
130 // GBR_APERTURE_ATTRIB_CONNECTORPAD and GBR_APERTURE_ATTRIB_SMDPAD_CUDEF
131 // for instance.
132 // Pad with type PAD_ATTRIB::CONN or PAD_ATTRIB::SMD that is not on outer layer
133 // has its aperture attribute set to GBR_APERTURE_ATTRIB_CONDUCTOR
134 switch( aPad->GetAttribute() )
135 {
136 case PAD_ATTRIB::NPTH: // Mechanical pad through hole
138 break;
139
140 case PAD_ATTRIB::PTH : // Pad through hole, a hole is also expected
142 break;
143
144 case PAD_ATTRIB::CONN: // Connector pads, no solder paste but with solder mask.
145 if( plotOnExternalCopperLayer )
147 break;
148
149 case PAD_ATTRIB::SMD: // SMD pads (on external copper layer only)
150 // with solder paste and mask
151 if( plotOnExternalCopperLayer )
153 break;
154 }
155
156 // Fabrication properties can have specific GBR_APERTURE_METADATA options
157 // that replace previous aperture attribute:
158 switch( aPad->GetProperty() )
159 {
160 case PAD_PROP::BGA: // Only applicable to outer layers
161 if( plotOnExternalCopperLayer )
163 break;
164
165 case PAD_PROP::FIDUCIAL_GLBL:
167 break;
168
169 case PAD_PROP::FIDUCIAL_LOCAL:
171 break;
172
173 case PAD_PROP::TESTPOINT: // Only applicable to outer layers
174 if( plotOnExternalCopperLayer )
176 break;
177
178 case PAD_PROP::HEATSINK:
180 break;
181
182 case PAD_PROP::CASTELLATED:
184 break;
185
186 case PAD_PROP::NONE:
187 break;
188 }
189
190 // Ensure NPTH pads have *always* the GBR_APERTURE_ATTRIB_WASHERPAD attribute
191 if( aPad->GetAttribute() == PAD_ATTRIB::NPTH )
193 }
194 else
195 {
197 }
198
199 // Set plot color (change WHITE to LIGHTGRAY because
200 // the white items are not seen on a white paper or screen
201 m_plotter->SetColor( aColor != WHITE ? aColor : LIGHTGRAY);
202
203 if( aPlotMode == SKETCH )
205
206 switch( aPad->GetShape() )
207 {
208 case PAD_SHAPE::CIRCLE:
209 m_plotter->FlashPadCircle( shape_pos, aPad->GetSize().x, aPlotMode, &metadata );
210 break;
211
212 case PAD_SHAPE::OVAL:
213 m_plotter->FlashPadOval( shape_pos, aPad->GetSize(), aPad->GetOrientation(), aPlotMode,
214 &metadata );
215 break;
216
217 case PAD_SHAPE::RECTANGLE:
218 m_plotter->FlashPadRect( shape_pos, aPad->GetSize(), aPad->GetOrientation(), aPlotMode,
219 &metadata );
220 break;
221
222 case PAD_SHAPE::ROUNDRECT:
223 m_plotter->FlashPadRoundRect( shape_pos, aPad->GetSize(), aPad->GetRoundRectCornerRadius(),
224 aPad->GetOrientation(), aPlotMode, &metadata );
225 break;
226
227 case PAD_SHAPE::TRAPEZOID:
228 {
229 // Build the pad polygon in coordinates relative to the pad
230 // (i.e. for a pad at pos 0,0, rot 0.0). Needed to use aperture macros,
231 // to be able to create a pattern common to all trapezoid pads having the same shape
232 VECTOR2I coord[4];
233
234 // Order is lower left, lower right, upper right, upper left.
235 VECTOR2I half_size = aPad->GetSize() / 2;
236 VECTOR2I trap_delta = aPad->GetDelta() / 2;
237
238 coord[0] = VECTOR2I( -half_size.x - trap_delta.y, half_size.y + trap_delta.x );
239 coord[1] = VECTOR2I( half_size.x + trap_delta.y, half_size.y - trap_delta.x );
240 coord[2] = VECTOR2I( half_size.x - trap_delta.y, -half_size.y + trap_delta.x );
241 coord[3] = VECTOR2I( -half_size.x + trap_delta.y, -half_size.y - trap_delta.x );
242
243 m_plotter->FlashPadTrapez( shape_pos, coord, aPad->GetOrientation(), aPlotMode, &metadata );
244 }
245 break;
246
247 case PAD_SHAPE::CHAMFERED_RECT:
248 if( m_plotter->GetPlotterType() == PLOT_FORMAT::GERBER )
249 {
250 GERBER_PLOTTER* gerberPlotter = static_cast<GERBER_PLOTTER*>( m_plotter );
251
252 gerberPlotter->FlashPadChamferRoundRect( shape_pos, aPad->GetSize(),
254 aPad->GetChamferRectRatio(),
255 aPad->GetChamferPositions(),
256 aPad->GetOrientation(), aPlotMode, &metadata );
257 break;
258 }
259
261
262 default:
263 case PAD_SHAPE::CUSTOM:
264 {
265 const std::shared_ptr<SHAPE_POLY_SET>& polygons = aPad->GetEffectivePolygon( ERROR_INSIDE );
266
267 if( polygons->OutlineCount() )
268 {
269 m_plotter->FlashPadCustom( shape_pos, aPad->GetSize(), aPad->GetOrientation(),
270 polygons.get(), aPlotMode, &metadata );
271 }
272 }
273 break;
274 }
275}
276
277
279{
280 if( !GetPlotFPText() )
281 return;
282
283 const PCB_TEXT* textItem = &aFootprint->Reference();
284 PCB_LAYER_ID textLayer = textItem->GetLayer();
285
286 // Reference and value have special controls for forcing their plotting
287 if( GetPlotReference() && m_layerMask[textLayer]
288 && ( textItem->IsVisible() || GetPlotInvisibleText() ) )
289 {
290 PlotText( textItem, textLayer, textItem->IsKnockout(), textItem->GetFontMetrics() );
291 }
292
293 textItem = &aFootprint->Value();
294 textLayer = textItem->GetLayer();
295
296 if( GetPlotValue() && m_layerMask[textLayer]
297 && ( textItem->IsVisible() || GetPlotInvisibleText() ) )
298 {
299 PlotText( textItem, textLayer, textItem->IsKnockout(), textItem->GetFontMetrics() );
300 }
301
302 std::vector<PCB_TEXT*> texts;
303
304 // Skip the reference and value texts that are handled specially
305 for( PCB_FIELD* field : aFootprint->Fields() )
306 {
307 if( field->IsReference() || field->IsValue() )
308 continue;
309
310 texts.push_back( field );
311 }
312
313 for( BOARD_ITEM* item : aFootprint->GraphicalItems() )
314 {
315 textItem = dynamic_cast<const PCB_TEXT*>( item );
316
317 if( textItem )
318 texts.push_back( static_cast<PCB_TEXT*>( item ) );
319 }
320
321 for( const PCB_TEXT* text : texts )
322 {
323 if( !text->IsVisible() )
324 continue;
325
326 textLayer = text->GetLayer();
327
328 if( textLayer == Edge_Cuts || textLayer >= PCB_LAYER_ID_COUNT )
329 continue;
330
331 if( !m_layerMask[textLayer] || aFootprint->GetPrivateLayers().test( textLayer ) )
332 continue;
333
334 if( text->GetText() == wxT( "${REFERENCE}" ) && !GetPlotReference() )
335 continue;
336
337 if( text->GetText() == wxT( "${VALUE}" ) && !GetPlotValue() )
338 continue;
339
340 PlotText( text, textLayer, text->IsKnockout(), text->GetFontMetrics() );
341 }
342}
343
344
346{
347 switch( item->Type() )
348 {
349 case PCB_SHAPE_T:
350 PlotShape( static_cast<const PCB_SHAPE*>( item ) );
351 break;
352
353 case PCB_TEXT_T:
354 {
355 const PCB_TEXT* text = static_cast<const PCB_TEXT*>( item );
356 PlotText( text, text->GetLayer(), text->IsKnockout(), text->GetFontMetrics() );
357 break;
358 }
359
360 case PCB_TEXTBOX_T:
361 {
362 m_plotter->SetTextMode( PLOT_TEXT_MODE::STROKE );
363
364 const PCB_TEXTBOX* textbox = static_cast<const PCB_TEXTBOX*>( item );
365 PlotText( textbox, textbox->GetLayer(), textbox->IsKnockout(), textbox->GetFontMetrics() );
366
367 if( textbox->IsBorderEnabled() )
368 PlotShape( textbox );
369
371 break;
372 }
373
374 case PCB_TABLE_T:
375 {
376 const PCB_TABLE* table = static_cast<const PCB_TABLE*>( item );
377
378 m_plotter->SetTextMode( PLOT_TEXT_MODE::STROKE );
379
380 for( const PCB_TABLECELL* cell : table->GetCells() )
381 PlotText( cell, cell->GetLayer(), cell->IsKnockout(), cell->GetFontMetrics() );
382
383 PlotTableBorders( table );
384
386 break;
387 }
388
390 case PCB_DIM_CENTER_T:
391 case PCB_DIM_RADIAL_T:
393 case PCB_DIM_LEADER_T:
394 m_plotter->SetTextMode( PLOT_TEXT_MODE::STROKE );
395
396 PlotDimension( static_cast<const PCB_DIMENSION_BASE*>( item ) );
397
399 break;
400
401 case PCB_TARGET_T:
402 PlotPcbTarget( static_cast<const PCB_TARGET*>( item ) );
403 break;
404
405 default:
406 break;
407 }
408}
409
410
412{
413 if( !m_layerMask[aDim->GetLayer()] )
414 return;
415
417
418 // Set plot color (change WHITE to LIGHTGRAY because
419 // the white items are not seen on a white paper or screen
421
422 PlotText( aDim, aDim->GetLayer(), false, aDim->GetFontMetrics() );
423
424 PCB_SHAPE temp_item;
425
426 temp_item.SetStroke( STROKE_PARAMS( aDim->GetLineThickness(), LINE_STYLE::SOLID ) );
427 temp_item.SetLayer( aDim->GetLayer() );
428
429 for( const std::shared_ptr<SHAPE>& shape : aDim->GetShapes() )
430 {
431 switch( shape->Type() )
432 {
433 case SH_SEGMENT:
434 {
435 const SEG& seg = static_cast<const SHAPE_SEGMENT*>( shape.get() )->GetSeg();
436
437 temp_item.SetShape( SHAPE_T::SEGMENT );
438 temp_item.SetStart( seg.A );
439 temp_item.SetEnd( seg.B );
440
441 PlotShape( &temp_item );
442 break;
443 }
444
445 case SH_CIRCLE:
446 {
447 VECTOR2I start( shape->Centre() );
448 int radius = static_cast<const SHAPE_CIRCLE*>( shape.get() )->GetRadius();
449
450 temp_item.SetShape( SHAPE_T::CIRCLE );
451 temp_item.SetFilled( false );
452 temp_item.SetStart( start );
453 temp_item.SetEnd( VECTOR2I( start.x + radius, start.y ) );
454
455 PlotShape( &temp_item );
456 break;
457 }
458
459 default:
460 break;
461 }
462 }
463}
464
465
467{
468 int dx1, dx2, dy1, dy2, radius;
469
470 if( !m_layerMask[aMire->GetLayer()] )
471 return;
472
473 m_plotter->SetColor( getColor( aMire->GetLayer() ) );
474
475 PCB_SHAPE temp_item;
476
477 temp_item.SetShape( SHAPE_T::CIRCLE );
478 temp_item.SetFilled( false );
479 temp_item.SetStroke( STROKE_PARAMS( aMire->GetWidth(), LINE_STYLE::SOLID ) );
480 temp_item.SetLayer( aMire->GetLayer() );
481 temp_item.SetStart( aMire->GetPosition() );
482 radius = aMire->GetSize() / 3;
483
484 if( aMire->GetShape() ) // temp_item X
485 radius = aMire->GetSize() / 2;
486
487 // Draw the circle
488 temp_item.SetEnd( VECTOR2I( temp_item.GetStart().x + radius, temp_item.GetStart().y ) );
489
490 PlotShape( &temp_item );
491
492 temp_item.SetShape( SHAPE_T::SEGMENT );
493
494 radius = aMire->GetSize() / 2;
495 dx1 = radius;
496 dy1 = 0;
497 dx2 = 0;
498 dy2 = radius;
499
500 if( aMire->GetShape() ) // Shape X
501 {
502 dx1 = dy1 = radius;
503 dx2 = dx1;
504 dy2 = -dy1;
505 }
506
507 VECTOR2I mirePos( aMire->GetPosition() );
508
509 // Draw the X or + temp_item:
510 temp_item.SetStart( VECTOR2I( mirePos.x - dx1, mirePos.y - dy1 ) );
511 temp_item.SetEnd( VECTOR2I( mirePos.x + dx1, mirePos.y + dy1 ) );
512 PlotShape( &temp_item );
513
514 temp_item.SetStart( VECTOR2I( mirePos.x - dx2, mirePos.y - dy2 ) );
515 temp_item.SetEnd( VECTOR2I( mirePos.x + dx2, mirePos.y + dy2 ) );
516 PlotShape( &temp_item );
517}
518
519
521{
522 for( const BOARD_ITEM* item : aFootprint->GraphicalItems() )
523 {
524 if( aFootprint->GetPrivateLayers().test( item->GetLayer() ) )
525 continue;
526
527 if( !m_layerMask[ item->GetLayer() ] )
528 continue;
529
530 switch( item->Type() )
531 {
532 case PCB_SHAPE_T:
533 PlotShape( static_cast<const PCB_SHAPE*>( item ) );
534 break;
535
536 case PCB_TEXTBOX_T:
537 {
538 const PCB_TEXTBOX* textbox = static_cast<const PCB_TEXTBOX*>( item );
539
540 m_plotter->SetTextMode( PLOT_TEXT_MODE::STROKE );
541
542 PlotText( textbox, textbox->GetLayer(), textbox->IsKnockout(),
543 textbox->GetFontMetrics() );
544
545 if( textbox->IsBorderEnabled() )
546 PlotShape( textbox );
547
549 break;
550 }
551
553 case PCB_DIM_CENTER_T:
554 case PCB_DIM_RADIAL_T:
556 case PCB_DIM_LEADER_T:
557 PlotDimension( static_cast<const PCB_DIMENSION_BASE*>( item ) );
558 break;
559
560 case PCB_TEXT_T:
561 // Plotted in PlotFootprintTextItems()
562 break;
563
564 default:
565 UNIMPLEMENTED_FOR( item->GetClass() );
566 }
567 }
568}
569
570
571#include <font/stroke_font.h>
572void BRDITEMS_PLOTTER::PlotText( const EDA_TEXT* aText, PCB_LAYER_ID aLayer, bool aIsKnockout,
573 const KIFONT::METRICS& aFontMetrics )
574{
575 KIFONT::FONT* font = aText->GetFont();
576
577 if( !font )
578 {
579 wxString defaultFontName; // empty string is the KiCad stroke font
580
582 defaultFontName = m_plotter->RenderSettings()->GetDefaultFont();
583
584 font = KIFONT::FONT::GetFont( defaultFontName, aText->IsBold(), aText->IsItalic() );
585 }
586
587 wxString shownText( aText->GetShownText( true ) );
588
589 if( shownText.IsEmpty() )
590 return;
591
592 if( !m_layerMask[aLayer] )
593 return;
594
595 GBR_METADATA gbr_metadata;
596
597 if( IsCopperLayer( aLayer ) )
599
600 COLOR4D color = getColor( aLayer );
602
603 VECTOR2I pos = aText->GetTextPos();
604
605 TEXT_ATTRIBUTES attrs = aText->GetAttributes();
607 attrs.m_Angle = aText->GetDrawRotation();
608 attrs.m_Multiline = false;
609
611
612 if( aIsKnockout )
613 {
614 const PCB_TEXT* text = static_cast<const PCB_TEXT*>( aText );
615 SHAPE_POLY_SET finalPoly;
616
617 text->TransformTextToPolySet( finalPoly, 0, m_board->GetDesignSettings().m_MaxError,
618 ERROR_INSIDE );
620
621 for( int ii = 0; ii < finalPoly.OutlineCount(); ++ii )
622 m_plotter->PlotPoly( finalPoly.Outline( ii ), FILL_T::FILLED_SHAPE, 0, &gbr_metadata );
623 }
624 else if( aText->IsMultilineAllowed() )
625 {
626 std::vector<VECTOR2I> positions;
627 wxArrayString strings_list;
628 wxStringSplit( shownText, strings_list, '\n' );
629 positions.reserve( strings_list.Count() );
630
631 aText->GetLinePositions( positions, strings_list.Count() );
632
633 for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
634 {
635 wxString& txt = strings_list.Item( ii );
636 m_plotter->PlotText( positions[ii], color, txt, attrs, font, aFontMetrics, &gbr_metadata );
637 }
638 }
639 else
640 {
641 m_plotter->PlotText( pos, color, shownText, attrs, font, aFontMetrics, &gbr_metadata );
642 }
643}
644
645
647 const SHAPE_POLY_SET& aPolysList )
648{
649 if( aPolysList.IsEmpty() )
650 return;
651
652 GBR_METADATA gbr_metadata;
653
654 if( aZone->IsOnCopperLayer() )
655 {
656 gbr_metadata.SetNetName( aZone->GetNetname() );
657 gbr_metadata.SetCopper( true );
658
659 // Zones with no net name can exist.
660 // they are not used to connect items, so the aperture attribute cannot
661 // be set as conductor
662 if( aZone->GetNetname().IsEmpty() )
663 {
665 }
666 else
667 {
670 }
671 }
672
673 m_plotter->SetColor( getColor( aLayer ) );
674
675 m_plotter->StartBlock( nullptr ); // Clean current object attributes
676
677 /*
678 * In non filled mode the outline is plotted, but not the filling items
679 */
680
681 for( int idx = 0; idx < aPolysList.OutlineCount(); ++idx )
682 {
683 const SHAPE_LINE_CHAIN& outline = aPolysList.Outline( idx );
684
685 // Plot the current filled area (as region for Gerber plotter to manage attributes)
686 if( GetPlotMode() == FILLED )
687 {
688 if( m_plotter->GetPlotterType() == PLOT_FORMAT::GERBER )
689 {
690 static_cast<GERBER_PLOTTER*>( m_plotter )->PlotGerberRegion( outline,
691 &gbr_metadata );
692 }
693 else
694 {
695 m_plotter->PlotPoly( outline, FILL_T::FILLED_SHAPE, 0, &gbr_metadata );
696 }
697 }
698 else
699 {
701 }
702 }
703
704 m_plotter->EndBlock( nullptr ); // Clear object attributes
705}
706
707
709{
710 if( !m_layerMask[aShape->GetLayer()] )
711 return;
712
713 bool sketch = GetPlotMode() == SKETCH;
714 int thickness = aShape->GetWidth();
715 LINE_STYLE lineStyle = aShape->GetStroke().GetLineStyle();
716
717 m_plotter->SetColor( getColor( aShape->GetLayer() ) );
718
719 const FOOTPRINT* parentFP = aShape->GetParentFootprint();
720 GBR_METADATA gbr_metadata;
721
722 if( parentFP )
723 {
724 gbr_metadata.SetCmpReference( parentFP->GetReference() );
726 }
727
728 if( aShape->GetLayer() == Edge_Cuts )
729 {
731 }
732 else if( IsCopperLayer( aShape->GetLayer() ) )
733 {
734 if( parentFP )
735 {
737 gbr_metadata.SetCopper( true );
738 }
739 else if( aShape->GetNetCode() > 0 )
740 {
741 gbr_metadata.SetCopper( true );
744 gbr_metadata.SetNetName( aShape->GetNetname() );
745 }
746 else
747 {
748 // Graphic items (PCB_SHAPE, TEXT) having no net have the NonConductor attribute
749 // Graphic items having a net have the Conductor attribute, but are not (yet?)
750 // supported in Pcbnew
752 }
753 }
754
755 if( lineStyle <= LINE_STYLE::FIRST_TYPE )
756 {
757 switch( aShape->GetShape() )
758 {
759 case SHAPE_T::SEGMENT:
760 m_plotter->ThickSegment( aShape->GetStart(), aShape->GetEnd(), thickness, GetPlotMode(),
761 &gbr_metadata );
762 break;
763
764 case SHAPE_T::CIRCLE:
765 if( aShape->IsFilled() )
766 {
767 m_plotter->FilledCircle( aShape->GetStart(), aShape->GetRadius() * 2 + thickness,
768 GetPlotMode(), &gbr_metadata );
769 }
770 else
771 {
772 m_plotter->ThickCircle( aShape->GetStart(), aShape->GetRadius() * 2, thickness,
773 GetPlotMode(), &gbr_metadata );
774 }
775
776 break;
777
778 case SHAPE_T::ARC:
779 {
780 // when startAngle == endAngle ThickArc() doesn't know whether it's 0 deg and 360 deg
781 // but it is a circle
782 if( std::abs( aShape->GetArcAngle().AsDegrees() ) == 360.0 )
783 {
784 m_plotter->ThickCircle( aShape->GetCenter(), aShape->GetRadius() * 2, thickness,
785 GetPlotMode(), &gbr_metadata );
786 }
787 else
788 {
789 m_plotter->ThickArc( *aShape, GetPlotMode(), &gbr_metadata );
790 }
791
792 break;
793 }
794
795 case SHAPE_T::BEZIER:
796 m_plotter->BezierCurve( aShape->GetStart(), aShape->GetBezierC1(),
797 aShape->GetBezierC2(), aShape->GetEnd(), 0, thickness );
798 break;
799
800 case SHAPE_T::POLY:
801 if( aShape->IsPolyShapeValid() )
802 {
803 if( sketch )
804 {
805 for( auto it = aShape->GetPolyShape().CIterateSegments( 0 ); it; it++ )
806 {
807 auto seg = it.Get();
808 m_plotter->ThickSegment( seg.A, seg.B, thickness, GetPlotMode(),
809 &gbr_metadata );
810 }
811 }
812 else
813 {
814 m_plotter->SetCurrentLineWidth( thickness, &gbr_metadata );
815
816 // Draw the polygon: only one polygon is expected
817 // However we provide a multi polygon shape drawing
818 // ( for the future or to show a non expected shape )
819 // This must be simplified and fractured to prevent overlapping polygons
820 // from generating invalid Gerber files
823 FILL_T fill = aShape->IsFilled() ? FILL_T::FILLED_SHAPE : FILL_T::NO_FILL;
824
825 for( int jj = 0; jj < tmpPoly.OutlineCount(); ++jj )
826 {
827 SHAPE_LINE_CHAIN& poly = tmpPoly.Outline( jj );
828
829 // Ensure the polygon is closed:
830 poly.SetClosed( true );
831
832 // Plot the current filled area
833 // (as region for Gerber plotter to manage attributes)
834 if( m_plotter->GetPlotterType() == PLOT_FORMAT::GERBER )
835 {
836 static_cast<GERBER_PLOTTER*>( m_plotter )->
837 PlotPolyAsRegion( poly, fill, thickness, &gbr_metadata );
838 }
839 else
840 {
841 m_plotter->PlotPoly( poly, fill, thickness, &gbr_metadata );
842 }
843 }
844 }
845 }
846
847 break;
848
849 case SHAPE_T::RECTANGLE:
850 {
851 std::vector<VECTOR2I> pts = aShape->GetRectCorners();
852
853 if( sketch )
854 {
855 m_plotter->ThickSegment( pts[0], pts[1], thickness, GetPlotMode(), &gbr_metadata );
856 m_plotter->ThickSegment( pts[1], pts[2], thickness, GetPlotMode(), &gbr_metadata );
857 m_plotter->ThickSegment( pts[2], pts[3], thickness, GetPlotMode(), &gbr_metadata );
858 m_plotter->ThickSegment( pts[3], pts[0], thickness, GetPlotMode(), &gbr_metadata );
859 }
860
861 if( !sketch )
862 {
863 SHAPE_LINE_CHAIN poly;
864
865 for( const VECTOR2I& pt : pts )
866 poly.Append( pt );
867
868 poly.Append( pts[0] ); // Close polygon.
869
870 FILL_T fill_mode = aShape->IsFilled() ? FILL_T::FILLED_SHAPE : FILL_T::NO_FILL;
871
872 if( m_plotter->GetPlotterType() == PLOT_FORMAT::GERBER )
873 {
874 static_cast<GERBER_PLOTTER*>( m_plotter )->
875 PlotPolyAsRegion( poly, fill_mode, thickness, &gbr_metadata );
876 }
877 else
878 {
879 m_plotter->PlotPoly( poly, fill_mode, thickness, &gbr_metadata );
880 }
881 }
882
883 break;
884 }
885
886 default:
888 }
889 }
890 else
891 {
892 std::vector<SHAPE*> shapes = aShape->MakeEffectiveShapes( true );
893
894 for( SHAPE* shape : shapes )
895 {
896 STROKE_PARAMS::Stroke( shape, lineStyle, thickness, m_plotter->RenderSettings(),
897 [&]( const VECTOR2I& a, const VECTOR2I& b )
898 {
899 m_plotter->ThickSegment( a, b, thickness, GetPlotMode(),
900 &gbr_metadata );
901 } );
902 }
903
904 for( SHAPE* shape : shapes )
905 delete shape;
906 }
907}
908
909
911{
912 VECTOR2I pos = aTable->GetPosition();
913 VECTOR2I end = aTable->GetEnd();
914 int lineWidth;
915 LINE_STYLE lineStyle;
916 GBR_METADATA gbr_metadata;
917
918 if( const FOOTPRINT* parentFP = aTable->GetParentFootprint() )
919 {
920 gbr_metadata.SetCmpReference( parentFP->GetReference() );
922 }
923
924 auto setupStroke =
925 [&]( const STROKE_PARAMS& stroke )
926 {
927 lineWidth = stroke.GetWidth();
928 lineStyle = stroke.GetLineStyle();
929 };
930
931 auto strokeShape =
932 [&]( const SHAPE& shape )
933 {
934 STROKE_PARAMS::Stroke( &shape, lineStyle, lineWidth, m_plotter->RenderSettings(),
935 [&]( const VECTOR2I& a, const VECTOR2I& b )
936 {
937 m_plotter->ThickSegment( a, b, lineWidth, GetPlotMode(),
938 &gbr_metadata );
939 } );
940 };
941
942 auto strokeLine =
943 [&]( const VECTOR2I& ptA, const VECTOR2I& ptB )
944 {
945 if( lineStyle <= LINE_STYLE::FIRST_TYPE )
946 {
947 m_plotter->ThickSegment( ptA, ptB, lineWidth, GetPlotMode(), &gbr_metadata );
948 }
949 else
950 {
951 SHAPE_SEGMENT seg( ptA, ptB );
952 strokeShape( seg );
953 }
954 };
955
956 auto strokeRect =
957 [&]( const VECTOR2I& ptA, const VECTOR2I& ptB )
958 {
959 strokeLine( VECTOR2I( ptA.x, ptA.y ), VECTOR2I( ptB.x, ptA.y ) );
960 strokeLine( VECTOR2I( ptB.x, ptA.y ), VECTOR2I( ptB.x, ptB.y ) );
961 strokeLine( VECTOR2I( ptB.x, ptB.y ), VECTOR2I( ptA.x, ptB.y ) );
962 strokeLine( VECTOR2I( ptA.x, ptB.y ), VECTOR2I( ptA.x, ptA.y ) );
963 };
964
965 if( aTable->GetSeparatorsStroke().GetWidth() >= 0 )
966 {
967 setupStroke( aTable->GetSeparatorsStroke() );
968
969 if( aTable->StrokeColumns() )
970 {
971 for( int col = 0; col < aTable->GetColCount() - 1; ++col )
972 {
973 for( int row = 0; row < aTable->GetRowCount(); ++row )
974 {
975 PCB_TABLECELL* cell = aTable->GetCell( row, col );
976 VECTOR2I topRight( cell->GetEndX(), cell->GetStartY() );
977
978 if( cell->GetColSpan() > 0 && cell->GetRowSpan() > 0 )
979 strokeLine( topRight, cell->GetEnd() );
980 }
981 }
982 }
983
984 if( aTable->StrokeRows() )
985 {
986 for( int row = 0; row < aTable->GetRowCount() - 1; ++row )
987 {
988 for( int col = 0; col < aTable->GetColCount(); ++col )
989 {
990 PCB_TABLECELL* cell = aTable->GetCell( row, col );
991 VECTOR2I botLeft( cell->GetStartX(), cell->GetEndY() );
992
993 if( cell->GetColSpan() > 0 && cell->GetRowSpan() > 0 )
994 strokeLine( botLeft, cell->GetEnd() );
995 }
996 }
997 }
998 }
999
1000 if( aTable->GetBorderStroke().GetWidth() >= 0 )
1001 {
1002 setupStroke( aTable->GetBorderStroke() );
1003
1004 if( aTable->StrokeHeader() )
1005 {
1006 PCB_TABLECELL* cell = aTable->GetCell( 0, 0 );
1007 strokeLine( VECTOR2I( pos.x, cell->GetEndY() ), VECTOR2I( end.x, cell->GetEndY() ) );
1008 }
1009
1010 if( aTable->StrokeExternal() )
1011 strokeRect( pos, end );
1012 }
1013}
1014
1015
1017 const VECTOR2I& aDrillSize, const VECTOR2I& aPadSize,
1018 const EDA_ANGLE& aOrientation, int aSmallDrill )
1019{
1020 VECTOR2I drillSize = aDrillSize;
1021
1022 // Small drill marks have no significance when applied to slots
1023 if( aSmallDrill && aDrillShape == PAD_DRILL_SHAPE_CIRCLE )
1024 drillSize.x = std::min( aSmallDrill, drillSize.x );
1025
1026 // Round holes only have x diameter, slots have both
1027 drillSize.x -= getFineWidthAdj();
1028 drillSize.x = Clamp( 1, drillSize.x, aPadSize.x - 1 );
1029
1030 if( aDrillShape == PAD_DRILL_SHAPE_OBLONG )
1031 {
1032 drillSize.y -= getFineWidthAdj();
1033 drillSize.y = Clamp( 1, drillSize.y, aPadSize.y - 1 );
1034
1035 m_plotter->FlashPadOval( aDrillPos, drillSize, aOrientation, GetPlotMode(), nullptr );
1036 }
1037 else
1038 {
1039 m_plotter->FlashPadCircle( aDrillPos, drillSize.x, GetPlotMode(), nullptr );
1040 }
1041}
1042
1043
1045{
1046 /* If small drills marks were requested prepare a clamp value to pass
1047 to the helper function */
1048 int smallDrill = GetDrillMarksType() == DRILL_MARKS::SMALL_DRILL_SHAPE
1049 ? pcbIUScale.mmToIU( ADVANCED_CFG::GetCfg().m_SmallDrillMarkSize ) : 0;
1050
1051 /* In the filled trace mode drill marks are drawn white-on-black to scrape
1052 the underlying pad. This works only for drivers supporting color change,
1053 obviously... it means that:
1054 - PS, SVG and PDF output is correct (i.e. you have a 'donut' pad)
1055 - In HPGL you can't see them
1056 - In gerbers you can't see them, too. This is arguably the right thing to
1057 do since having drill marks and high speed drill stations is a sure
1058 recipe for broken tools and angry manufacturers. If you *really* want them
1059 you could start a layer with negative polarity to scrape the film.
1060 - In DXF they go into the 'WHITE' layer. This could be useful.
1061 */
1062 if( GetPlotMode() == FILLED )
1064
1065 for( PCB_TRACK* track : m_board->Tracks() )
1066 {
1067 if( track->Type() == PCB_VIA_T )
1068 {
1069 const PCB_VIA* via = static_cast<const PCB_VIA*>( track );
1070
1071 // Via are not always on all layers
1072 if( ( via->GetLayerSet() & m_layerMask ).none() )
1073 continue;
1074
1076 VECTOR2I( via->GetDrillValue(), 0 ), VECTOR2I( via->GetWidth(), 0 ),
1077 ANGLE_0, smallDrill );
1078 }
1079 }
1080
1081 for( FOOTPRINT* footprint : m_board->Footprints() )
1082 {
1083 for( PAD* pad : footprint->Pads() )
1084 {
1085 if( pad->GetDrillSize().x == 0 )
1086 continue;
1087
1088 plotOneDrillMark( pad->GetDrillShape(), pad->GetPosition(), pad->GetDrillSize(),
1089 pad->GetSize(), pad->GetOrientation(), smallDrill );
1090 }
1091 }
1092
1093 if( GetPlotMode() == FILLED )
1095}
int color
Definition: DXF_plotter.cpp:58
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:108
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:77
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:226
virtual bool IsKnockout() const
Definition: board_item.h:296
FOOTPRINT * GetParentFootprint() const
Definition: board_item.cpp:248
const KIFONT::METRICS & GetFontMetrics() const
Definition: board_item.cpp:97
const FOOTPRINTS & Footprints() const
Definition: board.h:323
const TRACKS & Tracks() const
Definition: board.h:321
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:797
void PlotDrillMarks()
Draw a drill mark for pads and vias.
void PlotZone(const ZONE *aZone, PCB_LAYER_ID aLayer, const SHAPE_POLY_SET &aPolysList)
LSET m_layerMask
Definition: pcbplot.h:140
void PlotBoardGraphicItem(const BOARD_ITEM *item)
Plot items like text and graphics but not tracks and footprints.
void plotOneDrillMark(PAD_DRILL_SHAPE_T aDrillShape, const VECTOR2I &aDrillPos, const VECTOR2I &aDrillSize, const VECTOR2I &aPadSize, const EDA_ANGLE &aOrientation, int aSmallDrill)
Helper function to plot a single drill mark.
void PlotDimension(const PCB_DIMENSION_BASE *aDim)
void PlotPad(const PAD *aPad, const COLOR4D &aColor, OUTLINE_MODE aPlotMode)
Plot a pad.
BOARD * m_board
Definition: pcbplot.h:139
void PlotShape(const PCB_SHAPE *aShape)
PLOTTER * m_plotter
Definition: pcbplot.h:138
COLOR4D getColor(int aLayer) const
White color is special because it cannot be seen on a white paper in B&W mode.
void PlotPcbTarget(const PCB_TARGET *aMire)
void PlotTableBorders(const PCB_TABLE *aTable)
void PlotFootprintTextItems(const FOOTPRINT *aFootprint)
int getFineWidthAdj() const
Definition: pcbplot.h:76
void PlotText(const EDA_TEXT *aText, PCB_LAYER_ID aLayer, bool aIsKnockout, const KIFONT::METRICS &aFontMetrics)
void PlotFootprintGraphicItems(const FOOTPRINT *aFootprint)
COLOR4D GetColor(int aLayer) const
double AsDegrees() const
Definition: eda_angle.h:155
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:100
EDA_ANGLE GetArcAngle() const
Definition: eda_shape.cpp:663
const VECTOR2I & GetBezierC2() const
Definition: eda_shape.h:189
int GetStartY() const
Definition: eda_shape.h:126
int GetEndX() const
Definition: eda_shape.h:152
virtual std::vector< SHAPE * > MakeEffectiveShapes(bool aEdgeOnly=false) const
Make a set of SHAPE objects representing the EDA_SHAPE.
Definition: eda_shape.h:304
SHAPE_POLY_SET & GetPolyShape()
Definition: eda_shape.h:262
bool IsFilled() const
Definition: eda_shape.h:91
void SetFilled(bool aFlag)
Definition: eda_shape.h:96
int GetRadius() const
Definition: eda_shape.cpp:593
SHAPE_T GetShape() const
Definition: eda_shape.h:120
int GetEndY() const
Definition: eda_shape.h:151
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
Definition: eda_shape.h:150
void SetStart(const VECTOR2I &aStart)
Definition: eda_shape.h:129
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
Definition: eda_shape.h:125
void SetShape(SHAPE_T aShape)
Definition: eda_shape.h:119
std::vector< VECTOR2I > GetRectCorners() const
Definition: eda_shape.cpp:1139
void SetEnd(const VECTOR2I &aEnd)
Definition: eda_shape.h:154
wxString SHAPE_T_asString() const
Definition: eda_shape.cpp:89
int GetStartX() const
Definition: eda_shape.h:127
const VECTOR2I & GetBezierC1() const
Definition: eda_shape.h:186
bool IsPolyShapeValid() const
Definition: eda_shape.cpp:1324
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:83
const VECTOR2I & GetTextPos() const
Definition: eda_text.h:234
bool IsItalic() const
Definition: eda_text.h:144
bool IsMultilineAllowed() const
Definition: eda_text.h:161
virtual bool IsVisible() const
Definition: eda_text.h:151
KIFONT::FONT * GetFont() const
Definition: eda_text.h:211
virtual EDA_ANGLE GetDrawRotation() const
Definition: eda_text.h:340
void GetLinePositions(std::vector< VECTOR2I > &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:748
const TEXT_ATTRIBUTES & GetAttributes() const
Definition: eda_text.h:195
int GetEffectiveTextPenWidth(int aDefaultPenWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultPenWidth.
Definition: eda_text.cpp:322
bool IsBold() const
Definition: eda_text.h:148
virtual wxString GetShownText(bool aAllowExtraText, int aDepth=0) const
Return the string actually shown after processing of the base text.
Definition: eda_text.h:109
PCB_FIELD & Value()
read/write accessors:
Definition: footprint.h:624
LSET GetPrivateLayers() const
Definition: footprint.h:128
PCB_FIELD & Reference()
Definition: footprint.h:625
PCB_FIELDS & Fields()
Definition: footprint.h:188
const wxString & GetReference() const
Definition: footprint.h:588
DRAWINGS & GraphicalItems()
Definition: footprint.h:194
@ GBR_APERTURE_ATTRIB_ETCHEDCMP
aperture used for etched components.
Definition: gbr_metadata.h:94
@ GBR_APERTURE_ATTRIB_BGAPAD_CUDEF
aperture used for edge connector pad (outer layers).
Definition: gbr_metadata.h:117
@ GBR_APERTURE_ATTRIB_HEATSINKPAD
aperture used for castellated pads in copper layer files.
Definition: gbr_metadata.h:131
@ GBR_APERTURE_ATTRIB_TESTPOINT
aperture used for test point pad (outer layers).
Definition: gbr_metadata.h:122
@ GBR_APERTURE_ATTRIB_SMDPAD_CUDEF
aperture used for BGA pads with a solder mask defined by the copper shape.
Definition: gbr_metadata.h:111
@ GBR_APERTURE_ATTRIB_WASHERPAD
aperture used for mechanical pads (NPTH).
Definition: gbr_metadata.h:121
@ GBR_APERTURE_ATTRIB_COMPONENTPAD
aperture used for SMD pad. Excluded BGA pads which have their own type.
Definition: gbr_metadata.h:105
@ GBR_APERTURE_ATTRIB_FIDUCIAL_GLBL
aperture used for fiducial pad (outer layers), at footprint level.
Definition: gbr_metadata.h:125
@ GBR_APERTURE_ATTRIB_CASTELLATEDPAD
aperture used for castellated pads in drill files.
Definition: gbr_metadata.h:134
@ GBR_APERTURE_ATTRIB_FIDUCIAL_LOCAL
aperture used for heat sink pad (typically for SMDs).
Definition: gbr_metadata.h:128
@ GBR_APERTURE_ATTRIB_EDGECUT
aperture used for board cutout,
Definition: gbr_metadata.h:98
Metadata which can be added in a gerber file as attribute in X2 format.
Definition: gbr_metadata.h:205
void SetCopper(bool aValue)
Definition: gbr_metadata.h:252
void SetCmpReference(const wxString &aComponentRef)
Definition: gbr_metadata.h:241
void SetNetName(const wxString &aNetname)
Definition: gbr_metadata.h:229
void SetPadPinFunction(const wxString &aPadPinFunction, bool aUseUTF8, bool aEscapeString)
Definition: gbr_metadata.h:236
void SetApertureAttrib(GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB aApertAttribute)
Definition: gbr_metadata.h:209
GBR_NETLIST_METADATA m_NetlistMetadata
An item to handle object attribute.
Definition: gbr_metadata.h:262
void SetNetAttribType(int aNetAttribType)
Definition: gbr_metadata.h:219
void SetPadName(const wxString &aPadname, bool aUseUTF8=false, bool aEscapeString=false)
Definition: gbr_metadata.h:231
@ GBR_NETINFO_NET
print info associated to a net (TO.N attribute)
@ GBR_NETINFO_CMP
print info associated to a component (TO.C attribute)
bool m_NotInNet
true if a pad of a footprint cannot be connected (for instance a mechanical NPTH, ot a not named pad)...
void FlashPadChamferRoundRect(const VECTOR2I &aShapePos, const VECTOR2I &aPadSize, int aCornerRadius, double aChamferRatio, int aChamferPositions, const EDA_ANGLE &aPadOrient, OUTLINE_MODE aPlotMode, void *aData)
Flash a chamfered round rect pad.
FONT is an abstract base class for both outline and stroke fonts.
Definition: font.h:131
static FONT * GetFont(const wxString &aFontName=wxEmptyString, bool aBold=false, bool aItalic=false)
Definition: font.cpp:146
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
const wxString & GetDefaultFont() const
static LSET ExternalCuMask()
Return a mask holding the Front and Bottom layers.
Definition: lset.cpp:891
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:863
Definition: pad.h:59
PAD_PROP GetProperty() const
Definition: pad.h:380
PAD_ATTRIB GetAttribute() const
Definition: pad.h:377
const wxString & GetPinFunction() const
Definition: pad.h:145
const wxString & GetNumber() const
Definition: pad.h:134
int GetRoundRectCornerRadius() const
Definition: pad.cpp:483
VECTOR2I ShapePos() const
Definition: pad.cpp:944
const std::shared_ptr< SHAPE_POLY_SET > & GetEffectivePolygon(ERROR_LOC aErrorLoc=ERROR_INSIDE) const
Definition: pad.cpp:514
const VECTOR2I & GetDelta() const
Definition: pad.h:254
PAD_SHAPE GetShape() const
Definition: pad.h:193
EDA_ANGLE GetOrientation() const
Return the rotation angle of the pad.
Definition: pad.h:345
int GetChamferPositions() const
Definition: pad.h:585
const VECTOR2I & GetSize() const
Definition: pad.h:247
double GetChamferRectRatio() const
Definition: pad.h:575
Abstract dimension API.
int GetLineThickness() const
const std::vector< std::shared_ptr< SHAPE > > & GetShapes() const
bool GetPlotInvisibleText() const
PLOT_TEXT_MODE GetTextMode() const
bool GetPlotReference() const
int GetSketchPadLineWidth() const
DRILL_MARKS GetDrillMarksType() const
bool GetPlotValue() const
bool GetPlotFPText() const
OUTLINE_MODE GetPlotMode() const
COLOR_SETTINGS * ColorSettings() const
VECTOR2I GetCenter() const override
This defaults to the center of the bounding box if not overridden.
Definition: pcb_shape.h:75
int GetWidth() const override
Definition: pcb_shape.cpp:367
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
Definition: pcb_shape.cpp:315
STROKE_PARAMS GetStroke() const override
Definition: pcb_shape.h:85
void SetStroke(const STROKE_PARAMS &aStroke) override
Definition: pcb_shape.h:86
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: pcb_shape.h:70
int GetRowSpan() const
Definition: pcb_tablecell.h:65
int GetColSpan() const
Definition: pcb_tablecell.h:62
VECTOR2I GetEnd() const
Definition: pcb_table.cpp:115
bool StrokeRows() const
Definition: pcb_table.h:86
int GetRowCount() const
Definition: pcb_table.h:103
bool StrokeColumns() const
Definition: pcb_table.h:83
bool StrokeExternal() const
Definition: pcb_table.h:53
bool StrokeHeader() const
Definition: pcb_table.h:56
PCB_TABLECELL * GetCell(int aRow, int aCol) const
Definition: pcb_table.h:128
std::vector< PCB_TABLECELL * > GetCells() const
Definition: pcb_table.h:138
int GetColCount() const
Definition: pcb_table.h:101
const STROKE_PARAMS & GetSeparatorsStroke() const
Definition: pcb_table.h:71
const STROKE_PARAMS & GetBorderStroke() const
Definition: pcb_table.h:59
VECTOR2I GetPosition() const override
Definition: pcb_table.cpp:109
int GetShape() const
Definition: pcb_target.h:58
int GetWidth() const
Definition: pcb_target.h:64
int GetSize() const
Definition: pcb_target.h:61
VECTOR2I GetPosition() const override
Definition: pcb_target.h:55
bool IsBorderEnabled() const
Disables the border, this is done by changing the stroke internally.
virtual void ThickSegment(const VECTOR2I &start, const VECTOR2I &end, int width, OUTLINE_MODE tracemode, void *aData)
Definition: plotter.cpp:554
virtual void ThickCircle(const VECTOR2I &pos, int diametre, int width, OUTLINE_MODE tracemode, void *aData)
Definition: plotter.cpp:646
virtual void FlashPadCustom(const VECTOR2I &aPadPos, const VECTOR2I &aSize, const EDA_ANGLE &aPadOrient, SHAPE_POLY_SET *aPolygons, OUTLINE_MODE aTraceMode, void *aData)=0
virtual void FilledCircle(const VECTOR2I &pos, int diametre, OUTLINE_MODE tracemode, void *aData)
Definition: plotter.cpp:662
virtual void BezierCurve(const VECTOR2I &aStart, const VECTOR2I &aControl1, const VECTOR2I &aControl2, const VECTOR2I &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:229
RENDER_SETTINGS * RenderSettings()
Definition: plotter.h:135
virtual PLOT_FORMAT GetPlotterType() const =0
Returns the effective plot engine in use.
virtual void SetTextMode(PLOT_TEXT_MODE mode)
Change the current text mode.
Definition: plotter.h:513
virtual void FlashPadCircle(const VECTOR2I &aPadPos, int aDiameter, OUTLINE_MODE aTraceMode, void *aData)=0
virtual void ThickArc(const EDA_SHAPE &aArcShape, OUTLINE_MODE aTraceMode, void *aData)
Definition: plotter.cpp:597
virtual void SetCurrentLineWidth(int width, void *aData=nullptr)=0
Set the line width for the next drawing.
virtual void StartBlock(void *aData)
calling this function allows one to define the beginning of a group of drawing items,...
Definition: plotter.h:536
virtual void PlotPoly(const std::vector< VECTOR2I > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=nullptr)=0
Draw a polygon ( filled or not ).
virtual void FlashPadOval(const VECTOR2I &aPadPos, const VECTOR2I &aSize, const EDA_ANGLE &aPadOrient, OUTLINE_MODE aTraceMode, void *aData)=0
virtual void FlashPadTrapez(const VECTOR2I &aPadPos, const VECTOR2I *aCorners, const EDA_ANGLE &aPadOrient, OUTLINE_MODE aTraceMode, void *aData)=0
Flash a trapezoidal pad.
virtual void PlotText(const VECTOR2I &aPos, const COLOR4D &aColor, const wxString &aText, const TEXT_ATTRIBUTES &aAttributes, KIFONT::FONT *aFont, const KIFONT::METRICS &aFontMetrics, void *aData=nullptr)
Definition: plotter.cpp:753
virtual void FlashPadRoundRect(const VECTOR2I &aPadPos, const VECTOR2I &aSize, int aCornerRadius, const EDA_ANGLE &aOrient, OUTLINE_MODE aTraceMode, void *aData)=0
virtual void FlashPadRect(const VECTOR2I &aPadPos, const VECTOR2I &aSize, const EDA_ANGLE &aPadOrient, OUTLINE_MODE aTraceMode, void *aData)=0
virtual void SetColor(const COLOR4D &color)=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:545
Definition: seg.h:42
VECTOR2I A
Definition: seg.h:49
VECTOR2I B
Definition: seg.h:50
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
void SetClosed(bool aClosed)
Mark the line chain as closed (i.e.
void Append(int aX, int aY, bool aAllowDuplication=false)
Append a new point at the end of the line chain.
Represent a set of closed polygons.
void Fracture(POLYGON_MODE aFastMode)
Convert a set of polygons with holes to a single outline with "slits"/"fractures" connecting the oute...
bool IsEmpty() const
Return true if the set is empty (no polygons at all)
SHAPE_LINE_CHAIN & Outline(int aIndex)
Return the reference to aIndex-th outline in the set.
CONST_SEGMENT_ITERATOR CIterateSegments(int aFirst, int aLast, bool aIterateHoles=false) const
Return an iterator object, for iterating between aFirst and aLast outline, with or without holes (def...
int OutlineCount() const
Return the number of outlines in the set.
SHAPE_POLY_SET CloneDropTriangulation() const
An abstract shape on 2D plane.
Definition: shape.h:126
Simple container to manage line stroke parameters.
Definition: stroke_params.h:81
int GetWidth() const
Definition: stroke_params.h:91
LINE_STYLE GetLineStyle() const
Definition: stroke_params.h:94
static void Stroke(const SHAPE *aShape, LINE_STYLE aLineStyle, int aWidth, const KIGFX::RENDER_SETTINGS *aRenderSettings, const std::function< void(const VECTOR2I &a, const VECTOR2I &b)> &aStroker)
Handle a list of polygons defining a copper zone.
Definition: zone.h:72
bool IsOnCopperLayer() const override
Definition: zone.cpp:255
@ WHITE
Definition: color4d.h:48
@ LIGHTGRAY
Definition: color4d.h:47
@ BLACK
Definition: color4d.h:44
static constexpr EDA_ANGLE ANGLE_0
Definition: eda_angle.h:435
FILL_T
Definition: eda_shape.h:55
Handle special data (items attributes) during plot.
#define GBR_NETINFO_ALL
@ ERROR_INSIDE
static const bool FILLED
Definition: gr_basic.cpp:30
bool IsCopperLayer(int aLayerId)
Tests whether a layer is a copper layer.
Definition: layer_ids.h:881
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:60
@ Edge_Cuts
Definition: layer_ids.h:113
@ PCB_LAYER_ID_COUNT
Definition: layer_ids.h:137
This file contains miscellaneous commonly used macros and functions.
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
Definition: macros.h:83
#define UNIMPLEMENTED_FOR(type)
Definition: macros.h:96
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Definition: eda_angle.h:424
OUTLINE_MODE
Definition: outline_mode.h:25
@ SKETCH
Definition: outline_mode.h:26
PAD_DRILL_SHAPE_T
The set of pad drill shapes, used with PAD::{Set,Get}DrillShape()
Definition: pad_shapes.h:53
@ PAD_DRILL_SHAPE_CIRCLE
Definition: pad_shapes.h:54
@ PAD_DRILL_SHAPE_OBLONG
Definition: pad_shapes.h:55
@ SH_CIRCLE
circle
Definition: shape.h:50
@ SH_SEGMENT
line segment
Definition: shape.h:48
void wxStringSplit(const wxString &aText, wxArrayString &aStrings, wxChar aSplitter)
Split aString to a string list separated at aSplitter.
LINE_STYLE
Dashed line types.
Definition: stroke_params.h:48
constexpr int mmToIU(double mm) const
Definition: base_units.h:88
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:88
@ PCB_DIM_ORTHOGONAL_T
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
Definition: typeinfo.h:105
@ PCB_DIM_LEADER_T
class PCB_DIM_LEADER, a leader dimension (graphic item)
Definition: typeinfo.h:102
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
@ PCB_DIM_CENTER_T
class PCB_DIM_CENTER, a center point marking (graphic item)
Definition: typeinfo.h:103
@ PCB_TEXTBOX_T
class PCB_TEXTBOX, wrapped text on a layer
Definition: typeinfo.h:93
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
Definition: typeinfo.h:92
@ PCB_TARGET_T
class PCB_TARGET, a target (graphic item)
Definition: typeinfo.h:106
@ PCB_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
Definition: typeinfo.h:101
@ PCB_TABLE_T
class PCB_TABLE, table of PCB_TABLECELLs
Definition: typeinfo.h:94
@ PCB_DIM_RADIAL_T
class PCB_DIM_RADIAL, a radius or diameter dimension
Definition: typeinfo.h:104
constexpr T Clamp(const T &lower, const T &value, const T &upper)
Limit value within the range lower <= value <= upper.
Definition: util.h:64
VECTOR2< int > VECTOR2I
Definition: vector2d.h:588