KiCad PCB EDA Suite
collectors.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) 2007-2008 SoftPLC Corporation, Dick Hollenbeck <[email protected]>
5 * Copyright (C) 2004-2022 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25#include <collectors.h>
26#include <board_item.h> // class BOARD_ITEM
27
28#include <footprint.h>
29#include <fp_shape.h>
30#include <pad.h>
31#include <pcb_track.h>
32#include <pcb_marker.h>
33#include <pcb_dimension.h>
34#include <zone.h>
35#include <pcb_shape.h>
36#include <pcb_group.h>
37#include <macros.h>
38#include <math/util.h> // for KiROUND
39
40
41const std::vector<KICAD_T> GENERAL_COLLECTOR::AllBoardItems = {
42 PCB_MARKER_T, // in m_markers
43 PCB_TEXT_T, // in m_drawings
44 PCB_BITMAP_T, // in m_drawings
45 PCB_TEXTBOX_T, // in m_drawings
46 PCB_SHAPE_T, // in m_drawings
47 PCB_DIM_ALIGNED_T, // in m_drawings
48 PCB_DIM_CENTER_T, // in m_drawings
49 PCB_DIM_RADIAL_T, // in m_drawings
50 PCB_DIM_ORTHOGONAL_T, // in m_drawings
51 PCB_DIM_LEADER_T, // in m_drawings
52 PCB_TARGET_T, // in m_drawings
53 PCB_VIA_T, // in m_tracks
54 PCB_TRACE_T, // in m_tracks
55 PCB_ARC_T, // in m_tracks
56 PCB_PAD_T, // in footprints
57 PCB_FP_TEXT_T, // in footprints
58 PCB_FP_TEXTBOX_T, // in footprints
59 PCB_FOOTPRINT_T, // in m_footprints
60 PCB_GROUP_T, // in m_groups
61 PCB_ZONE_T // in m_zones
62};
63
64
65const std::vector<KICAD_T> GENERAL_COLLECTOR::BoardLevelItems = {
83};
84
85
86const std::vector<KICAD_T> GENERAL_COLLECTOR::Footprints = {
88};
89
90
91const std::vector<KICAD_T> GENERAL_COLLECTOR::PadsOrTracks = {
96};
97
98
99const std::vector<KICAD_T> GENERAL_COLLECTOR::FootprintItems = {
109 PCB_PAD_T,
113 };
114
115
116const std::vector<KICAD_T> GENERAL_COLLECTOR::Tracks = {
118 PCB_ARC_T,
120};
121
122
123const std::vector<KICAD_T> GENERAL_COLLECTOR::LockableItems = {
125 PCB_GROUP_T, // Can a group be locked?
127 PCB_ARC_T,
129};
130
131
132const std::vector<KICAD_T> GENERAL_COLLECTOR::Zones = {
135};
136
137
138const std::vector<KICAD_T> GENERAL_COLLECTOR::Dimensions = {
149};
150
151
152const std::vector<KICAD_T> GENERAL_COLLECTOR::DraggableItems = {
154 PCB_VIA_T,
157};
158
159
161{
162 BOARD_ITEM* item = (BOARD_ITEM*) testItem;
163 FOOTPRINT* footprint = nullptr;
164 PCB_GROUP* group = nullptr;
165 PAD* pad = nullptr;
166 bool pad_through = false;
167 PCB_VIA* via = nullptr;
168 PCB_MARKER* marker = nullptr;
169 ZONE* zone = nullptr;
170 PCB_DIMENSION_BASE* dimension = nullptr;
171
172#if 0 // debugging
173 static int breakhere = 0;
174
175 switch( item->Type() )
176 {
177 case PCB_PAD_T:
178 {
179 FOOTPRINT* footprint = (FOOTPRINT*) item->GetParent();
180
181 if( footprint->GetReference() == wxT( "Y2" ) )
182 breakhere++;
183 }
184 break;
185
186 case PCB_VIA_T:
187 breakhere++;
188 break;
189
190 case PCB_TRACE_T:
191 case PCB_ARC_T:
192 breakhere++;
193 break;
194
195 case PCB_TEXT_T:
196 breakhere++;
197 break;
198
199 case PCB_TEXTBOX_T:
200 breakhere++;
201 break;
202
203 case PCB_SHAPE_T:
204 breakhere++;
205 break;
206
208 breakhere++;
209 break;
210
211 case PCB_FP_TEXT_T:
212 {
213 FP_TEXT* fpText = (FP_TEXT*) item;
214
215 if( fpText->GetText() == wxT( "10uH" ) )
216 breakhere++;
217 }
218 break;
219
220 case PCB_FP_TEXTBOX_T:
221 breakhere++;
222 break;
223
224 case PCB_FOOTPRINT_T:
225 {
226 FOOTPRINT* footprint = (FOOTPRINT*) item;
227
228 if( footprint->GetReference() == wxT( "C98" ) )
229 breakhere++;
230 }
231 break;
232
233 case PCB_MARKER_T:
234 breakhere++;
235 break;
236
237 default:
238 breakhere++;
239 break;
240 }
241
242#endif
243
244 switch( item->Type() )
245 {
246 case PCB_PAD_T:
247 // there are pad specific visibility controls.
248 // Criteria to select a pad is:
249 // for smd pads: the footprint parent must be visible, and pads on the corresponding
250 // board side must be visible
251 // if pad is a thru hole, then it can be visible when its parent footprint is not.
252 // for through pads: pads on Front or Back board sides must be visible
253 pad = static_cast<PAD*>( item );
254
255 if( ( pad->GetAttribute() != PAD_ATTRIB::SMD ) &&
256 ( pad->GetAttribute() != PAD_ATTRIB::CONN ) ) // a hole is present, so multiple layers
257 {
258 // proceed to the common tests below, but without the parent footprint test,
259 // by leaving footprint==NULL, but having pad != null
260 pad_through = true;
261 }
262 else // smd, so use pads test after footprint test
263 {
264 footprint = static_cast<FOOTPRINT*>( item->GetParent() );
265 }
266
267 break;
268
269 case PCB_VIA_T: // vias are on many layers, so layer test is specific
270 via = static_cast<PCB_VIA*>( item );
271 break;
272
273 case PCB_TRACE_T:
274 case PCB_ARC_T:
275 if( m_Guide->IgnoreTracks() )
277
278 break;
279
280 case PCB_FP_ZONE_T:
281 footprint = static_cast<FOOTPRINT*>( item->GetParent() );
282
283 // Fallthrough to get the zone as well
285
286 case PCB_ZONE_T:
287 zone = static_cast<ZONE*>( item );
288 break;
289
290 case PCB_TEXT_T:
291 case PCB_TEXTBOX_T:
292 case PCB_SHAPE_T:
293 break;
294
300 footprint = static_cast<FOOTPRINT*>( item->GetParent() );
301
302 // Fallthrough to get the zone as well
304
306 case PCB_DIM_CENTER_T:
307 case PCB_DIM_RADIAL_T:
309 case PCB_DIM_LEADER_T:
310 dimension = static_cast<PCB_DIMENSION_BASE*>( item );
311 break;
312
313 case PCB_TARGET_T:
314 break;
315
316 case PCB_FP_TEXT_T:
317 case PCB_FP_TEXTBOX_T:
318 {
319 PCB_LAYER_ID layer = item->GetLayer();
320
321 if( m_Guide->IgnoreHiddenFPText() && item->Type() == PCB_FP_TEXT_T )
322 {
323 FP_TEXT *text = static_cast<FP_TEXT*>( item );
324
325 if( !text->IsVisible() )
327 }
328
329 if( m_Guide->IgnoreFPTextOnBack() && IsBackLayer( layer ) )
331
332 if( m_Guide->IgnoreFPTextOnFront() && IsFrontLayer( layer ) )
334
335 /*
336 * The three text types have different criteria: reference and value have their own
337 * ignore flags; user text instead follows their layer visibility. Checking this here
338 * is simpler than later (when layer visibility is checked for other entities)
339 */
340
342
343 if( item->Type() == PCB_FP_TEXT_T )
344 textType = static_cast<FP_TEXT*>( item )->GetType();
345
346 switch( textType )
347 {
351
352 break;
353
355 if( m_Guide->IgnoreFPValues() )
357
358 break;
359
361 if( !m_Guide->IsLayerVisible( layer ) )
363
364 break;
365 }
366
367 // Extract the footprint since it could be hidden
368 footprint = static_cast<FOOTPRINT*>( item->GetParent() );
369 break;
370 }
371
372 case PCB_FP_SHAPE_T:
373 break;
374
375 case PCB_FOOTPRINT_T:
376 footprint = static_cast<FOOTPRINT*>( item );
377 break;
378
379 case PCB_GROUP_T:
380 group = static_cast<PCB_GROUP*>( item );
381 break;
382
383 case PCB_MARKER_T:
384 marker = static_cast<PCB_MARKER*>( item );
385 break;
386
387 default:
388 break;
389 }
390
391 // common tests:
392
393 if( footprint ) // true from case PCB_PAD_T, PCB_FP_TEXT_T, or PCB_FOOTPRINT_T
394 {
395 if( m_Guide->IgnoreFootprintsOnBack() && ( footprint->GetLayer() == B_Cu ) )
397
398 if( m_Guide->IgnoreFootprintsOnFront() && ( footprint->GetLayer() == F_Cu ) )
400 }
401
402 // Pads are not sensitive to the layer visibility controls.
403 // They all have their own separate visibility controls
404 // skip them if not visible
405 if( pad )
406 {
407 if( m_Guide->IgnorePads() )
409
410 if( ! pad_through )
411 {
412 if( m_Guide->IgnorePadsOnFront() && pad->IsOnLayer(F_Cu ) )
414
415 if( m_Guide->IgnorePadsOnBack() && pad->IsOnLayer(B_Cu ) )
417 }
418 }
419
420 if( marker )
421 {
422 // Markers are not sensitive to the layer
423 if( marker->HitTest( m_refPos ) )
424 Append( item );
425
427 }
428
429 if( group )
430 {
431 // Groups are not sensitive to the layer ... ?
432 if( group->HitTest( m_refPos ) )
433 Append( item );
434
436 }
437
438 if( via )
439 {
440 auto type = via->GetViaType();
441
442 if( ( m_Guide->IgnoreThroughVias() && type == VIATYPE::THROUGH )
444 || ( m_Guide->IgnoreMicroVias() && type == VIATYPE::MICROVIA ) )
445 {
447 }
448 }
449
450 if( ( item->IsOnLayer( m_Guide->GetPreferredLayer() ) )
451 && ( !item->IsLocked() || !m_Guide->IgnoreLockedItems() ) )
452 {
453 // footprints and their subcomponents: reference, value and pads are not sensitive
454 // to the layer visibility controls. They all have their own separate visibility
455 // controls for vias, GetLayer() has no meaning, but IsOnLayer() works fine. User
456 // text in a footprint *is* sensitive to layer visibility but that was already handled.
457
458 int accuracy = KiROUND( 5 * m_Guide->OnePixelInIU() );
459
460 if( zone )
461 {
462 if( zone->HitTestForCorner( m_refPos, accuracy * 2 )
463 || zone->HitTestForEdge( m_refPos, accuracy ) )
464 {
465 Append( item );
467 }
468 else if( !m_Guide->IgnoreZoneFills() )
469 {
470 for( PCB_LAYER_ID layer : zone->GetLayerSet().Seq() )
471 {
472 if( m_Guide->IsLayerVisible( layer )
473 && zone->HitTestFilledArea( layer, m_refPos ) )
474 {
475 Append( item );
477 }
478 }
479 }
480 }
481 else if( item == footprint )
482 {
483 if( footprint->HitTest( m_refPos, accuracy )
484 && footprint->HitTestAccurate( m_refPos, accuracy ) )
485 {
486 Append( item );
488 }
489 }
490 else if( pad || via )
491 {
492 if( item->HitTest( m_refPos, accuracy ) )
493 {
494 Append( item );
496 }
497 }
498 else
499 {
500 PCB_LAYER_ID layer = item->GetLayer();
501
502 if( m_Guide->IsLayerVisible( layer ) )
503 {
504 if( dimension )
505 {
506 // Dimensions feel particularly hard to select, probably due to their
507 // noisy shape making it feel like they should have a larger boundary.
508 accuracy = KiROUND( accuracy * 1.5 );
509 }
510
511 if( item->HitTest( m_refPos, accuracy ) )
512 {
513 Append( item );
515 }
516 }
517 }
518 }
519
520 if( m_Guide->IncludeSecondary() && ( !item->IsLocked() || !m_Guide->IgnoreLockedItems() ) )
521 {
522 // for now, "secondary" means "tolerate any visible layer". It has no effect on other
523 // criteria, since there is a separate "ignore" control for those in the COLLECTORS_GUIDE
524
525 // footprints and their subcomponents: reference, value and pads are not sensitive
526 // to the layer visibility controls. They all have their own separate visibility
527 // controls for vias, GetLayer() has no meaning, but IsOnLayer() works fine. User
528 // text in a footprint *is* sensitive to layer visibility but that was already handled.
529
530 int accuracy = KiROUND( 5 * m_Guide->OnePixelInIU() );
531
532 if( zone )
533 {
534 if( zone->HitTestForCorner( m_refPos, accuracy * 2 )
535 || zone->HitTestForEdge( m_refPos, accuracy ) )
536 {
537 Append2nd( item );
539 }
540 else if( !m_Guide->IgnoreZoneFills() )
541 {
542 for( PCB_LAYER_ID layer : zone->GetLayerSet().Seq() )
543 {
544 if( m_Guide->IsLayerVisible( layer )
545 && zone->HitTestFilledArea( layer, m_refPos ) )
546 {
547 Append2nd( item );
549 }
550 }
551 }
552 }
553 else if( item->Type() == PCB_FOOTPRINT_T )
554 {
555 if( footprint->HitTest( m_refPos, accuracy )
556 && footprint->HitTestAccurate( m_refPos, accuracy ) )
557 {
558 Append2nd( item );
560 }
561 }
562 else if( pad || via )
563 {
564 if( item->HitTest( m_refPos, accuracy ) )
565 {
566 Append2nd( item );
568 }
569 }
570 else
571 {
572 PCB_LAYER_ID layer = item->GetLayer();
573
574 if( m_Guide->IsLayerVisible( layer ) )
575 {
576 if( dimension )
577 {
578 // Dimensions feel particularly hard to select, probably due to their
579 // noisy shape making it feel like they should have a larger boundary.
580 accuracy = KiROUND( accuracy * 1.5 );
581 }
582
583 if( item->HitTest( m_refPos, accuracy ) )
584 {
585 Append2nd( item );
587 }
588 }
589 }
590 }
591
592 return INSPECT_RESULT::CONTINUE; // always when collecting
593}
594
595
596void GENERAL_COLLECTOR::Collect( BOARD_ITEM* aItem, const std::vector<KICAD_T>& aScanTypes,
597 const VECTOR2I& aRefPos, const COLLECTORS_GUIDE& aGuide )
598{
599 Empty(); // empty the collection, primary criteria list
600 Empty2nd(); // empty the collection, secondary criteria list
601
602 // remember guide, pass it to Inspect()
603 SetGuide( &aGuide );
604
605 SetScanTypes( aScanTypes );
606
607 // remember where the snapshot was taken from and pass refPos to
608 // the Inspect() function.
609 SetRefPos( aRefPos );
610
611 aItem->Visit( m_inspector, nullptr, m_scanTypes );
612
613 // append 2nd list onto end of the first list
614 for( unsigned i = 0; i<m_List2nd.size(); ++i )
615 Append( m_List2nd[i] );
616
617 Empty2nd();
618}
619
620
622{
623 // The Visit() function only visits the testItem if its type was in the the scanList,
624 // so therefore we can collect anything given to us here.
625 Append( testItem );
626
627 return INSPECT_RESULT::CONTINUE; // always when collecting
628}
629
630
631void PCB_TYPE_COLLECTOR::Collect( BOARD_ITEM* aBoard, const std::vector<KICAD_T>& aTypes )
632{
633 Empty();
634 aBoard->Visit( m_inspector, nullptr, aTypes );
635}
636
637
639{
640 BOARD_ITEM* item = (BOARD_ITEM*) testItem;
641
642 if( item->IsOnLayer( m_layer_id ) )
643 Append( testItem );
644
646}
647
648
649void PCB_LAYER_COLLECTOR::Collect( BOARD_ITEM* aBoard, const std::vector<KICAD_T>& aTypes )
650{
651 Empty();
652 aBoard->Visit( m_inspector, nullptr, aTypes );
653}
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:70
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:192
virtual bool IsLocked() const
Definition: board_item.cpp:71
virtual bool IsOnLayer(PCB_LAYER_ID aLayer, bool aIncludeCourtyards=false) const
Test to see if this object is on the given layer.
Definition: board_item.h:257
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:175
An abstract base class whose derivatives may be passed to a GENERAL_COLLECTOR telling it what should ...
Definition: collectors.h:53
virtual bool IgnoreThroughVias() const =0
virtual bool IgnoreHiddenFPText() const =0
virtual bool IsLayerVisible(PCB_LAYER_ID layer) const =0
virtual bool IgnoreFPTextOnFront() const =0
virtual double OnePixelInIU() const =0
virtual bool IgnoreFPTextOnBack() const =0
virtual bool IgnoreLockedItems() const =0
virtual bool IgnoreZoneFills() const =0
virtual bool IgnoreMicroVias() const =0
virtual bool IgnoreFootprintsOnBack() const =0
virtual bool IgnoreBlindBuriedVias() const =0
virtual bool IgnorePadsOnBack() const =0
virtual bool IgnoreFPReferences() const =0
virtual bool IgnorePadsOnFront() const =0
virtual bool IgnoreFootprintsOnFront() const =0
virtual bool IgnorePads() const
Definition: collectors.h:122
virtual bool IgnoreTracks() const =0
virtual bool IncludeSecondary() const =0
Determine if the secondary criteria or 2nd choice items should be included.
virtual bool IgnoreFPValues() const =0
virtual PCB_LAYER_ID GetPreferredLayer() const =0
INSPECTOR_FUNC m_inspector
Definition: collector.h:244
void Empty()
Clear the list.
Definition: collector.h:89
VECTOR2I m_refPos
Definition: collector.h:246
void SetScanTypes(const std::vector< KICAD_T > &aTypes)
Record the list of KICAD_T types to consider for collection by the Inspect() function.
Definition: collector.h:211
void SetRefPos(const VECTOR2I &aRefPos)
Definition: collector.h:213
std::vector< KICAD_T > m_scanTypes
Definition: collector.h:243
void Append(EDA_ITEM *item)
Add an item to the end of the list.
Definition: collector.h:99
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
virtual INSPECT_RESULT Visit(INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &aScanTypes)
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: eda_item.cpp:91
virtual bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const
Test if aPosition is inside or on the boundary of this item.
Definition: eda_item.h:222
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:87
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: footprint.h:200
bool HitTestAccurate(const VECTOR2I &aPosition, int aAccuracy=0) const
Test if a point is inside the bounding polygon of the footprint.
Definition: footprint.cpp:1130
const wxString & GetReference() const
Definition: footprint.h:519
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
Definition: footprint.cpp:1123
TEXT_TYPE
Footprint text type: there must be only one (and only one) for each of the reference value texts in o...
Definition: fp_text.h:48
@ TEXT_is_REFERENCE
Definition: fp_text.h:49
@ TEXT_is_DIVERS
Definition: fp_text.h:51
@ TEXT_is_VALUE
Definition: fp_text.h:50
TEXT_TYPE GetType() const
Definition: fp_text.h:120
static const std::vector< KICAD_T > BoardLevelItems
A scan list for all primary board items, omitting items which are subordinate to a FOOTPRINT,...
Definition: collectors.h:235
void SetGuide(const COLLECTORS_GUIDE *aGuide)
Record which COLLECTORS_GUIDE to use.
Definition: collectors.h:293
static const std::vector< KICAD_T > PadsOrTracks
A scan list for PADs, TRACKs, or VIAs.
Definition: collectors.h:245
static const std::vector< KICAD_T > Zones
A scan list for zones outlines only.
Definition: collectors.h:229
void Append2nd(BOARD_ITEM *item)
Definition: collectors.h:283
INSPECT_RESULT Inspect(EDA_ITEM *testItem, void *testData) override
The examining function within the INSPECTOR which is passed to the Iterate function.
Definition: collectors.cpp:160
static const std::vector< KICAD_T > LockableItems
A scan list for TRACKs, VIAs, FOOTPRINTs.
Definition: collectors.h:260
static const std::vector< KICAD_T > Footprints
A scan list for only FOOTPRINTs.
Definition: collectors.h:240
static const std::vector< KICAD_T > AllBoardItems
A scan list for all editable board items.
Definition: collectors.h:224
std::vector< BOARD_ITEM * > m_List2nd
A place to hold collected objects which don't match precisely the search criteria,...
Definition: collectors.h:212
static const std::vector< KICAD_T > Tracks
A scan list for only TRACKs and ARCs.
Definition: collectors.h:255
void Collect(BOARD_ITEM *aItem, const std::vector< KICAD_T > &aScanList, const VECTOR2I &aRefPos, const COLLECTORS_GUIDE &aGuide)
Scan a BOARD_ITEM using this class's Inspector method, which does the collection.
Definition: collectors.cpp:596
static const std::vector< KICAD_T > Dimensions
A scan list for dimensions.
Definition: collectors.h:265
static const std::vector< KICAD_T > FootprintItems
A scan list for primary footprint items.
Definition: collectors.h:250
const COLLECTORS_GUIDE * m_Guide
Determine which items are to be collected by Inspect().
Definition: collectors.h:217
static const std::vector< KICAD_T > DraggableItems
A scan list for items that can be dragged.
Definition: collectors.h:270
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Return an LSEQ from the union of this LSET and a desired sequence.
Definition: lset.cpp:411
Definition: pad.h:60
Abstract dimension API.
A set of BOARD_ITEMs (i.e., without duplicates).
Definition: pcb_group.h:51
void Collect(BOARD_ITEM *aBoard, const std::vector< KICAD_T > &aTypes)
Test a BOARD_ITEM using this class's Inspector method, which does the collection.
Definition: collectors.cpp:649
INSPECT_RESULT Inspect(EDA_ITEM *testItem, void *testData) override
The examining function within the INSPECTOR which is passed to the iterate function.
Definition: collectors.cpp:638
PCB_LAYER_ID m_layer_id
Definition: collectors.h:576
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
Definition: pcb_marker.h:76
void Collect(BOARD_ITEM *aBoard, const std::vector< KICAD_T > &aTypes)
Collect BOARD_ITEM objects using this class's Inspector method, which does the collection.
Definition: collectors.cpp:631
INSPECT_RESULT Inspect(EDA_ITEM *testItem, void *testData) override
The examining function within the INSPECTOR which is passed to the Iterate function.
Definition: collectors.cpp:621
Handle a list of polygons defining a copper zone.
Definition: zone.h:57
bool HitTestForCorner(const VECTOR2I &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX *aCornerHit=nullptr) const
Test if the given VECTOR2I is near a corner.
Definition: zone.cpp:421
bool HitTestForEdge(const VECTOR2I &refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX *aCornerHit=nullptr) const
Test if the given VECTOR2I is near a segment defined by 2 corners.
Definition: zone.cpp:428
bool HitTestFilledArea(PCB_LAYER_ID aLayer, const VECTOR2I &aRefPos, int aAccuracy=0) const
Test if the given VECTOR2I is within the bounds of a filled area of this zone.
Definition: zone.cpp:488
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: zone.h:122
INSPECT_RESULT
Definition: eda_item.h:42
bool IsFrontLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a front layer.
Definition: layer_ids.h:901
bool IsBackLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a back layer.
Definition: layer_ids.h:924
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:59
@ B_Cu
Definition: layer_ids.h:95
@ F_Cu
Definition: layer_ids.h:64
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
@ SMD
Smd pad, appears on the solder paste layer (default)
@ CONN
Like smd, does not appear on the solder paste layer (default)
@ BLIND_BURIED
@ PCB_FP_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
Definition: typeinfo.h:95
@ 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:110
@ PCB_FP_SHAPE_T
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:94
@ PCB_DIM_LEADER_T
class PCB_DIM_LEADER, a leader dimension (graphic item)
Definition: typeinfo.h:107
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:102
@ PCB_FP_TEXTBOX_T
class FP_TEXTBOX, wrapped text in a footprint
Definition: typeinfo.h:93
@ PCB_DIM_CENTER_T
class PCB_DIM_CENTER, a center point marking (graphic item)
Definition: typeinfo.h:108
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
Definition: typeinfo.h:115
@ PCB_TEXTBOX_T
class PCB_TEXTBOX, wrapped text on a layer
Definition: typeinfo.h:91
@ PCB_ZONE_T
class ZONE, a copper pour area
Definition: typeinfo.h:112
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
Definition: typeinfo.h:90
@ PCB_FP_DIM_CENTER_T
class PCB_DIM_CENTER, a center point marking (graphic item)
Definition: typeinfo.h:97
@ PCB_MARKER_T
class PCB_MARKER, a marker used to show something
Definition: typeinfo.h:104
@ PCB_TARGET_T
class PCB_TARGET, a target (graphic item)
Definition: typeinfo.h:111
@ PCB_FP_DIM_ORTHOGONAL_T
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
Definition: typeinfo.h:99
@ PCB_FP_DIM_LEADER_T
class PCB_DIM_LEADER, a leader dimension (graphic item)
Definition: typeinfo.h:96
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
Definition: typeinfo.h:86
@ PCB_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
Definition: typeinfo.h:106
@ PCB_FP_ZONE_T
class ZONE, managed by a footprint
Definition: typeinfo.h:100
@ PCB_BITMAP_T
class PCB_BITMAP, bitmap on a layer
Definition: typeinfo.h:89
@ PCB_FP_DIM_RADIAL_T
class PCB_DIM_RADIAL, a radius or diameter dimension
Definition: typeinfo.h:98
@ PCB_PAD_T
class PAD, a pad in a footprint
Definition: typeinfo.h:87
@ PCB_FP_TEXT_T
class FP_TEXT, text in a footprint
Definition: typeinfo.h:92
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
Definition: typeinfo.h:103
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:101
@ PCB_DIM_RADIAL_T
class PCB_DIM_RADIAL, a radius or diameter dimension
Definition: typeinfo.h:109
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:85