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 <zone.h>
57
58#include <wx/debug.h> // for wxASSERT_MSG
59
60
62{
63 COLOR4D color = ColorSettings()->GetColor( aLayer );
64
65 // A hack to avoid plotting a white item in white color on white paper
66 if( color == COLOR4D::WHITE )
68
69 return color;
70}
71
72
73void BRDITEMS_PLOTTER::PlotPad( const PAD* aPad, const COLOR4D& aColor, OUTLINE_MODE aPlotMode )
74{
75 VECTOR2I shape_pos = aPad->ShapePos();
76 GBR_METADATA metadata;
77
78 bool plotOnCopperLayer = ( m_layerMask & LSET::AllCuMask() ).any();
79 bool plotOnExternalCopperLayer = ( m_layerMask & LSET::ExternalCuMask() ).any();
80
81 // Pad not on the solder mask layer cannot be soldered.
82 // therefore it can have a specific aperture attribute.
83 // Not yet in use.
84 // bool isPadOnBoardTechLayers = ( aPad->GetLayerSet() & LSET::AllBoardTechMask() ).any();
85
86 metadata.SetCmpReference( aPad->GetParentFootprint()->GetReference() );
87
88 if( plotOnCopperLayer )
89 {
91 metadata.SetCopper( true );
92
93 // Gives a default attribute, for instance for pads used as tracks in net ties:
94 // Connector pads and SMD pads are on external layers
95 // if on internal layers, they are certainly used as net tie
96 // and are similar to tracks: just conductor items
98
99 const bool useUTF8 = false;
100 const bool useQuoting = false;
101 metadata.SetPadName( aPad->GetNumber(), useUTF8, useQuoting );
102
103 if( !aPad->GetNumber().IsEmpty() )
104 metadata.SetPadPinFunction( aPad->GetPinFunction(), useUTF8, useQuoting );
105
106 metadata.SetNetName( aPad->GetNetname() );
107
108 // Some pads are mechanical pads ( through hole or smd )
109 // when this is the case, they have no pad name and/or are not plated.
110 // In this case gerber files have slightly different attributes.
111 if( aPad->GetAttribute() == PAD_ATTRIB::NPTH || aPad->GetNumber().IsEmpty() )
112 metadata.m_NetlistMetadata.m_NotInNet = true;
113
114 if( !plotOnExternalCopperLayer )
115 {
116 // the .P object attribute (GBR_NETLIST_METADATA::GBR_NETINFO_PAD)
117 // is used on outer layers, unless the component is embedded
118 // or a "etched" component (fp only drawn, not a physical component)
119 // Currently, Pcbnew does not handle embedded component, so we disable the .P
120 // attribute on internal layers
121 // Note the Gerber doc is not really clear about through holes pads about the .P
124
125 }
126
127 // Some attributes are reserved to the external copper layers:
128 // GBR_APERTURE_ATTRIB_CONNECTORPAD and GBR_APERTURE_ATTRIB_SMDPAD_CUDEF
129 // for instance.
130 // Pad with type PAD_ATTRIB::CONN or PAD_ATTRIB::SMD that is not on outer layer
131 // has its aperture attribute set to GBR_APERTURE_ATTRIB_CONDUCTOR
132 switch( aPad->GetAttribute() )
133 {
134 case PAD_ATTRIB::NPTH: // Mechanical pad through hole
136 break;
137
138 case PAD_ATTRIB::PTH : // Pad through hole, a hole is also expected
140 break;
141
142 case PAD_ATTRIB::CONN: // Connector pads, no solder paste but with solder mask.
143 if( plotOnExternalCopperLayer )
145 break;
146
147 case PAD_ATTRIB::SMD: // SMD pads (on external copper layer only)
148 // with solder paste and mask
149 if( plotOnExternalCopperLayer )
151 break;
152 }
153
154 // Fabrication properties can have specific GBR_APERTURE_METADATA options
155 // that replace previous aperture attribute:
156 switch( aPad->GetProperty() )
157 {
158 case PAD_PROP::BGA: // Only applicable to outer layers
159 if( plotOnExternalCopperLayer )
161 break;
162
163 case PAD_PROP::FIDUCIAL_GLBL:
165 break;
166
167 case PAD_PROP::FIDUCIAL_LOCAL:
169 break;
170
171 case PAD_PROP::TESTPOINT: // Only applicable to outer layers
172 if( plotOnExternalCopperLayer )
174 break;
175
176 case PAD_PROP::HEATSINK:
178 break;
179
180 case PAD_PROP::CASTELLATED:
182 break;
183
184 case PAD_PROP::NONE:
185 break;
186 }
187
188 // Ensure NPTH pads have *always* the GBR_APERTURE_ATTRIB_WASHERPAD attribute
189 if( aPad->GetAttribute() == PAD_ATTRIB::NPTH )
191 }
192 else
193 {
195 }
196
197 // Set plot color (change WHITE to LIGHTGRAY because
198 // the white items are not seen on a white paper or screen
199 m_plotter->SetColor( aColor != WHITE ? aColor : LIGHTGRAY);
200
201 if( aPlotMode == SKETCH )
203
204 switch( aPad->GetShape() )
205 {
206 case PAD_SHAPE::CIRCLE:
207 m_plotter->FlashPadCircle( shape_pos, aPad->GetSize().x, aPlotMode, &metadata );
208 break;
209
210 case PAD_SHAPE::OVAL:
211 m_plotter->FlashPadOval( shape_pos, aPad->GetSize(), aPad->GetOrientation(), aPlotMode,
212 &metadata );
213 break;
214
215 case PAD_SHAPE::RECTANGLE:
216 m_plotter->FlashPadRect( shape_pos, aPad->GetSize(), aPad->GetOrientation(), aPlotMode,
217 &metadata );
218 break;
219
220 case PAD_SHAPE::ROUNDRECT:
221 m_plotter->FlashPadRoundRect( shape_pos, aPad->GetSize(), aPad->GetRoundRectCornerRadius(),
222 aPad->GetOrientation(), aPlotMode, &metadata );
223 break;
224
225 case PAD_SHAPE::TRAPEZOID:
226 {
227 // Build the pad polygon in coordinates relative to the pad
228 // (i.e. for a pad at pos 0,0, rot 0.0). Needed to use aperture macros,
229 // to be able to create a pattern common to all trapezoid pads having the same shape
230 VECTOR2I coord[4];
231
232 // Order is lower left, lower right, upper right, upper left.
233 VECTOR2I half_size = aPad->GetSize() / 2;
234 VECTOR2I trap_delta = aPad->GetDelta() / 2;
235
236 coord[0] = VECTOR2I( -half_size.x - trap_delta.y, half_size.y + trap_delta.x );
237 coord[1] = VECTOR2I( half_size.x + trap_delta.y, half_size.y - trap_delta.x );
238 coord[2] = VECTOR2I( half_size.x - trap_delta.y, -half_size.y + trap_delta.x );
239 coord[3] = VECTOR2I( -half_size.x + trap_delta.y, -half_size.y - trap_delta.x );
240
241 m_plotter->FlashPadTrapez( shape_pos, coord, aPad->GetOrientation(), aPlotMode, &metadata );
242 }
243 break;
244
245 case PAD_SHAPE::CHAMFERED_RECT:
246 if( m_plotter->GetPlotterType() == PLOT_FORMAT::GERBER )
247 {
248 GERBER_PLOTTER* gerberPlotter = static_cast<GERBER_PLOTTER*>( m_plotter );
249
250 gerberPlotter->FlashPadChamferRoundRect( shape_pos, aPad->GetSize(),
252 aPad->GetChamferRectRatio(),
253 aPad->GetChamferPositions(),
254 aPad->GetOrientation(), aPlotMode, &metadata );
255 break;
256 }
257
259
260 default:
261 case PAD_SHAPE::CUSTOM:
262 {
263 const std::shared_ptr<SHAPE_POLY_SET>& polygons = aPad->GetEffectivePolygon();
264
265 if( polygons->OutlineCount() )
266 {
267 m_plotter->FlashPadCustom( shape_pos, aPad->GetSize(), aPad->GetOrientation(),
268 polygons.get(), aPlotMode, &metadata );
269 }
270 }
271 break;
272 }
273}
274
275
277{
278 if( !GetPlotFPText() )
279 return;
280
281 const PCB_TEXT* textItem = &aFootprint->Reference();
282 PCB_LAYER_ID textLayer = textItem->GetLayer();
283
284 // Reference and value have special controls for forcing their plotting
285 if( GetPlotReference() && m_layerMask[textLayer]
286 && ( textItem->IsVisible() || GetPlotInvisibleText() ) )
287 {
288 PlotText( textItem, textLayer, textItem->IsKnockout(), textItem->GetFontMetrics() );
289 }
290
291 textItem = &aFootprint->Value();
292 textLayer = textItem->GetLayer();
293
294 if( GetPlotValue() && m_layerMask[textLayer]
295 && ( textItem->IsVisible() || GetPlotInvisibleText() ) )
296 {
297 PlotText( textItem, textLayer, textItem->IsKnockout(), textItem->GetFontMetrics() );
298 }
299
300 std::vector<PCB_TEXT*> texts;
301
302 // Skip the reference and value texts that are handled specially
303 for( PCB_FIELD* field : aFootprint->Fields() )
304 {
305 if( field->IsReference() || field->IsValue() )
306 continue;
307
308 texts.push_back( field );
309 }
310
311 for( BOARD_ITEM* item : aFootprint->GraphicalItems() )
312 {
313 textItem = dynamic_cast<const PCB_TEXT*>( item );
314
315 if( textItem )
316 texts.push_back( static_cast<PCB_TEXT*>( item ) );
317 }
318
319 for( const PCB_TEXT* text : texts )
320 {
321 if( !text->IsVisible() )
322 continue;
323
324 textLayer = text->GetLayer();
325
326 if( textLayer == Edge_Cuts || textLayer >= PCB_LAYER_ID_COUNT )
327 continue;
328
329 if( !m_layerMask[textLayer] || aFootprint->GetPrivateLayers().test( textLayer ) )
330 continue;
331
332 if( text->GetText() == wxT( "${REFERENCE}" ) && !GetPlotReference() )
333 continue;
334
335 if( text->GetText() == wxT( "${VALUE}" ) && !GetPlotValue() )
336 continue;
337
338 PlotText( text, textLayer, text->IsKnockout(), text->GetFontMetrics() );
339 }
340}
341
342
344{
345 switch( item->Type() )
346 {
347 case PCB_SHAPE_T:
348 PlotShape( static_cast<const PCB_SHAPE*>( item ) );
349 break;
350
351 case PCB_TEXT_T:
352 {
353 const PCB_TEXT* text = static_cast<const PCB_TEXT*>( item );
354 PlotText( text, text->GetLayer(), text->IsKnockout(), text->GetFontMetrics() );
355 break;
356 }
357
358 case PCB_TEXTBOX_T:
359 {
360 m_plotter->SetTextMode( PLOT_TEXT_MODE::STROKE );
361
362 const PCB_TEXTBOX* textbox = static_cast<const PCB_TEXTBOX*>( item );
363 PlotText( textbox, textbox->GetLayer(), textbox->IsKnockout(), textbox->GetFontMetrics() );
364
365 if( textbox->IsBorderEnabled() )
366 PlotShape( textbox );
367
369 break;
370 }
371
373 case PCB_DIM_CENTER_T:
374 case PCB_DIM_RADIAL_T:
376 case PCB_DIM_LEADER_T:
377 m_plotter->SetTextMode( PLOT_TEXT_MODE::STROKE );
378
379 PlotDimension( static_cast<const PCB_DIMENSION_BASE*>( item ) );
380
382 break;
383
384 case PCB_TARGET_T:
385 PlotPcbTarget( static_cast<const PCB_TARGET*>( item ) );
386 break;
387
388 default:
389 break;
390 }
391}
392
393
395{
396 if( !m_layerMask[aDim->GetLayer()] )
397 return;
398
400
401 // Set plot color (change WHITE to LIGHTGRAY because
402 // the white items are not seen on a white paper or screen
404
405 PlotText( aDim, aDim->GetLayer(), false, aDim->GetFontMetrics() );
406
407 PCB_SHAPE temp_item;
408
409 temp_item.SetStroke( STROKE_PARAMS( aDim->GetLineThickness(), PLOT_DASH_TYPE::SOLID ) );
410 temp_item.SetLayer( aDim->GetLayer() );
411
412 for( const std::shared_ptr<SHAPE>& shape : aDim->GetShapes() )
413 {
414 switch( shape->Type() )
415 {
416 case SH_SEGMENT:
417 {
418 const SEG& seg = static_cast<const SHAPE_SEGMENT*>( shape.get() )->GetSeg();
419
420 temp_item.SetShape( SHAPE_T::SEGMENT );
421 temp_item.SetStart( seg.A );
422 temp_item.SetEnd( seg.B );
423
424 PlotShape( &temp_item );
425 break;
426 }
427
428 case SH_CIRCLE:
429 {
430 VECTOR2I start( shape->Centre() );
431 int radius = static_cast<const SHAPE_CIRCLE*>( shape.get() )->GetRadius();
432
433 temp_item.SetShape( SHAPE_T::CIRCLE );
434 temp_item.SetFilled( false );
435 temp_item.SetStart( start );
436 temp_item.SetEnd( VECTOR2I( start.x + radius, start.y ) );
437
438 PlotShape( &temp_item );
439 break;
440 }
441
442 default:
443 break;
444 }
445 }
446}
447
448
450{
451 int dx1, dx2, dy1, dy2, radius;
452
453 if( !m_layerMask[aMire->GetLayer()] )
454 return;
455
456 m_plotter->SetColor( getColor( aMire->GetLayer() ) );
457
458 PCB_SHAPE temp_item;
459
460 temp_item.SetShape( SHAPE_T::CIRCLE );
461 temp_item.SetFilled( false );
462 temp_item.SetStroke( STROKE_PARAMS( aMire->GetWidth(), PLOT_DASH_TYPE::SOLID ) );
463 temp_item.SetLayer( aMire->GetLayer() );
464 temp_item.SetStart( aMire->GetPosition() );
465 radius = aMire->GetSize() / 3;
466
467 if( aMire->GetShape() ) // temp_item X
468 radius = aMire->GetSize() / 2;
469
470 // Draw the circle
471 temp_item.SetEnd( VECTOR2I( temp_item.GetStart().x + radius, temp_item.GetStart().y ) );
472
473 PlotShape( &temp_item );
474
475 temp_item.SetShape( SHAPE_T::SEGMENT );
476
477 radius = aMire->GetSize() / 2;
478 dx1 = radius;
479 dy1 = 0;
480 dx2 = 0;
481 dy2 = radius;
482
483 if( aMire->GetShape() ) // Shape X
484 {
485 dx1 = dy1 = radius;
486 dx2 = dx1;
487 dy2 = -dy1;
488 }
489
490 VECTOR2I mirePos( aMire->GetPosition() );
491
492 // Draw the X or + temp_item:
493 temp_item.SetStart( VECTOR2I( mirePos.x - dx1, mirePos.y - dy1 ) );
494 temp_item.SetEnd( VECTOR2I( mirePos.x + dx1, mirePos.y + dy1 ) );
495 PlotShape( &temp_item );
496
497 temp_item.SetStart( VECTOR2I( mirePos.x - dx2, mirePos.y - dy2 ) );
498 temp_item.SetEnd( VECTOR2I( mirePos.x + dx2, mirePos.y + dy2 ) );
499 PlotShape( &temp_item );
500}
501
502
504{
505 for( const BOARD_ITEM* item : aFootprint->GraphicalItems() )
506 {
507 if( aFootprint->GetPrivateLayers().test( item->GetLayer() ) )
508 continue;
509
510 if( !m_layerMask[ item->GetLayer() ] )
511 continue;
512
513 switch( item->Type() )
514 {
515 case PCB_SHAPE_T:
516 PlotShape( static_cast<const PCB_SHAPE*>( item ) );
517 break;
518
519 case PCB_TEXTBOX_T:
520 {
521 const PCB_TEXTBOX* textbox = static_cast<const PCB_TEXTBOX*>( item );
522
523 m_plotter->SetTextMode( PLOT_TEXT_MODE::STROKE );
524
525 PlotText( textbox, textbox->GetLayer(), textbox->IsKnockout(),
526 textbox->GetFontMetrics() );
527
528 if( textbox->IsBorderEnabled() )
529 PlotShape( textbox );
530
532 break;
533 }
534
536 case PCB_DIM_CENTER_T:
537 case PCB_DIM_RADIAL_T:
539 case PCB_DIM_LEADER_T:
540 PlotDimension( static_cast<const PCB_DIMENSION_BASE*>( item ) );
541 break;
542
543 case PCB_TEXT_T:
544 // Plotted in PlotFootprintTextItems()
545 break;
546
547 default:
548 UNIMPLEMENTED_FOR( item->GetClass() );
549 }
550 }
551}
552
553
554#include <font/stroke_font.h>
555void BRDITEMS_PLOTTER::PlotText( const EDA_TEXT* aText, PCB_LAYER_ID aLayer, bool aIsKnockout,
556 const KIFONT::METRICS& aFontMetrics )
557{
558 KIFONT::FONT* font = aText->GetFont();
559
560 if( !font )
561 {
562 wxString defaultFontName; // empty string is the KiCad stroke font
563
565 defaultFontName = m_plotter->RenderSettings()->GetDefaultFont();
566
567 font = KIFONT::FONT::GetFont( defaultFontName, aText->IsBold(), aText->IsItalic() );
568 }
569
570 wxString shownText( aText->GetShownText( true ) );
571
572 if( shownText.IsEmpty() )
573 return;
574
575 if( !m_layerMask[aLayer] )
576 return;
577
578 GBR_METADATA gbr_metadata;
579
580 if( IsCopperLayer( aLayer ) )
582
583 COLOR4D color = getColor( aLayer );
585
586 VECTOR2I pos = aText->GetTextPos();
587
588 TEXT_ATTRIBUTES attrs = aText->GetAttributes();
590 attrs.m_Angle = aText->GetDrawRotation();
591 attrs.m_Multiline = false;
592
594
595 if( aIsKnockout )
596 {
597 const PCB_TEXT* text = static_cast<const PCB_TEXT*>( aText );
598 SHAPE_POLY_SET finalPoly;
599
600 text->TransformTextToPolySet( finalPoly, 0, m_board->GetDesignSettings().m_MaxError,
601 ERROR_INSIDE );
603
604 for( int ii = 0; ii < finalPoly.OutlineCount(); ++ii )
605 m_plotter->PlotPoly( finalPoly.Outline( ii ), FILL_T::FILLED_SHAPE, 0, &gbr_metadata );
606 }
607 else if( aText->IsMultilineAllowed() )
608 {
609 std::vector<VECTOR2I> positions;
610 wxArrayString strings_list;
611 wxStringSplit( shownText, strings_list, '\n' );
612 positions.reserve( strings_list.Count() );
613
614 aText->GetLinePositions( positions, strings_list.Count() );
615
616 for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
617 {
618 wxString& txt = strings_list.Item( ii );
619 m_plotter->PlotText( positions[ii], color, txt, attrs, font, aFontMetrics, &gbr_metadata );
620 }
621 }
622 else
623 {
624 m_plotter->PlotText( pos, color, shownText, attrs, font, aFontMetrics, &gbr_metadata );
625 }
626}
627
628
630 const SHAPE_POLY_SET& aPolysList )
631{
632 if( aPolysList.IsEmpty() )
633 return;
634
635 GBR_METADATA gbr_metadata;
636
637 if( aZone->IsOnCopperLayer() )
638 {
639 gbr_metadata.SetNetName( aZone->GetNetname() );
640 gbr_metadata.SetCopper( true );
641
642 // Zones with no net name can exist.
643 // they are not used to connect items, so the aperture attribute cannot
644 // be set as conductor
645 if( aZone->GetNetname().IsEmpty() )
646 {
648 }
649 else
650 {
653 }
654 }
655
656 m_plotter->SetColor( getColor( aLayer ) );
657
658 m_plotter->StartBlock( nullptr ); // Clean current object attributes
659
660 /*
661 * In non filled mode the outline is plotted, but not the filling items
662 */
663
664 for( int idx = 0; idx < aPolysList.OutlineCount(); ++idx )
665 {
666 const SHAPE_LINE_CHAIN& outline = aPolysList.Outline( idx );
667
668 // Plot the current filled area (as region for Gerber plotter to manage attributes)
669 if( GetPlotMode() == FILLED )
670 {
671 if( m_plotter->GetPlotterType() == PLOT_FORMAT::GERBER )
672 {
673 static_cast<GERBER_PLOTTER*>( m_plotter )->PlotGerberRegion( outline,
674 &gbr_metadata );
675 }
676 else
677 {
678 m_plotter->PlotPoly( outline, FILL_T::FILLED_SHAPE, 0, &gbr_metadata );
679 }
680 }
681 else
682 {
684 }
685 }
686
687 m_plotter->EndBlock( nullptr ); // Clear object attributes
688}
689
690
692{
693 if( !m_layerMask[aShape->GetLayer()] )
694 return;
695
696 bool sketch = GetPlotMode() == SKETCH;
697 int thickness = aShape->GetWidth();
698 PLOT_DASH_TYPE lineStyle = aShape->GetStroke().GetPlotStyle();
699
700 m_plotter->SetColor( getColor( aShape->GetLayer() ) );
701
702 const FOOTPRINT* parentFP = aShape->GetParentFootprint();
703 GBR_METADATA gbr_metadata;
704
705 if( parentFP )
706 {
707 gbr_metadata.SetCmpReference( parentFP->GetReference() );
709 }
710
711 if( aShape->GetLayer() == Edge_Cuts )
712 {
714 }
715 else if( IsCopperLayer( aShape->GetLayer() ) )
716 {
717 if( parentFP )
718 {
720 gbr_metadata.SetCopper( true );
721 }
722 else if( aShape->GetNetCode() > 0 )
723 {
724 gbr_metadata.SetCopper( true );
727 gbr_metadata.SetNetName( aShape->GetNetname() );
728 }
729 else
730 {
731 // Graphic items (PCB_SHAPE, TEXT) having no net have the NonConductor attribute
732 // Graphic items having a net have the Conductor attribute, but are not (yet?)
733 // supported in Pcbnew
735 }
736 }
737
738 if( lineStyle <= PLOT_DASH_TYPE::FIRST_TYPE )
739 {
740 switch( aShape->GetShape() )
741 {
742 case SHAPE_T::SEGMENT:
743 m_plotter->ThickSegment( aShape->GetStart(), aShape->GetEnd(), thickness, GetPlotMode(),
744 &gbr_metadata );
745 break;
746
747 case SHAPE_T::CIRCLE:
748 if( aShape->IsFilled() )
749 {
750 m_plotter->FilledCircle( aShape->GetStart(), aShape->GetRadius() * 2 + thickness,
751 GetPlotMode(), &gbr_metadata );
752 }
753 else
754 {
755 m_plotter->ThickCircle( aShape->GetStart(), aShape->GetRadius() * 2, thickness,
756 GetPlotMode(), &gbr_metadata );
757 }
758
759 break;
760
761 case SHAPE_T::ARC:
762 {
763 // when startAngle == endAngle ThickArc() doesn't know whether it's 0 deg and 360 deg
764 // but it is a circle
765 if( std::abs( aShape->GetArcAngle().AsDegrees() ) == 360.0 )
766 {
767 m_plotter->ThickCircle( aShape->GetCenter(), aShape->GetRadius() * 2, thickness,
768 GetPlotMode(), &gbr_metadata );
769 }
770 else
771 {
772 m_plotter->ThickArc( *aShape, GetPlotMode(), &gbr_metadata );
773 }
774
775 break;
776 }
777
778 case SHAPE_T::BEZIER:
779 m_plotter->BezierCurve( aShape->GetStart(), aShape->GetBezierC1(),
780 aShape->GetBezierC2(), aShape->GetEnd(), 0, thickness );
781 break;
782
783 case SHAPE_T::POLY:
784 if( aShape->IsPolyShapeValid() )
785 {
786 if( sketch )
787 {
788 for( auto it = aShape->GetPolyShape().CIterateSegments( 0 ); it; it++ )
789 {
790 auto seg = it.Get();
791 m_plotter->ThickSegment( seg.A, seg.B, thickness, GetPlotMode(),
792 &gbr_metadata );
793 }
794 }
795 else
796 {
797 m_plotter->SetCurrentLineWidth( thickness, &gbr_metadata );
798
799 // Draw the polygon: only one polygon is expected
800 // However we provide a multi polygon shape drawing
801 // ( for the future or to show a non expected shape )
802 // This must be simplified and fractured to prevent overlapping polygons
803 // from generating invalid Gerber files
806 FILL_T fill = aShape->IsFilled() ? FILL_T::FILLED_SHAPE : FILL_T::NO_FILL;
807
808 for( int jj = 0; jj < tmpPoly.OutlineCount(); ++jj )
809 {
810 SHAPE_LINE_CHAIN& poly = tmpPoly.Outline( jj );
811
812 // Ensure the polygon is closed:
813 poly.SetClosed( true );
814
815 // Plot the current filled area
816 // (as region for Gerber plotter to manage attributes)
817 if( m_plotter->GetPlotterType() == PLOT_FORMAT::GERBER )
818 {
819 static_cast<GERBER_PLOTTER*>( m_plotter )->
820 PlotPolyAsRegion( poly, fill, thickness, &gbr_metadata );
821 }
822 else
823 {
824 m_plotter->PlotPoly( poly, fill, thickness, &gbr_metadata );
825 }
826 }
827 }
828 }
829
830 break;
831
832 case SHAPE_T::RECTANGLE:
833 {
834 std::vector<VECTOR2I> pts = aShape->GetRectCorners();
835
836 if( sketch )
837 {
838 m_plotter->ThickSegment( pts[0], pts[1], thickness, GetPlotMode(), &gbr_metadata );
839 m_plotter->ThickSegment( pts[1], pts[2], thickness, GetPlotMode(), &gbr_metadata );
840 m_plotter->ThickSegment( pts[2], pts[3], thickness, GetPlotMode(), &gbr_metadata );
841 m_plotter->ThickSegment( pts[3], pts[0], thickness, GetPlotMode(), &gbr_metadata );
842 }
843
844 if( !sketch )
845 {
846 SHAPE_LINE_CHAIN poly;
847
848 for( const VECTOR2I& pt : pts )
849 poly.Append( pt );
850
851 poly.Append( pts[0] ); // Close polygon.
852
853 FILL_T fill_mode = aShape->IsFilled() ? FILL_T::FILLED_SHAPE : FILL_T::NO_FILL;
854
855 if( m_plotter->GetPlotterType() == PLOT_FORMAT::GERBER )
856 {
857 static_cast<GERBER_PLOTTER*>( m_plotter )->
858 PlotPolyAsRegion( poly, fill_mode, thickness, &gbr_metadata );
859 }
860 else
861 {
862 m_plotter->PlotPoly( poly, fill_mode, thickness, &gbr_metadata );
863 }
864 }
865
866 break;
867 }
868
869 default:
871 }
872 }
873 else
874 {
875 std::vector<SHAPE*> shapes = aShape->MakeEffectiveShapes( true );
876
877 for( SHAPE* shape : shapes )
878 {
879 STROKE_PARAMS::Stroke( shape, lineStyle, thickness, m_plotter->RenderSettings(),
880 [&]( const VECTOR2I& a, const VECTOR2I& b )
881 {
882 m_plotter->ThickSegment( a, b, thickness, GetPlotMode(),
883 &gbr_metadata );
884 } );
885 }
886
887 for( SHAPE* shape : shapes )
888 delete shape;
889 }
890}
891
892
894 const VECTOR2I& aDrillSize, const VECTOR2I& aPadSize,
895 const EDA_ANGLE& aOrientation, int aSmallDrill )
896{
897 VECTOR2I drillSize = aDrillSize;
898
899 // Small drill marks have no significance when applied to slots
900 if( aSmallDrill && aDrillShape == PAD_DRILL_SHAPE_CIRCLE )
901 drillSize.x = std::min( aSmallDrill, drillSize.x );
902
903 // Round holes only have x diameter, slots have both
904 drillSize.x -= getFineWidthAdj();
905 drillSize.x = Clamp( 1, drillSize.x, aPadSize.x - 1 );
906
907 if( aDrillShape == PAD_DRILL_SHAPE_OBLONG )
908 {
909 drillSize.y -= getFineWidthAdj();
910 drillSize.y = Clamp( 1, drillSize.y, aPadSize.y - 1 );
911
912 m_plotter->FlashPadOval( aDrillPos, drillSize, aOrientation, GetPlotMode(), nullptr );
913 }
914 else
915 {
916 m_plotter->FlashPadCircle( aDrillPos, drillSize.x, GetPlotMode(), nullptr );
917 }
918}
919
920
922{
923 /* If small drills marks were requested prepare a clamp value to pass
924 to the helper function */
925 int smallDrill = GetDrillMarksType() == DRILL_MARKS::SMALL_DRILL_SHAPE
926 ? pcbIUScale.mmToIU( ADVANCED_CFG::GetCfg().m_SmallDrillMarkSize ) : 0;
927
928 /* In the filled trace mode drill marks are drawn white-on-black to scrape
929 the underlying pad. This works only for drivers supporting color change,
930 obviously... it means that:
931 - PS, SVG and PDF output is correct (i.e. you have a 'donut' pad)
932 - In HPGL you can't see them
933 - In gerbers you can't see them, too. This is arguably the right thing to
934 do since having drill marks and high speed drill stations is a sure
935 recipe for broken tools and angry manufacturers. If you *really* want them
936 you could start a layer with negative polarity to scrape the film.
937 - In DXF they go into the 'WHITE' layer. This could be useful.
938 */
939 if( GetPlotMode() == FILLED )
941
942 for( PCB_TRACK* track : m_board->Tracks() )
943 {
944 if( track->Type() == PCB_VIA_T )
945 {
946 const PCB_VIA* via = static_cast<const PCB_VIA*>( track );
947
948 // Via are not always on all layers
949 if( ( via->GetLayerSet() & m_layerMask ).none() )
950 continue;
951
953 VECTOR2I( via->GetDrillValue(), 0 ), VECTOR2I( via->GetWidth(), 0 ),
954 ANGLE_0, smallDrill );
955 }
956 }
957
958 for( FOOTPRINT* footprint : m_board->Footprints() )
959 {
960 for( PAD* pad : footprint->Pads() )
961 {
962 if( pad->GetDrillSize().x == 0 )
963 continue;
964
965 plotOneDrillMark( pad->GetDrillShape(), pad->GetPosition(), pad->GetDrillSize(),
966 pad->GetSize(), pad->GetOrientation(), smallDrill );
967 }
968 }
969
970 if( GetPlotMode() == FILLED )
972}
int color
Definition: DXF_plotter.cpp:58
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:109
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:204
virtual bool IsKnockout() const
Definition: board_item.h:274
FOOTPRINT * GetParentFootprint() const
Definition: board_item.cpp:247
const KIFONT::METRICS & GetFontMetrics() const
Definition: board_item.cpp:96
FOOTPRINTS & Footprints()
Definition: board.h:313
TRACKS & Tracks()
Definition: board.h:310
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:731
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:138
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:137
void PlotShape(const PCB_SHAPE *aShape)
PLOTTER * m_plotter
Definition: pcbplot.h:136
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 PlotFootprintTextItems(const FOOTPRINT *aFootprint)
int getFineWidthAdj() const
Definition: pcbplot.h:75
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:149
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
EDA_ANGLE GetArcAngle() const
Definition: eda_shape.cpp:658
const VECTOR2I & GetBezierC2() const
Definition: eda_shape.h:183
virtual std::vector< SHAPE * > MakeEffectiveShapes(bool aEdgeOnly=false) const
Make a set of SHAPE objects representing the EDA_SHAPE.
Definition: eda_shape.h:298
SHAPE_POLY_SET & GetPolyShape()
Definition: eda_shape.h:256
bool IsFilled() const
Definition: eda_shape.h:91
void SetFilled(bool aFlag)
Definition: eda_shape.h:96
int GetRadius() const
Definition: eda_shape.cpp:588
SHAPE_T GetShape() const
Definition: eda_shape.h:117
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
Definition: eda_shape.h:149
void SetStart(const VECTOR2I &aStart)
Definition: eda_shape.h:128
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
Definition: eda_shape.h:124
void SetShape(SHAPE_T aShape)
Definition: eda_shape.h:116
std::vector< VECTOR2I > GetRectCorners() const
Definition: eda_shape.cpp:1105
void SetEnd(const VECTOR2I &aEnd)
Definition: eda_shape.h:153
wxString SHAPE_T_asString() const
Definition: eda_shape.cpp:87
const VECTOR2I & GetBezierC1() const
Definition: eda_shape.h:180
bool IsPolyShapeValid() const
Definition: eda_shape.cpp:1290
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:80
const VECTOR2I & GetTextPos() const
Definition: eda_text.h:219
bool IsItalic() const
Definition: eda_text.h:141
bool IsMultilineAllowed() const
Definition: eda_text.h:157
virtual bool IsVisible() const
Definition: eda_text.h:147
KIFONT::FONT * GetFont() const
Definition: eda_text.h:199
virtual EDA_ANGLE GetDrawRotation() const
Definition: eda_text.h:315
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:726
const TEXT_ATTRIBUTES & GetAttributes() const
Definition: eda_text.h:183
int GetEffectiveTextPenWidth(int aDefaultPenWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultPenWidth.
Definition: eda_text.cpp:305
bool IsBold() const
Definition: eda_text.h:144
virtual wxString GetShownText(bool aAllowExtraText, int aDepth=0) const
Return the string actually shown after processing of the base text.
Definition: eda_text.h:106
PCB_FIELD & Value()
read/write accessors:
Definition: footprint.h:592
LSET GetPrivateLayers() const
Definition: footprint.h:125
PCB_FIELD & Reference()
Definition: footprint.h:593
PCB_FIELDS & Fields()
Definition: footprint.h:185
const wxString & GetReference() const
Definition: footprint.h:556
DRAWINGS & GraphicalItems()
Definition: footprint.h:191
@ 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:801
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:773
Definition: pad.h:58
PAD_PROP GetProperty() const
Definition: pad.h:375
PAD_ATTRIB GetAttribute() const
Definition: pad.h:372
const wxString & GetPinFunction() const
Definition: pad.h:141
const wxString & GetNumber() const
Definition: pad.h:130
int GetRoundRectCornerRadius() const
Definition: pad.cpp:328
VECTOR2I ShapePos() const
Definition: pad.cpp:756
const VECTOR2I & GetDelta() const
Definition: pad.h:250
PAD_SHAPE GetShape() const
Definition: pad.h:189
EDA_ANGLE GetOrientation() const
Return the rotation angle of the pad.
Definition: pad.h:341
const std::shared_ptr< SHAPE_POLY_SET > & GetEffectivePolygon() const
Definition: pad.cpp:359
int GetChamferPositions() const
Definition: pad.h:566
const VECTOR2I & GetSize() const
Definition: pad.h:243
double GetChamferRectRatio() const
Definition: pad.h:556
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:72
int GetWidth() const override
Definition: pcb_shape.cpp:149
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
Definition: pcb_shape.cpp:97
STROKE_PARAMS GetStroke() const override
Definition: pcb_shape.h:82
void SetStroke(const STROKE_PARAMS &aStroke) override
Definition: pcb_shape.h:83
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: pcb_shape.h:67
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:512
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:535
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:544
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
static void Stroke(const SHAPE *aShape, PLOT_DASH_TYPE aLineStyle, int aWidth, const KIGFX::RENDER_SETTINGS *aRenderSettings, std::function< void(const VECTOR2I &a, const VECTOR2I &b)> aStroker)
PLOT_DASH_TYPE GetPlotStyle() const
Definition: stroke_params.h:94
Handle a list of polygons defining a copper zone.
Definition: zone.h:72
bool IsOnCopperLayer() const override
Definition: zone.cpp:266
@ 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:437
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:847
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:60
@ Edge_Cuts
Definition: layer_ids.h:114
@ PCB_LAYER_ID_COUNT
Definition: layer_ids.h:138
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:426
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:69
@ PAD_DRILL_SHAPE_CIRCLE
Definition: pad_shapes.h:70
@ PAD_DRILL_SHAPE_OBLONG
Definition: pad_shapes.h:71
@ 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.
PLOT_DASH_TYPE
Dashed line types.
Definition: stroke_params.h:48
constexpr int mmToIU(double mm) const
Definition: base_units.h:89
@ 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:102
@ PCB_DIM_LEADER_T
class PCB_DIM_LEADER, a leader dimension (graphic item)
Definition: typeinfo.h:99
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:94
@ PCB_DIM_CENTER_T
class PCB_DIM_CENTER, a center point marking (graphic item)
Definition: typeinfo.h:100
@ PCB_TEXTBOX_T
class PCB_TEXTBOX, wrapped text on a layer
Definition: typeinfo.h:92
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
Definition: typeinfo.h:91
@ PCB_TARGET_T
class PCB_TARGET, a target (graphic item)
Definition: typeinfo.h:103
@ PCB_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
Definition: typeinfo.h:98
@ PCB_DIM_RADIAL_T
class PCB_DIM_RADIAL, a radius or diameter dimension
Definition: typeinfo.h:101
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