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 case PAD_PROP::MECHANICAL:
188 break;
189 }
190
191 // Ensure NPTH pads have *always* the GBR_APERTURE_ATTRIB_WASHERPAD attribute
192 if( aPad->GetAttribute() == PAD_ATTRIB::NPTH )
194 }
195 else
196 {
198 }
199
200 // Set plot color (change WHITE to LIGHTGRAY because
201 // the white items are not seen on a white paper or screen
202 m_plotter->SetColor( aColor != WHITE ? aColor : LIGHTGRAY);
203
204 if( aPlotMode == SKETCH )
206
207 switch( aPad->GetShape() )
208 {
209 case PAD_SHAPE::CIRCLE:
210 m_plotter->FlashPadCircle( shape_pos, aPad->GetSize().x, aPlotMode, &metadata );
211 break;
212
213 case PAD_SHAPE::OVAL:
214 m_plotter->FlashPadOval( shape_pos, aPad->GetSize(), aPad->GetOrientation(), aPlotMode,
215 &metadata );
216 break;
217
218 case PAD_SHAPE::RECTANGLE:
219 m_plotter->FlashPadRect( shape_pos, aPad->GetSize(), aPad->GetOrientation(), aPlotMode,
220 &metadata );
221 break;
222
223 case PAD_SHAPE::ROUNDRECT:
224 m_plotter->FlashPadRoundRect( shape_pos, aPad->GetSize(), aPad->GetRoundRectCornerRadius(),
225 aPad->GetOrientation(), aPlotMode, &metadata );
226 break;
227
228 case PAD_SHAPE::TRAPEZOID:
229 {
230 // Build the pad polygon in coordinates relative to the pad
231 // (i.e. for a pad at pos 0,0, rot 0.0). Needed to use aperture macros,
232 // to be able to create a pattern common to all trapezoid pads having the same shape
233 VECTOR2I coord[4];
234
235 // Order is lower left, lower right, upper right, upper left.
236 VECTOR2I half_size = aPad->GetSize() / 2;
237 VECTOR2I trap_delta = aPad->GetDelta() / 2;
238
239 coord[0] = VECTOR2I( -half_size.x - trap_delta.y, half_size.y + trap_delta.x );
240 coord[1] = VECTOR2I( half_size.x + trap_delta.y, half_size.y - trap_delta.x );
241 coord[2] = VECTOR2I( half_size.x - trap_delta.y, -half_size.y + trap_delta.x );
242 coord[3] = VECTOR2I( -half_size.x + trap_delta.y, -half_size.y - trap_delta.x );
243
244 m_plotter->FlashPadTrapez( shape_pos, coord, aPad->GetOrientation(), aPlotMode, &metadata );
245 }
246 break;
247
248 case PAD_SHAPE::CHAMFERED_RECT:
249 if( m_plotter->GetPlotterType() == PLOT_FORMAT::GERBER )
250 {
251 GERBER_PLOTTER* gerberPlotter = static_cast<GERBER_PLOTTER*>( m_plotter );
252
253 gerberPlotter->FlashPadChamferRoundRect( shape_pos, aPad->GetSize(),
255 aPad->GetChamferRectRatio(),
256 aPad->GetChamferPositions(),
257 aPad->GetOrientation(), aPlotMode, &metadata );
258 break;
259 }
260
262
263 default:
264 case PAD_SHAPE::CUSTOM:
265 {
266 const std::shared_ptr<SHAPE_POLY_SET>& polygons = aPad->GetEffectivePolygon( ERROR_INSIDE );
267
268 if( polygons->OutlineCount() )
269 {
270 m_plotter->FlashPadCustom( shape_pos, aPad->GetSize(), aPad->GetOrientation(),
271 polygons.get(), aPlotMode, &metadata );
272 }
273 }
274 break;
275 }
276}
277
278
280{
281 if( !GetPlotFPText() )
282 return;
283
284 const PCB_TEXT* textItem = &aFootprint->Reference();
285 PCB_LAYER_ID textLayer = textItem->GetLayer();
286
287 // Reference and value have special controls for forcing their plotting
288 if( GetPlotReference() && m_layerMask[textLayer]
289 && ( textItem->IsVisible() || GetPlotInvisibleText() ) )
290 {
291 PlotText( textItem, textLayer, textItem->IsKnockout(), textItem->GetFontMetrics() );
292 }
293
294 textItem = &aFootprint->Value();
295 textLayer = textItem->GetLayer();
296
297 if( GetPlotValue() && m_layerMask[textLayer]
298 && ( textItem->IsVisible() || GetPlotInvisibleText() ) )
299 {
300 PlotText( textItem, textLayer, textItem->IsKnockout(), textItem->GetFontMetrics() );
301 }
302
303 std::vector<PCB_TEXT*> texts;
304
305 // Skip the reference and value texts that are handled specially
306 for( PCB_FIELD* field : aFootprint->Fields() )
307 {
308 if( field->IsReference() || field->IsValue() )
309 continue;
310
311 texts.push_back( field );
312 }
313
314 for( BOARD_ITEM* item : aFootprint->GraphicalItems() )
315 {
316 textItem = dynamic_cast<const PCB_TEXT*>( item );
317
318 if( textItem )
319 texts.push_back( static_cast<PCB_TEXT*>( item ) );
320 }
321
322 for( const PCB_TEXT* text : texts )
323 {
324 if( !text->IsVisible() )
325 continue;
326
327 textLayer = text->GetLayer();
328
329 if( textLayer == Edge_Cuts || textLayer >= PCB_LAYER_ID_COUNT )
330 continue;
331
332 if( !m_layerMask[textLayer] || aFootprint->GetPrivateLayers().test( textLayer ) )
333 continue;
334
335 if( text->GetText() == wxT( "${REFERENCE}" ) && !GetPlotReference() )
336 continue;
337
338 if( text->GetText() == wxT( "${VALUE}" ) && !GetPlotValue() )
339 continue;
340
341 PlotText( text, textLayer, text->IsKnockout(), text->GetFontMetrics() );
342 }
343}
344
345
347{
348 switch( item->Type() )
349 {
350 case PCB_SHAPE_T:
351 PlotShape( static_cast<const PCB_SHAPE*>( item ) );
352 break;
353
354 case PCB_TEXT_T:
355 {
356 const PCB_TEXT* text = static_cast<const PCB_TEXT*>( item );
357 PlotText( text, text->GetLayer(), text->IsKnockout(), text->GetFontMetrics() );
358 break;
359 }
360
361 case PCB_TEXTBOX_T:
362 {
363 m_plotter->SetTextMode( PLOT_TEXT_MODE::STROKE );
364
365 const PCB_TEXTBOX* textbox = static_cast<const PCB_TEXTBOX*>( item );
366 PlotText( textbox, textbox->GetLayer(), textbox->IsKnockout(), textbox->GetFontMetrics() );
367
368 if( textbox->IsBorderEnabled() )
369 PlotShape( textbox );
370
372 break;
373 }
374
375 case PCB_TABLE_T:
376 {
377 const PCB_TABLE* table = static_cast<const PCB_TABLE*>( item );
378
379 m_plotter->SetTextMode( PLOT_TEXT_MODE::STROKE );
380
381 for( const PCB_TABLECELL* cell : table->GetCells() )
382 PlotText( cell, cell->GetLayer(), cell->IsKnockout(), cell->GetFontMetrics() );
383
384 PlotTableBorders( table );
385
387 break;
388 }
389
391 case PCB_DIM_CENTER_T:
392 case PCB_DIM_RADIAL_T:
394 case PCB_DIM_LEADER_T:
395 m_plotter->SetTextMode( PLOT_TEXT_MODE::STROKE );
396
397 PlotDimension( static_cast<const PCB_DIMENSION_BASE*>( item ) );
398
400 break;
401
402 case PCB_TARGET_T:
403 PlotPcbTarget( static_cast<const PCB_TARGET*>( item ) );
404 break;
405
406 default:
407 break;
408 }
409}
410
411
413{
414 if( !m_layerMask[aDim->GetLayer()] )
415 return;
416
418
419 // Set plot color (change WHITE to LIGHTGRAY because
420 // the white items are not seen on a white paper or screen
422
423 PlotText( aDim, aDim->GetLayer(), false, aDim->GetFontMetrics() );
424
425 PCB_SHAPE temp_item;
426
427 temp_item.SetStroke( STROKE_PARAMS( aDim->GetLineThickness(), LINE_STYLE::SOLID ) );
428 temp_item.SetLayer( aDim->GetLayer() );
429
430 for( const std::shared_ptr<SHAPE>& shape : aDim->GetShapes() )
431 {
432 switch( shape->Type() )
433 {
434 case SH_SEGMENT:
435 {
436 const SEG& seg = static_cast<const SHAPE_SEGMENT*>( shape.get() )->GetSeg();
437
438 temp_item.SetShape( SHAPE_T::SEGMENT );
439 temp_item.SetStart( seg.A );
440 temp_item.SetEnd( seg.B );
441
442 PlotShape( &temp_item );
443 break;
444 }
445
446 case SH_CIRCLE:
447 {
448 VECTOR2I start( shape->Centre() );
449 int radius = static_cast<const SHAPE_CIRCLE*>( shape.get() )->GetRadius();
450
451 temp_item.SetShape( SHAPE_T::CIRCLE );
452 temp_item.SetFilled( false );
453 temp_item.SetStart( start );
454 temp_item.SetEnd( VECTOR2I( start.x + radius, start.y ) );
455
456 PlotShape( &temp_item );
457 break;
458 }
459
460 default:
461 break;
462 }
463 }
464}
465
466
468{
469 int dx1, dx2, dy1, dy2, radius;
470
471 if( !m_layerMask[aMire->GetLayer()] )
472 return;
473
474 m_plotter->SetColor( getColor( aMire->GetLayer() ) );
475
476 PCB_SHAPE temp_item;
477
478 temp_item.SetShape( SHAPE_T::CIRCLE );
479 temp_item.SetFilled( false );
480 temp_item.SetStroke( STROKE_PARAMS( aMire->GetWidth(), LINE_STYLE::SOLID ) );
481 temp_item.SetLayer( aMire->GetLayer() );
482 temp_item.SetStart( aMire->GetPosition() );
483 radius = aMire->GetSize() / 3;
484
485 if( aMire->GetShape() ) // temp_item X
486 radius = aMire->GetSize() / 2;
487
488 // Draw the circle
489 temp_item.SetEnd( VECTOR2I( temp_item.GetStart().x + radius, temp_item.GetStart().y ) );
490
491 PlotShape( &temp_item );
492
493 temp_item.SetShape( SHAPE_T::SEGMENT );
494
495 radius = aMire->GetSize() / 2;
496 dx1 = radius;
497 dy1 = 0;
498 dx2 = 0;
499 dy2 = radius;
500
501 if( aMire->GetShape() ) // Shape X
502 {
503 dx1 = dy1 = radius;
504 dx2 = dx1;
505 dy2 = -dy1;
506 }
507
508 VECTOR2I mirePos( aMire->GetPosition() );
509
510 // Draw the X or + temp_item:
511 temp_item.SetStart( VECTOR2I( mirePos.x - dx1, mirePos.y - dy1 ) );
512 temp_item.SetEnd( VECTOR2I( mirePos.x + dx1, mirePos.y + dy1 ) );
513 PlotShape( &temp_item );
514
515 temp_item.SetStart( VECTOR2I( mirePos.x - dx2, mirePos.y - dy2 ) );
516 temp_item.SetEnd( VECTOR2I( mirePos.x + dx2, mirePos.y + dy2 ) );
517 PlotShape( &temp_item );
518}
519
520
522{
523 for( const BOARD_ITEM* item : aFootprint->GraphicalItems() )
524 {
525 if( aFootprint->GetPrivateLayers().test( item->GetLayer() ) )
526 continue;
527
528 if( !m_layerMask[ item->GetLayer() ] )
529 continue;
530
531 switch( item->Type() )
532 {
533 case PCB_SHAPE_T:
534 PlotShape( static_cast<const PCB_SHAPE*>( item ) );
535 break;
536
537 case PCB_TEXTBOX_T:
538 {
539 const PCB_TEXTBOX* textbox = static_cast<const PCB_TEXTBOX*>( item );
540
541 m_plotter->SetTextMode( PLOT_TEXT_MODE::STROKE );
542
543 PlotText( textbox, textbox->GetLayer(), textbox->IsKnockout(),
544 textbox->GetFontMetrics() );
545
546 if( textbox->IsBorderEnabled() )
547 PlotShape( textbox );
548
550 break;
551 }
552
554 case PCB_DIM_CENTER_T:
555 case PCB_DIM_RADIAL_T:
557 case PCB_DIM_LEADER_T:
558 PlotDimension( static_cast<const PCB_DIMENSION_BASE*>( item ) );
559 break;
560
561 case PCB_TEXT_T:
562 // Plotted in PlotFootprintTextItems()
563 break;
564
565 default:
566 UNIMPLEMENTED_FOR( item->GetClass() );
567 }
568 }
569}
570
571
572#include <font/stroke_font.h>
573void BRDITEMS_PLOTTER::PlotText( const EDA_TEXT* aText, PCB_LAYER_ID aLayer, bool aIsKnockout,
574 const KIFONT::METRICS& aFontMetrics )
575{
576 KIFONT::FONT* font = aText->GetFont();
577
578 if( !font )
579 {
580 wxString defaultFontName; // empty string is the KiCad stroke font
581
583 defaultFontName = m_plotter->RenderSettings()->GetDefaultFont();
584
585 font = KIFONT::FONT::GetFont( defaultFontName, aText->IsBold(), aText->IsItalic() );
586 }
587
588 wxString shownText( aText->GetShownText( true ) );
589
590 if( shownText.IsEmpty() )
591 return;
592
593 if( !m_layerMask[aLayer] )
594 return;
595
596 GBR_METADATA gbr_metadata;
597
598 if( IsCopperLayer( aLayer ) )
600
601 COLOR4D color = getColor( aLayer );
603
604 VECTOR2I pos = aText->GetTextPos();
605
606 TEXT_ATTRIBUTES attrs = aText->GetAttributes();
608 attrs.m_Angle = aText->GetDrawRotation();
609 attrs.m_Multiline = false;
610
612
613 if( aIsKnockout )
614 {
615 const PCB_TEXT* text = static_cast<const PCB_TEXT*>( aText );
616 SHAPE_POLY_SET finalPoly;
617
618 text->TransformTextToPolySet( finalPoly, 0, m_board->GetDesignSettings().m_MaxError,
619 ERROR_INSIDE );
621
622 for( int ii = 0; ii < finalPoly.OutlineCount(); ++ii )
623 m_plotter->PlotPoly( finalPoly.Outline( ii ), FILL_T::FILLED_SHAPE, 0, &gbr_metadata );
624 }
625 else if( aText->IsMultilineAllowed() )
626 {
627 std::vector<VECTOR2I> positions;
628 wxArrayString strings_list;
629 wxStringSplit( shownText, strings_list, '\n' );
630 positions.reserve( strings_list.Count() );
631
632 aText->GetLinePositions( positions, strings_list.Count() );
633
634 for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
635 {
636 wxString& txt = strings_list.Item( ii );
637 m_plotter->PlotText( positions[ii], color, txt, attrs, font, aFontMetrics, &gbr_metadata );
638 }
639 }
640 else
641 {
642 m_plotter->PlotText( pos, color, shownText, attrs, font, aFontMetrics, &gbr_metadata );
643 }
644}
645
646
648 const SHAPE_POLY_SET& aPolysList )
649{
650 if( aPolysList.IsEmpty() )
651 return;
652
653 GBR_METADATA gbr_metadata;
654
655 if( aZone->IsOnCopperLayer() )
656 {
657 gbr_metadata.SetNetName( aZone->GetNetname() );
658 gbr_metadata.SetCopper( true );
659
660 // Zones with no net name can exist.
661 // they are not used to connect items, so the aperture attribute cannot
662 // be set as conductor
663 if( aZone->GetNetname().IsEmpty() )
664 {
666 }
667 else
668 {
671 }
672 }
673
674 m_plotter->SetColor( getColor( aLayer ) );
675
676 m_plotter->StartBlock( nullptr ); // Clean current object attributes
677
678 /*
679 * In non filled mode the outline is plotted, but not the filling items
680 */
681
682 for( int idx = 0; idx < aPolysList.OutlineCount(); ++idx )
683 {
684 const SHAPE_LINE_CHAIN& outline = aPolysList.Outline( idx );
685
686 // Plot the current filled area (as region for Gerber plotter to manage attributes)
687 if( GetPlotMode() == FILLED )
688 {
689 if( m_plotter->GetPlotterType() == PLOT_FORMAT::GERBER )
690 {
691 static_cast<GERBER_PLOTTER*>( m_plotter )->PlotGerberRegion( outline,
692 &gbr_metadata );
693 }
694 else
695 {
696 m_plotter->PlotPoly( outline, FILL_T::FILLED_SHAPE, 0, &gbr_metadata );
697 }
698 }
699 else
700 {
702 }
703 }
704
705 m_plotter->EndBlock( nullptr ); // Clear object attributes
706}
707
708
710{
711 if( !m_layerMask[aShape->GetLayer()] )
712 return;
713
714 bool sketch = GetPlotMode() == SKETCH;
715 int thickness = aShape->GetWidth();
716 LINE_STYLE lineStyle = aShape->GetStroke().GetLineStyle();
717
718 m_plotter->SetColor( getColor( aShape->GetLayer() ) );
719
720 const FOOTPRINT* parentFP = aShape->GetParentFootprint();
721 GBR_METADATA gbr_metadata;
722
723 if( parentFP )
724 {
725 gbr_metadata.SetCmpReference( parentFP->GetReference() );
727 }
728
729 if( aShape->GetLayer() == Edge_Cuts )
730 {
732 }
733 else if( IsCopperLayer( aShape->GetLayer() ) )
734 {
735 if( parentFP )
736 {
738 gbr_metadata.SetCopper( true );
739 }
740 else if( aShape->GetNetCode() > 0 )
741 {
742 gbr_metadata.SetCopper( true );
745 gbr_metadata.SetNetName( aShape->GetNetname() );
746 }
747 else
748 {
749 // Graphic items (PCB_SHAPE, TEXT) having no net have the NonConductor attribute
750 // Graphic items having a net have the Conductor attribute, but are not (yet?)
751 // supported in Pcbnew
753 }
754 }
755
756 if( lineStyle <= LINE_STYLE::FIRST_TYPE )
757 {
758 switch( aShape->GetShape() )
759 {
760 case SHAPE_T::SEGMENT:
761 m_plotter->ThickSegment( aShape->GetStart(), aShape->GetEnd(), thickness, GetPlotMode(),
762 &gbr_metadata );
763 break;
764
765 case SHAPE_T::CIRCLE:
766 if( aShape->IsFilled() )
767 {
768 m_plotter->FilledCircle( aShape->GetStart(), aShape->GetRadius() * 2 + thickness,
769 GetPlotMode(), &gbr_metadata );
770 }
771 else
772 {
773 m_plotter->ThickCircle( aShape->GetStart(), aShape->GetRadius() * 2, thickness,
774 GetPlotMode(), &gbr_metadata );
775 }
776
777 break;
778
779 case SHAPE_T::ARC:
780 {
781 // when startAngle == endAngle ThickArc() doesn't know whether it's 0 deg and 360 deg
782 // but it is a circle
783 if( std::abs( aShape->GetArcAngle().AsDegrees() ) == 360.0 )
784 {
785 m_plotter->ThickCircle( aShape->GetCenter(), aShape->GetRadius() * 2, thickness,
786 GetPlotMode(), &gbr_metadata );
787 }
788 else
789 {
790 m_plotter->ThickArc( *aShape, GetPlotMode(), &gbr_metadata );
791 }
792
793 break;
794 }
795
796 case SHAPE_T::BEZIER:
797 m_plotter->BezierCurve( aShape->GetStart(), aShape->GetBezierC1(),
798 aShape->GetBezierC2(), aShape->GetEnd(), 0, thickness );
799 break;
800
801 case SHAPE_T::POLY:
802 if( aShape->IsPolyShapeValid() )
803 {
804 if( sketch )
805 {
806 for( auto it = aShape->GetPolyShape().CIterateSegments( 0 ); it; it++ )
807 {
808 auto seg = it.Get();
809 m_plotter->ThickSegment( seg.A, seg.B, thickness, GetPlotMode(),
810 &gbr_metadata );
811 }
812 }
813 else
814 {
815 m_plotter->SetCurrentLineWidth( thickness, &gbr_metadata );
816
817 // Draw the polygon: only one polygon is expected
818 // However we provide a multi polygon shape drawing
819 // ( for the future or to show a non expected shape )
820 // This must be simplified and fractured to prevent overlapping polygons
821 // from generating invalid Gerber files
824 FILL_T fill = aShape->IsFilled() ? FILL_T::FILLED_SHAPE : FILL_T::NO_FILL;
825
826 for( int jj = 0; jj < tmpPoly.OutlineCount(); ++jj )
827 {
828 SHAPE_LINE_CHAIN& poly = tmpPoly.Outline( jj );
829
830 // Ensure the polygon is closed:
831 poly.SetClosed( true );
832
833 // Plot the current filled area
834 // (as region for Gerber plotter to manage attributes)
835 if( m_plotter->GetPlotterType() == PLOT_FORMAT::GERBER )
836 {
837 static_cast<GERBER_PLOTTER*>( m_plotter )->
838 PlotPolyAsRegion( poly, fill, thickness, &gbr_metadata );
839 }
840 else
841 {
842 m_plotter->PlotPoly( poly, fill, thickness, &gbr_metadata );
843 }
844 }
845 }
846 }
847
848 break;
849
850 case SHAPE_T::RECTANGLE:
851 {
852 std::vector<VECTOR2I> pts = aShape->GetRectCorners();
853
854 if( sketch )
855 {
856 m_plotter->ThickSegment( pts[0], pts[1], thickness, GetPlotMode(), &gbr_metadata );
857 m_plotter->ThickSegment( pts[1], pts[2], thickness, GetPlotMode(), &gbr_metadata );
858 m_plotter->ThickSegment( pts[2], pts[3], thickness, GetPlotMode(), &gbr_metadata );
859 m_plotter->ThickSegment( pts[3], pts[0], thickness, GetPlotMode(), &gbr_metadata );
860 }
861
862 if( !sketch )
863 {
864 SHAPE_LINE_CHAIN poly;
865
866 for( const VECTOR2I& pt : pts )
867 poly.Append( pt );
868
869 poly.Append( pts[0] ); // Close polygon.
870
871 FILL_T fill_mode = aShape->IsFilled() ? FILL_T::FILLED_SHAPE : FILL_T::NO_FILL;
872
873 if( m_plotter->GetPlotterType() == PLOT_FORMAT::GERBER )
874 {
875 static_cast<GERBER_PLOTTER*>( m_plotter )->
876 PlotPolyAsRegion( poly, fill_mode, thickness, &gbr_metadata );
877 }
878 else
879 {
880 m_plotter->PlotPoly( poly, fill_mode, thickness, &gbr_metadata );
881 }
882 }
883
884 break;
885 }
886
887 default:
889 }
890 }
891 else
892 {
893 std::vector<SHAPE*> shapes = aShape->MakeEffectiveShapes( true );
894
895 for( SHAPE* shape : shapes )
896 {
897 STROKE_PARAMS::Stroke( shape, lineStyle, thickness, m_plotter->RenderSettings(),
898 [&]( const VECTOR2I& a, const VECTOR2I& b )
899 {
900 m_plotter->ThickSegment( a, b, thickness, GetPlotMode(),
901 &gbr_metadata );
902 } );
903 }
904
905 for( SHAPE* shape : shapes )
906 delete shape;
907 }
908}
909
910
912{
913 VECTOR2I pos = aTable->GetPosition();
914 VECTOR2I end = aTable->GetEnd();
915 int lineWidth;
916 LINE_STYLE lineStyle;
917 GBR_METADATA gbr_metadata;
918
919 if( const FOOTPRINT* parentFP = aTable->GetParentFootprint() )
920 {
921 gbr_metadata.SetCmpReference( parentFP->GetReference() );
923 }
924
925 auto setupStroke =
926 [&]( const STROKE_PARAMS& stroke )
927 {
928 lineWidth = stroke.GetWidth();
929 lineStyle = stroke.GetLineStyle();
930 };
931
932 auto strokeShape =
933 [&]( const SHAPE& shape )
934 {
935 STROKE_PARAMS::Stroke( &shape, lineStyle, lineWidth, m_plotter->RenderSettings(),
936 [&]( const VECTOR2I& a, const VECTOR2I& b )
937 {
938 m_plotter->ThickSegment( a, b, lineWidth, GetPlotMode(),
939 &gbr_metadata );
940 } );
941 };
942
943 auto strokeLine =
944 [&]( const VECTOR2I& ptA, const VECTOR2I& ptB )
945 {
946 if( lineStyle <= LINE_STYLE::FIRST_TYPE )
947 {
948 m_plotter->ThickSegment( ptA, ptB, lineWidth, GetPlotMode(), &gbr_metadata );
949 }
950 else
951 {
952 SHAPE_SEGMENT seg( ptA, ptB );
953 strokeShape( seg );
954 }
955 };
956
957 auto strokeRect =
958 [&]( const VECTOR2I& ptA, const VECTOR2I& ptB )
959 {
960 strokeLine( VECTOR2I( ptA.x, ptA.y ), VECTOR2I( ptB.x, ptA.y ) );
961 strokeLine( VECTOR2I( ptB.x, ptA.y ), VECTOR2I( ptB.x, ptB.y ) );
962 strokeLine( VECTOR2I( ptB.x, ptB.y ), VECTOR2I( ptA.x, ptB.y ) );
963 strokeLine( VECTOR2I( ptA.x, ptB.y ), VECTOR2I( ptA.x, ptA.y ) );
964 };
965
966 if( aTable->GetSeparatorsStroke().GetWidth() >= 0 )
967 {
968 setupStroke( aTable->GetSeparatorsStroke() );
969
970 if( aTable->StrokeColumns() )
971 {
972 for( int col = 0; col < aTable->GetColCount() - 1; ++col )
973 {
974 for( int row = 0; row < aTable->GetRowCount(); ++row )
975 {
976 PCB_TABLECELL* cell = aTable->GetCell( row, col );
977 VECTOR2I topRight( cell->GetEndX(), cell->GetStartY() );
978
979 if( cell->GetColSpan() > 0 && cell->GetRowSpan() > 0 )
980 strokeLine( topRight, cell->GetEnd() );
981 }
982 }
983 }
984
985 if( aTable->StrokeRows() )
986 {
987 for( int row = 0; row < aTable->GetRowCount() - 1; ++row )
988 {
989 for( int col = 0; col < aTable->GetColCount(); ++col )
990 {
991 PCB_TABLECELL* cell = aTable->GetCell( row, col );
992 VECTOR2I botLeft( cell->GetStartX(), cell->GetEndY() );
993
994 if( cell->GetColSpan() > 0 && cell->GetRowSpan() > 0 )
995 strokeLine( botLeft, cell->GetEnd() );
996 }
997 }
998 }
999 }
1000
1001 if( aTable->GetBorderStroke().GetWidth() >= 0 )
1002 {
1003 setupStroke( aTable->GetBorderStroke() );
1004
1005 if( aTable->StrokeHeader() )
1006 {
1007 PCB_TABLECELL* cell = aTable->GetCell( 0, 0 );
1008 strokeLine( VECTOR2I( pos.x, cell->GetEndY() ), VECTOR2I( end.x, cell->GetEndY() ) );
1009 }
1010
1011 if( aTable->StrokeExternal() )
1012 strokeRect( pos, end );
1013 }
1014}
1015
1016
1018 const VECTOR2I& aDrillSize, const VECTOR2I& aPadSize,
1019 const EDA_ANGLE& aOrientation, int aSmallDrill )
1020{
1021 VECTOR2I drillSize = aDrillSize;
1022
1023 // Small drill marks have no significance when applied to slots
1024 if( aSmallDrill && aDrillShape == PAD_DRILL_SHAPE::CIRCLE )
1025 drillSize.x = std::min( aSmallDrill, drillSize.x );
1026
1027 // Round holes only have x diameter, slots have both
1028 drillSize.x -= getFineWidthAdj();
1029 drillSize.x = Clamp( 1, drillSize.x, aPadSize.x - 1 );
1030
1031 if( aDrillShape == PAD_DRILL_SHAPE::OBLONG )
1032 {
1033 drillSize.y -= getFineWidthAdj();
1034 drillSize.y = Clamp( 1, drillSize.y, aPadSize.y - 1 );
1035
1036 m_plotter->FlashPadOval( aDrillPos, drillSize, aOrientation, GetPlotMode(), nullptr );
1037 }
1038 else
1039 {
1040 m_plotter->FlashPadCircle( aDrillPos, drillSize.x, GetPlotMode(), nullptr );
1041 }
1042}
1043
1044
1046{
1047 /* If small drills marks were requested prepare a clamp value to pass
1048 to the helper function */
1049 int smallDrill = GetDrillMarksType() == DRILL_MARKS::SMALL_DRILL_SHAPE
1050 ? pcbIUScale.mmToIU( ADVANCED_CFG::GetCfg().m_SmallDrillMarkSize ) : 0;
1051
1052 /* In the filled trace mode drill marks are drawn white-on-black to scrape
1053 the underlying pad. This works only for drivers supporting color change,
1054 obviously... it means that:
1055 - PS, SVG and PDF output is correct (i.e. you have a 'donut' pad)
1056 - In HPGL you can't see them
1057 - In gerbers you can't see them, too. This is arguably the right thing to
1058 do since having drill marks and high speed drill stations is a sure
1059 recipe for broken tools and angry manufacturers. If you *really* want them
1060 you could start a layer with negative polarity to scrape the film.
1061 - In DXF they go into the 'WHITE' layer. This could be useful.
1062 */
1063 if( GetPlotMode() == FILLED )
1065
1066 for( PCB_TRACK* track : m_board->Tracks() )
1067 {
1068 if( track->Type() == PCB_VIA_T )
1069 {
1070 const PCB_VIA* via = static_cast<const PCB_VIA*>( track );
1071
1072 // Via are not always on all layers
1073 if( ( via->GetLayerSet() & m_layerMask ).none() )
1074 continue;
1075
1076 plotOneDrillMark( PAD_DRILL_SHAPE::CIRCLE, via->GetStart(),
1077 VECTOR2I( via->GetDrillValue(), 0 ), VECTOR2I( via->GetWidth(), 0 ),
1078 ANGLE_0, smallDrill );
1079 }
1080 }
1081
1082 for( FOOTPRINT* footprint : m_board->Footprints() )
1083 {
1084 for( PAD* pad : footprint->Pads() )
1085 {
1086 if( pad->GetDrillSize().x == 0 )
1087 continue;
1088
1089 plotOneDrillMark( pad->GetDrillShape(), pad->GetPosition(), pad->GetDrillSize(),
1090 pad->GetSize(), pad->GetOrientation(), smallDrill );
1091 }
1092 }
1093
1094 if( GetPlotMode() == FILLED )
1096}
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:794
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 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 plotOneDrillMark(PAD_DRILL_SHAPE 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 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:201
int GetStartY() const
Definition: eda_shape.h:126
int GetEndX() const
Definition: eda_shape.h:164
virtual std::vector< SHAPE * > MakeEffectiveShapes(bool aEdgeOnly=false) const
Make a set of SHAPE objects representing the EDA_SHAPE.
Definition: eda_shape.h:316
SHAPE_POLY_SET & GetPolyShape()
Definition: eda_shape.h:274
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:163
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
Definition: eda_shape.h:162
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:166
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:198
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:53
PAD_PROP GetProperty() const
Definition: pad.h:392
PAD_ATTRIB GetAttribute() const
Definition: pad.h:389
const wxString & GetPinFunction() const
Definition: pad.h:139
const wxString & GetNumber() const
Definition: pad.h:128
int GetRoundRectCornerRadius() const
Definition: pad.cpp:451
VECTOR2I ShapePos() const
Definition: pad.cpp:923
const std::shared_ptr< SHAPE_POLY_SET > & GetEffectivePolygon(ERROR_LOC aErrorLoc=ERROR_INSIDE) const
Definition: pad.cpp:479
const VECTOR2I & GetDelta() const
Definition: pad.h:258
PAD_SHAPE GetShape() const
Definition: pad.h:187
EDA_ANGLE GetOrientation() const
Return the rotation angle of the pad.
Definition: pad.h:353
int GetChamferPositions() const
Definition: pad.h:618
const VECTOR2I & GetSize() const
Definition: pad.h:250
double GetChamferRectRatio() const
Definition: pad.h:608
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
The set of pad drill shapes, used with PAD::{Set,Get}DrillShape()
Definition: padstack.h:61
@ 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:602