KiCad PCB EDA Suite
Loading...
Searching...
No Matches
board_item.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) 2012 Jean-Pierre Charras, [email protected]
5 * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <[email protected]>
6 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
22#include <wx/debug.h>
23#include <wx/msgdlg.h>
24
25#include <i18n_utility.h>
26#include <macros.h>
27#include <board.h>
28#include <board_item_index.h>
31#include <lset.h>
32#include <pcb_group.h>
33#include <pcb_generator.h>
34#include <footprint.h>
35#include <font/font.h>
36#include <properties/property.h>
38#include <view/view.h>
39
40
41bool BOARD_ITEM::FitsEnabledLayers( const LSET& aEnabledLayers, int aCopperLayerCount ) const
42{
43 return IsLayerAgnostic() || ( GetLayerSet() & aEnabledLayers ).any();
44}
45
46
48{
49 switch ( Type() )
50 {
51 case PCB_FOOTPRINT_T:
52 case PCB_PAD_T:
53 case PCB_SHAPE_T:
55 case PCB_FIELD_T:
56 case PCB_TEXT_T:
57 case PCB_TEXTBOX_T:
58 case PCB_TABLE_T:
61 case PCB_DRILL_MAP_T:
62 case PCB_GROUP_T:
63 case PCB_GENERATOR_T:
64 case PCB_TRACE_T:
65 case PCB_VIA_T:
66 case PCB_ARC_T:
67 case PCB_DIMENSION_T:
73 case PCB_ZONE_T:
74 case PCB_BARCODE_T:
75 case PCB_POINT_T:
76 case PCB_GRID_ITEM_T:
77 return true;
78 default:
79 return false;
80 }
81}
82
83
84void BOARD_ITEM::CopyFrom( const BOARD_ITEM* aOther )
85{
86 wxCHECK( aOther, /* void */ );
87 *this = *aOther;
88}
89
90
92{
93 if( Type() == PCB_T )
94 return static_cast<const BOARD*>( this );
95
96 return static_cast<const BOARD*>( findParent( PCB_T ) );
97}
98
99
101{
102 if( Type() == PCB_T )
103 return static_cast<BOARD*>( this );
104
105 return static_cast<BOARD*>( findParent( PCB_T ) );
106}
107
108
110{
111 // Backup for code paths that skip ::Remove(). Do not use the parent chain, it may be freed.
112 if( m_owningIndex )
113 m_owningIndex->UnbindItem( *this );
114}
115
116
118{
119 return static_cast<FOOTPRINT*>( findParent( PCB_FOOTPRINT_T ) );
120}
121
122
123void BOARD_ITEM::SetUuid( const KIID& aUuid )
124{
125 if( m_Uuid == aUuid )
126 return;
127
128 // Use the index that holds us, not GetBoard(). The parent chain may name a wrong or dead
129 // board.
130 if( BOARD_ITEM_INDEX* owningIndex = m_owningIndex )
131 {
132 owningIndex->Rebind( *this, aUuid );
133 return;
134 }
135
136 SetUuidDirect( aUuid );
137}
138
139
140void BOARD_ITEM::SetUuidDirect( const KIID& aUuid )
141{
142 const_cast<KIID&>( m_Uuid ) = aUuid;
143}
144
145
147{
149 {
150 if( group->AsEdaItem()->IsLocked() )
151 return true;
152 }
153
154 if( !GetBoard() || GetBoard()->GetBoardUse() == BOARD_USE::FPHOLDER )
155 return false;
156
157 return m_isLocked;
158}
159
160
162{
163 wxFAIL_MSG( wxString( "GetStroke() not defined by " ) + GetClass() );
164
165 return STROKE_PARAMS( pcbIUScale.mmToIU( DEFAULT_LINE_WIDTH ) );
166}
167
168
170{
171 wxFAIL_MSG( wxString( "SetStroke() not defined by " ) + GetClass() );
172}
173
174
179
180
182{
183 if( const BOARD* board = GetBoard() )
184 return board->GetDesignSettings().m_MaxError;
185
186 return ARC_HIGH_DEF;
187}
188
189
191{
192 wxASSERT_MSG( IsSingleLayerType( Type() ),
193 wxString::Format( wxT( "GetLayer() must be overridden for multi-layer types (%s)." ), GetClass() ) );
194
195 return m_layer;
196}
197
198
200{
201 const BOARD* board = GetBoard();
202
203 if( board )
204 return board->FlipLayer( aLayer );
205
206 return ::FlipLayer( aLayer );
207}
208
210{
211 const BOARD* board = GetBoard();
212
213 if( board )
214 return board->GetLayerSet().count();
215
216 return 64;
217}
218
219
221{
222 const BOARD* board = GetBoard();
223
224 if( board )
225 return board->GetCopperLayerCount();
226
227 return 32;
228}
229
230
232{
233 const BOARD* board = GetBoard();
234
235 if( board )
236 return board->GetEnabledLayers();
237
238 return LSET::AllLayersMask();
239}
240
241
243{
244 return GetLayerName( m_layer );
245}
246
247
249{
250 const BOARD* board = GetBoard();
251
252 if( board )
253 return board->GetLayerName( aLayer );
254
255 // If no parent, return standard name
256 return BOARD::GetStandardLayerName( aLayer );
257}
258
259
261{
262 if( ( GetLayerSet() & LSET::SideSpecificMask() ).any() )
263 return true;
264
265 if( const BOARD* board = GetBoard() )
266 {
267 LAYER_T principalLayerType = board->GetLayerType( m_layer );
268
269 if( principalLayerType == LT_FRONT || principalLayerType == LT_BACK )
270 return true;
271 }
272
273 return false;
274}
275
276
278{
279 const BOARD* board = GetBoard();
280 LSET layers = GetLayerSet();
281 int copperLayerCount = MAX_CU_LAYERS;
282
283 if( board )
284 {
285 layers &= board->GetEnabledLayers();
286 copperLayerCount = board->GetCopperLayerCount();
287 }
288
289 LSET copperLayers = layers & LSET::AllCuMask();
290 LSET techLayers = layers & LSET::AllTechMask();
291
292 // Try to be smart and useful. Check all copper first.
293 if( (int) copperLayers.count() == copperLayerCount )
294 return _( "all copper layers" );
295
296 for( LSET testLayers : { copperLayers, techLayers, layers } )
297 {
298 for( int layer = PCBNEW_LAYER_ID_START; layer < PCB_LAYER_ID_COUNT; ++layer )
299 {
300 if( testLayers[ layer ] )
301 {
302 wxString layerInfo = board ? board->GetLayerName( ToLAYER_ID( layer ) )
303 : LayerName( ToLAYER_ID( layer ) );
304
305 if( testLayers.count() > 1 )
306 layerInfo << wxS( " " ) + _( "and others" );
307
308 return layerInfo;
309 }
310 }
311 }
312
313 // No copper, no technicals: no layer
314 return _( "no layers" );
315}
316
317
318std::vector<int> BOARD_ITEM::ViewGetLayers() const
319{
320 // Basic fallback
321 if( IsLocked() )
323
324 return { m_layer };
325}
326
327
329{
331
332 if( parent )
333 parent->Remove( this );
334
335 delete this;
336}
337
338
340{
342}
343
344
346{
347 if( aImage == nullptr )
348 return;
349
350 EDA_ITEM* parent = GetParent();
352 EDA_GROUP* imageGroup = aImage->GetParentGroup();
353 BOARD* board = GetBoard();
354
355 // Evict children from the item-by-id cache before the swap moves them to the
356 // image. The image is typically deleted after the swap (undo/redo, commit revert),
357 // which would leave the cache holding dangling pointers to the destroyed children.
358 if( board )
359 {
360 board->UncacheChildrenById( *this );
361 }
362
363 swapData( aImage );
364 SetParent( parent );
365
366 // Group membership is a back-reference, not item data, so keep each side's own.
368 aImage->SetParentGroup( imageGroup );
369
370 if( board )
371 {
372 board->CacheChildrenById( *this );
373 }
374}
375
376
377BOARD_ITEM* BOARD_ITEM::Duplicate( bool addToParentGroup, BOARD_COMMIT* aCommit ) const
378{
379 BOARD_ITEM* dupe = static_cast<BOARD_ITEM*>( Clone() );
380 dupe->ResetUuid();
381
382 if( addToParentGroup )
383 {
384 wxCHECK_MSG( aCommit, dupe, "Must supply a commit to update parent group" );
385
386 if( EDA_GROUP* group = dupe->GetParentGroup() )
387 {
388 aCommit->Modify( group->AsEdaItem(), nullptr, RECURSE_MODE::NO_RECURSE );
389 group->AddItem( dupe );
390 }
391 }
392
393 return dupe;
394}
395
396
398 int aClearance, int aError, ERROR_LOC aErrorLoc,
399 bool ignoreLineWidth ) const
400{
401 wxCHECK_MSG( false, /* void */,
402 wxString::Format( wxT( "%s doesn't implement TransformShapeToPolygon()" ), GetClass() ) );
403}
404
405
406double BOARD_ITEM::GetCoverageArea( int aTextMargin ) const
407{
408 SHAPE_POLY_SET poly;
410 return polygonArea( poly );
411}
412
413
415{
416 const BOARD* board = GetBoard();
417 LSET visible;
418
419 for( PCB_LAYER_ID layer : board ? board->GetEnabledLayers() : LSET::AllLayersMask() )
420 {
421 if( aView->IsLayerVisibleCached( layer ) )
422 visible.set( layer );
423 }
424
425 return visible;
426}
427
428
430{
431 for( int ii = 0; ii < aPolySet.OutlineCount(); ii++ )
432 {
433 aPolySet.Outline( ii ).SetClosed( true );
434
435 for( int jj = 0; jj < aPolySet.HoleCount( ii ); jj++ )
436 aPolySet.Hole( ii, jj ).SetClosed( true );
437 }
438
439 return aPolySet.Area();
440}
441
442
444{
445 if( a->Type() != b->Type() )
446 return a->Type() < b->Type();
447
448 if( a->GetLayerSet() != b->GetLayerSet() )
449 return a->GetLayerSet().Seq() < b->GetLayerSet().Seq();
450
451 if( a->m_Uuid != b->m_Uuid ) // UUIDs *should* always be unique (for valid boards anyway)
452 return a->m_Uuid < b->m_Uuid;
453
454 return a < b; // But just in case; ptrs are guaranteed to be different
455}
456
457
459{
460 static std::shared_ptr<SHAPE> shape;
461
463
464 return shape;
465}
466
467
469{
470 static std::shared_ptr<SHAPE_SEGMENT> slot;
471
473
474 return slot;
475}
476
477
479{
480 if( FOOTPRINT* parentFP = GetParentFootprint() )
481 return parentFP->GetTransform().InverseApply( GetPosition() );
482
483 return GetPosition();
484}
485
486
488{
489 if( FOOTPRINT* parentFP = GetParentFootprint() )
490 SetPosition( parentFP->GetTransform().Apply( aPos ) );
491 else
492 SetPosition( aPos );
493}
494
495
496void BOARD_ITEM::Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle )
497{
498 wxMessageBox( wxT( "virtual BOARD_ITEM::Rotate used, should not occur" ), GetClass() );
499}
500
501
502void BOARD_ITEM::Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection )
503{
504 wxMessageBox( wxT( "virtual BOARD_ITEM::Flip used, should not occur" ), GetClass() );
505}
506
507
508void BOARD_ITEM::Mirror( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection )
509{
510 wxMessageBox( wxT( "virtual BOARD_ITEM::Mirror used, should not occur" ), GetClass() );
511}
512
513
514void BOARD_ITEM::Mirror( const SEG& aAxis )
515{
516 wxMessageBox( wxT( "virtual BOARD_ITEM::Mirror used, should not occur" ), GetClass() );
517}
518
519
521{
522 if( FOOTPRINT* fp = dynamic_cast<FOOTPRINT*>( m_parent ) )
523 return fp->GetReference();
524
525 return m_parent->m_Uuid.AsString();
526}
527
528
529const std::vector<wxString>* BOARD_ITEM::GetEmbeddedFonts()
530{
531 if( BOARD* board = GetBoard() )
532 return board->GetFontFiles();
533
534 return nullptr;
535}
536
537
538static struct BOARD_ITEM_DESC
539{
541 {
543
544 if( layerEnum.Choices().GetCount() == 0 )
545 {
546 layerEnum.Undefined( UNDEFINED_LAYER );
547
548 for( PCB_LAYER_ID layer : LSET::AllLayersMask() )
549 layerEnum.Map( layer, LSET::Name( layer ) );
550 }
551
555
556 propMgr.AddProperty( new PROPERTY<BOARD_ITEM, wxString>( _HKI( "Parent" ),
560
561 auto isNotFootprintHolder =
562 []( INSPECTABLE* aItem ) -> bool
563 {
564 BOARD_ITEM* item = dynamic_cast<BOARD_ITEM*>( aItem );
565 return item && item->GetBoard() && !item->GetBoard()->IsFootprintHolder();
566 };
567
568 propMgr.AddProperty( new PROPERTY<BOARD_ITEM, int>( _HKI( "Position X" ),
571 propMgr.AddProperty( new PROPERTY<BOARD_ITEM, int>( _HKI( "Position Y" ),
576 .SetIsCopyable();
577 propMgr.AddProperty( new PROPERTY<BOARD_ITEM, bool>( _HKI( "Locked" ),
579 .SetAvailableFunc( isNotFootprintHolder );
580 }
582
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
@ ERROR_OUTSIDE
constexpr int ARC_HIGH_DEF
Definition base_units.h:144
constexpr EDA_IU_SCALE pcbIUScale
Definition base_units.h:128
constexpr int ARC_LOW_DEF
Definition base_units.h:143
@ FPHOLDER
Definition board.h:403
LAYER_T
The allowed types of layers, same as Specctra DSN spec.
Definition board.h:243
@ LT_FRONT
Definition board.h:250
@ LT_BACK
Definition board.h:251
#define DEFAULT_LINE_WIDTH
static struct BOARD_ITEM_DESC _BOARD_ITEM_DESC
BASE_SET & set(size_t pos)
Definition base_set.h:126
Abstract interface for BOARD_ITEMs capable of storing other items inside.
virtual void Remove(BOARD_ITEM *aItem, REMOVE_MODE aMode=REMOVE_MODE::NORMAL)=0
Removes an item from the container.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition board_item.h:99
BOARD_ITEM(BOARD_ITEM *aParent, KICAD_T idtype, PCB_LAYER_ID aLayer=F_Cu)
Definition board_item.h:101
virtual void Mirror(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection)
Mirror this object relative to a given horizontal axis the layer is not changed.
void SetUuidDirect(const KIID &aUuid)
Raw UUID assignment.
int GetY() const
Definition board_item.h:154
bool IsGroupableType() const
virtual BOARD_ITEM * Duplicate(bool addToParentGroup, BOARD_COMMIT *aCommit=nullptr) const
Create a copy of this BOARD_ITEM.
void DeleteStructure()
Delete this object after removing from its parent if it has one.
const std::vector< wxString > * GetEmbeddedFonts() override
void SwapItemData(BOARD_ITEM *aImage)
Swap data between aItem and aImage.
void SetLocked(bool aLocked) override
Definition board_item.h:441
virtual STROKE_PARAMS GetStroke() const
PCB_LAYER_ID GetFlippedLayer(PCB_LAYER_ID aLayer) const
Return the layer paired with aLayer on the opposite side of the board.
virtual int BoardLayerCount() const
Return the total number of layers for the board that this item resides on.
virtual void SetStroke(const STROKE_PARAMS &aStroke)
LSET viewVisibleLayers(const KIGFX::VIEW *aView) const
Enabled board layers that aView shows, for LOD checks on views that hide layers on their own.
void SetUuid(const KIID &aUuid)
static double polygonArea(SHAPE_POLY_SET &aPolySet)
Area of aPolySet with every contour closed first, holes subtracted.
PCB_LAYER_ID m_layer
Definition board_item.h:625
bool m_isLocked
Definition board_item.h:627
wxString GetParentAsString() const
For "parent" property.
virtual std::shared_ptr< SHAPE_SEGMENT > GetEffectiveHoleShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, DRC_CONSTRAINT_T aUsage=NULL_CONSTRAINT) const
int GetX() const
Definition board_item.h:148
bool IsLocked() const override
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
virtual void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const
Convert the item shape to a closed polygon.
virtual void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle)
Rotate this object.
void SetX(int aX)
Definition board_item.h:170
void SetY(int aY)
Definition board_item.h:176
virtual double GetCoverageArea(int aTextMargin) const
Return the board area this item covers, used to rank candidates under the cursor so a click on a smal...
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition board_item.h:397
virtual std::vector< int > ViewGetLayers() const override
Return the all the layers within the VIEW the object is painted on.
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
FOOTPRINT * GetParentFootprint() const
VECTOR2I GetFPRelativePosition() const
virtual LSET BoardLayerSet() const
Return the LSET for the board that this item resides on.
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
Definition board_item.h:369
virtual bool IsLayerAgnostic() const
Check if this item's layer set must not be confined to a board's enabled layers.
Definition board_item.h:322
virtual void swapData(BOARD_ITEM *aImage)
const KIFONT::METRICS & GetFontMetrics() const
~BOARD_ITEM() override
friend class BOARD_ITEM_INDEX
Definition board_item.h:635
void SetFPRelativePosition(const VECTOR2I &aPos)
virtual wxString LayerMaskDescribe() const
Return a string (to be shown to the user) describing a layer mask.
virtual bool FitsEnabledLayers(const LSET &aEnabledLayers, int aCopperLayerCount) const
Check if a board offering aEnabledLayers can hold this item.
virtual void CopyFrom(const BOARD_ITEM *aOther)
void ResetUuid()
Definition board_item.h:295
BOARD_ITEM_INDEX * m_owningIndex
Board index that indexes this item, or nullptr.
Definition board_item.h:633
BOARD_ITEM_CONTAINER * GetParent() const
Definition board_item.h:281
bool IsSideSpecific() const
virtual int BoardCopperLayerCount() const
Return the total number of copper layers for the board that this item resides on.
virtual std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=FLASHING::DEFAULT, DRC_CONSTRAINT_T aUsage=NULL_CONSTRAINT) const
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
wxString GetLayerName() const
Return the name of the PCB layer on which the item resides.
int GetMaxError() const
virtual void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection)
Flip this object, i.e.
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:411
bool IsFootprintHolder() const
Find out if the board is being used to hold a single footprint for editing/viewing.
Definition board.h:441
void CacheChildrenById(const BOARD_ITEM &aParent)
Definition board.h:1755
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Return an "English Standard" name of a PCB layer when given aLayerNumber.
Definition board.h:1131
LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition board.h:908
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayer) const
Definition board.cpp:1148
int GetCopperLayerCount() const
Definition board.cpp:1155
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition board.cpp:960
const LSET & GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition board.cpp:1202
void UncacheChildrenById(const BOARD_ITEM &aParent)
Definition board.h:1761
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
Definition commit.h:102
A set of EDA_ITEMs (i.e., without duplicates).
Definition eda_group.h:43
A base class for most all the KiCad significant classes used in schematics and boards.
Definition eda_item.h:98
virtual VECTOR2I GetPosition() const
Definition eda_item.h:348
virtual void SetPosition(const VECTOR2I &aPos)
Definition eda_item.h:349
const KIID m_Uuid
Definition eda_item.h:599
virtual EDA_GROUP * GetParentGroup() const
Definition eda_item.h:116
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:110
virtual void SetParentGroup(EDA_GROUP *aGroup)
Definition eda_item.h:115
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
Definition eda_item.cpp:288
virtual void SetParent(EDA_ITEM *aParent)
Definition eda_item.cpp:153
EDA_ITEM * m_parent
Owner.
Definition eda_item.h:609
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
Definition eda_item.cpp:84
EDA_ITEM * findParent(KICAD_T aType) const
Definition eda_item.cpp:137
ENUM_MAP & Map(T aValue, const wxString &aName)
Definition property.h:817
static ENUM_MAP< T > & Instance()
Definition property.h:811
ENUM_MAP & Undefined(T aValue)
Definition property.h:824
wxPGChoices & Choices()
Definition property.h:862
Class that other classes need to inherit from, in order to be inspectable.
Definition inspectable.h:39
static const METRICS & Default()
Definition font.cpp:49
virtual wxString GetClass() const =0
Return the class name.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition view.h:68
bool IsLayerVisibleCached(int aLayer) const
Definition view.h:472
Definition kiid.h:46
LSET is a set of PCB_LAYER_IDs.
Definition lset.h:37
static const LSET & AllCuMask()
return AllCuMask( MAX_CU_LAYERS );
Definition lset.cpp:604
static const LSET & SideSpecificMask()
Definition lset.cpp:732
LSEQ Seq(const LSEQ &aSequence) const
Return an LSEQ from the union of this LSET and a desired sequence.
Definition lset.cpp:309
static const LSET & AllTechMask()
Return a mask holding all technical layers (no CU layer) on both side.
Definition lset.cpp:672
static const LSET & AllLayersMask()
Definition lset.cpp:637
static wxString Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
Definition lset.cpp:184
PROPERTY_BASE & SetAvailableFunc(std::function< bool(INSPECTABLE *)> aFunc)
Set a callback function to determine whether an object provides this property.
Definition property.h:275
PROPERTY_BASE & SetIsCopyable(bool aIsCopyable=true)
Definition property.h:388
PROPERTY_BASE & SetIsHiddenFromPropertiesManager(bool aHide=true)
Definition property.h:354
PROPERTY_BASE & SetIsHiddenFromLibraryEditors(bool aIsHidden=true)
Definition property.h:368
Provide class metadata.
void InheritsAfter(TYPE_ID aDerived, TYPE_ID aBase)
Declare an inheritance relationship between types.
static PROPERTY_MANAGER & Instance()
PROPERTY_BASE & AddProperty(PROPERTY_BASE *aProperty, const wxString &aGroup=wxEmptyString)
Register a property.
Definition seg.h:38
void SetClosed(bool aClosed)
Mark the line chain as closed (i.e.
Represent a set of closed polygons.
double Area()
Return the area of this poly set.
int HoleCount(int aOutline) const
Returns the number of holes in a given outline.
SHAPE_LINE_CHAIN & Outline(int aIndex)
Return the reference to aIndex-th outline in the set.
SHAPE_LINE_CHAIN & Hole(int aOutline, int aHole)
Return the reference to aHole-th hole in the aIndex-th outline.
int OutlineCount() const
Return the number of outlines in the set.
Simple container to manage line stroke parameters.
A type-safe container of any type.
Definition ki_any.h:92
#define _(s)
@ NO_RECURSE
Definition eda_item.h:52
Some functions to handle hotkeys in KiCad.
wxString LayerName(int aLayer)
Returns the default display name for a given layer.
Definition layer_id.cpp:31
constexpr PCB_LAYER_ID PCBNEW_LAYER_ID_START
Definition layer_ids.h:170
FLASHING
Enum used during connectivity building to ensure we do not query connectivity while building the data...
Definition layer_ids.h:180
#define MAX_CU_LAYERS
Definition layer_ids.h:172
@ LAYER_LOCKED_ITEM_SHADOW
Shadow layer for locked items.
Definition layer_ids.h:303
PCB_LAYER_ID
A quick note on layer IDs:
Definition layer_ids.h:56
@ UNDEFINED_LAYER
Definition layer_ids.h:57
@ PCB_LAYER_ID_COUNT
Definition layer_ids.h:167
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition lset.cpp:750
This file contains miscellaneous commonly used macros and functions.
#define UNIMPLEMENTED_FOR(type)
Definition macros.h:92
FLIP_DIRECTION
Definition mirror.h:26
#define _HKI(x)
Definition page_info.cpp:40
Class to handle a set of BOARD_ITEMs.
#define TYPE_HASH(x)
Macro to generate unique identifier for a type.
Definition property.h:74
#define IMPLEMENT_ENUM_TO_WXANY(type)
Definition property.h:916
#define NO_SETTER(owner, type)
Macro to define read-only fields (no setter method available)
Definition property.h:923
@ PT_COORD
Coordinate expressed in distance units (mm/inch)
Definition property.h:65
#define REGISTER_TYPE(x)
Helper macro to map type hashes to names.
bool operator()(const BOARD_ITEM *a, const BOARD_ITEM *b) const
constexpr bool IsSingleLayerType(const KICAD_T aType)
Definition typeinfo.h:527
@ PCB_T
Definition typeinfo.h:74
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
Definition typeinfo.h:80
@ PCB_DIM_ORTHOGONAL_T
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
Definition typeinfo.h:98
@ PCB_DIM_LEADER_T
class PCB_DIM_LEADER, a leader dimension (graphic item)
Definition typeinfo.h:95
@ PCB_GENERATOR_T
class PCB_GENERATOR, generator on a layer
Definition typeinfo.h:83
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
Definition typeinfo.h:89
@ PCB_DRILL_MAP_T
class PCB_DRILL_MAP, drill symbols drawn at the holes
Definition typeinfo.h:240
@ PCB_DIM_CENTER_T
class PCB_DIM_CENTER, a center point marking (graphic item)
Definition typeinfo.h:96
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
Definition typeinfo.h:103
@ PCB_TEXTBOX_T
class PCB_TEXTBOX, wrapped text on a layer
Definition typeinfo.h:85
@ PCB_ZONE_T
class ZONE, a copper pour area
Definition typeinfo.h:100
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
Definition typeinfo.h:84
@ PCB_REFERENCE_IMAGE_T
class PCB_REFERENCE_IMAGE, bitmap on a layer
Definition typeinfo.h:81
@ PCB_FIELD_T
class PCB_FIELD, text associated with a footprint property
Definition typeinfo.h:82
@ PCB_BARCODE_T
class PCB_BARCODE, a barcode (graphic item)
Definition typeinfo.h:93
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
Definition typeinfo.h:78
@ PCB_GRID_ITEM_T
a subgrid placed on a board
Definition typeinfo.h:238
@ PCB_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
Definition typeinfo.h:94
@ PCB_PAD_T
class PAD, a pad in a footprint
Definition typeinfo.h:79
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
Definition typeinfo.h:90
@ PCB_DIMENSION_T
class PCB_DIMENSION_BASE: abstract dimension meta-type
Definition typeinfo.h:92
@ PCB_TABLE_T
class PCB_TABLE, table of PCB_TABLECELLs
Definition typeinfo.h:86
@ PCB_STACKUP_TABLE_T
class PCB_STACKUP_TABLE, a live stackup table derived from PCB_TABLE
Definition typeinfo.h:242
@ PCB_POINT_T
class PCB_POINT, a 0-dimensional point
Definition typeinfo.h:105
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
Definition typeinfo.h:88
@ PCB_DIM_RADIAL_T
class PCB_DIM_RADIAL, a radius or diameter dimension
Definition typeinfo.h:97
@ PCB_DRILL_CHART_T
class PCB_DRILL_CHART, a live drill chart derived from PCB_TABLE
Definition typeinfo.h:239
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:708