KiCad PCB EDA Suite
footprint.h
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) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright (C) 1992-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#ifndef FOOTPRINT_H
26#define FOOTPRINT_H
27
28#include <deque>
29
31#include <board_item.h>
32#include <collectors.h>
33#include <layer_ids.h> // ALL_LAYERS definition.
34#include <lib_id.h>
35#include <list>
36
37#include <zones.h>
39#include <pcb_item_containers.h>
40#include <fp_text.h>
41#include <functional>
42
43class LINE_READER;
44class EDA_3D_CANVAS;
45class PAD;
46class BOARD;
47class MSG_PANEL_ITEM;
48class SHAPE;
49
50namespace KIGFX {
51class VIEW;
52}
53
55{
57 INCLUDE_NPTH = true
58};
59
66{
68 FP_SMD = 0x0002,
71 FP_BOARD_ONLY = 0x0010, // Footprint has no corresponding symbol
72 FP_JUST_ADDED = 0x0020, // Footprint just added by netlist update
75};
76
78{
79public:
81 // Initialize with sensible values
82 m_Scale { 1, 1, 1 },
83 m_Rotation { 0, 0, 0 },
84 m_Offset { 0, 0, 0 },
85 m_Opacity( 1.0 ),
86 m_Show( true )
87 {
88 }
89
90 struct VECTOR3D
91 {
92 double x, y, z;
93 };
94
98 double m_Opacity;
99 wxString m_Filename;
100 bool m_Show;
101};
102
103
105{
106public:
107 FOOTPRINT( BOARD* parent );
108
109 FOOTPRINT( const FOOTPRINT& aFootprint );
110
111 // Move constructor and operator needed due to std containers inside the footprint
112 FOOTPRINT( FOOTPRINT&& aFootprint );
113
114 ~FOOTPRINT();
115
116 FOOTPRINT& operator=( const FOOTPRINT& aOther );
117 FOOTPRINT& operator=( FOOTPRINT&& aOther );
118
119 static inline bool ClassOf( const EDA_ITEM* aItem )
120 {
121 return aItem && aItem->Type() == PCB_FOOTPRINT_T;
122 }
123
125 void SetPrivateLayers( LSET aLayers ) { m_privateLayers = aLayers; }
126
128 void Add( BOARD_ITEM* aItem, ADD_MODE aMode = ADD_MODE::INSERT,
129 bool aSkipConnectivity = false ) override;
130
132 void Remove( BOARD_ITEM* aItem, REMOVE_MODE aMode = REMOVE_MODE::NORMAL ) override;
133
141 void ClearAllNets();
142
150 bool FixUuids();
151
162
169
170 // Virtual function
171 const BOX2I GetBoundingBox() const override;
172 const BOX2I GetBoundingBox( bool aIncludeText, bool aIncludeInvisibleText ) const;
173
174 PADS& Pads() { return m_pads; }
175 const PADS& Pads() const { return m_pads; }
176
177 DRAWINGS& GraphicalItems() { return m_drawings; }
178 const DRAWINGS& GraphicalItems() const { return m_drawings; }
179
180 FP_ZONES& Zones() { return m_fp_zones; }
181 const FP_ZONES& Zones() const { return m_fp_zones; }
182
183 FP_GROUPS& Groups() { return m_fp_groups; }
184 const FP_GROUPS& Groups() const { return m_fp_groups; }
185
186 bool HasThroughHolePads() const;
187
188 std::vector<FP_3DMODEL>& Models() { return m_3D_Drawings; }
189 const std::vector<FP_3DMODEL>& Models() const { return m_3D_Drawings; }
190
191 void SetPosition( const VECTOR2I& aPos ) override;
192 VECTOR2I GetPosition() const override { return m_pos; }
193
194 void SetOrientation( const EDA_ANGLE& aNewAngle );
196
197 // For property system:
198 void SetOrientationDegrees( double aOrientation )
199 {
200 SetOrientation( EDA_ANGLE( aOrientation, DEGREES_T ) );
201 }
203 {
204 return m_orient.AsDegrees();
205 }
206
207 const LIB_ID& GetFPID() const { return m_fpid; }
208 void SetFPID( const LIB_ID& aFPID ) { m_fpid = aFPID; }
209
210 const wxString GetFPIDAsString() const { return m_fpid.Format(); }
211 void SetFPIDAsString( const wxString& aFPID ) { m_fpid.Parse( aFPID ); }
212
213 const wxString& GetDescription() const { return m_doc; }
214 void SetDescription( const wxString& aDoc ) { m_doc = aDoc; }
215
216 const wxString& GetKeywords() const { return m_keywords; }
217 void SetKeywords( const wxString& aKeywords ) { m_keywords = aKeywords; }
218
219 const KIID_PATH& GetPath() const { return m_path; }
220 void SetPath( const KIID_PATH& aPath ) { m_path = aPath; }
221
223 void SetLocalSolderMaskMargin( int aMargin ) { m_localSolderMaskMargin = aMargin; }
224
225 int GetLocalClearance() const { return m_localClearance; }
226 void SetLocalClearance( int aClearance ) { m_localClearance = aClearance; }
227
228 int GetLocalClearance( wxString* aSource ) const
229 {
230 if( aSource )
231 *aSource = wxString::Format( _( "footprint %s" ), GetReference() );
232
233 return m_localClearance;
234 }
235
237 void SetLocalSolderPasteMargin( int aMargin ) { m_localSolderPasteMargin = aMargin; }
238
241
244
245 int GetAttributes() const { return m_attributes; }
246 void SetAttributes( int aAttributes ) { m_attributes = aAttributes; }
247
248 void SetFlag( int aFlag ) { m_arflag = aFlag; }
249 void IncrementFlag() { m_arflag += 1; }
250 int GetFlag() const { return m_arflag; }
251
252 bool IsNetTie() const
253 {
254 for( const wxString& group : m_netTiePadGroups )
255 {
256 if( !group.IsEmpty() )
257 return true;
258 }
259
260 return false;
261 }
262
267 const std::vector<wxString>& GetNetTiePadGroups() const { return m_netTiePadGroups; }
268
270 {
271 m_netTiePadGroups.clear();
272 }
273
274 void AddNetTiePadGroup( const wxString& aGroup )
275 {
276 m_netTiePadGroups.emplace_back( aGroup );
277 }
278
283 std::map<wxString, int> MapPadNumbersToNetTieGroups() const;
284
288 std::vector<PAD*> GetNetTiePads( PAD* aPad ) const;
289
295 int GetLikelyAttribute() const;
296
297 void Move( const VECTOR2I& aMoveVector ) override;
298
299 void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override;
300
301 void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) override;
302
314 void MoveAnchorPosition( const VECTOR2I& aMoveVector );
315
319 bool IsFlipped() const { return GetLayer() == B_Cu; }
320
326 bool IsOnLayer( PCB_LAYER_ID aLayer ) const override;
327
328// m_footprintStatus bits:
329#define FP_is_LOCKED 0x01
330#define FP_is_PLACED 0x02
331#define FP_to_PLACE 0x04
332#define FP_PADS_are_LOCKED 0x08
333
334
335 bool IsLocked() const override
336 {
337 return ( m_fpStatus & FP_is_LOCKED ) != 0;
338 }
339
345 void SetLocked( bool isLocked ) override
346 {
347 if( isLocked )
349 else
350 m_fpStatus &= ~FP_is_LOCKED;
351 }
352
356 bool IsConflicting() const;
357
358 bool IsPlaced() const { return m_fpStatus & FP_is_PLACED; }
359 void SetIsPlaced( bool isPlaced )
360 {
361 if( isPlaced )
363 else
364 m_fpStatus &= ~FP_is_PLACED;
365 }
366
367 bool NeedsPlaced() const { return m_fpStatus & FP_to_PLACE; }
368 void SetNeedsPlaced( bool needsPlaced )
369 {
370 if( needsPlaced )
372 else
373 m_fpStatus &= ~FP_to_PLACE;
374 }
375
377
388 void CheckFootprintAttributes( const std::function<void( const wxString& )>& aErrorHandler );
389
396 void CheckPads( const std::function<void( const PAD*, int, const wxString& )>& aErrorHandler );
397
403 void CheckShortingPads( const std::function<void( const PAD*,
404 const PAD*,
405 const VECTOR2I& )>& aErrorHandler );
406
413 void CheckNetTies( const std::function<void( const BOARD_ITEM* aItem,
414 const BOARD_ITEM* bItem,
415 const BOARD_ITEM* cItem,
416 const VECTOR2I& )>& aErrorHandler );
417
424 void CheckNetTiePadGroups( const std::function<void( const wxString& )>& aErrorHandler );
425
447 PCB_LAYER_ID aLayer, int aClearance,
448 int aMaxError, ERROR_LOC aErrorLoc,
449 bool aSkipNPTHPadsWihNoCopper = false,
450 bool aSkipPlatedPads = false,
451 bool aSkipNonPlatedPads = false ) const;
452
468 PCB_LAYER_ID aLayer, int aClearance,
469 int aError, ERROR_LOC aErrorLoc,
470 bool aIncludeText = true,
471 bool aIncludeShapes = true,
472 bool aIncludePrivateItems = false ) const;
473
479 PCB_LAYER_ID aLayer, int aClearance,
480 int aError, ERROR_LOC aErrorLoc ) const
481 {
482 TransformFPShapesWithClearanceToPolygon( aCornerBuffer, aLayer, aClearance, aError,
483 aErrorLoc, true, false );
484 }
485
489 void GetContextualTextVars( wxArrayString* aVars ) const;
490
496 bool ResolveTextVar( wxString* token, int aDepth = 0 ) const;
497
499 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
500
501 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
502
512 bool HitTestAccurate( const VECTOR2I& aPosition, int aAccuracy = 0 ) const;
513
514 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
515
519 const wxString& GetReference() const
520 {
521 return m_reference->GetText();
522 }
523
528 void SetReference( const wxString& aReference )
529 {
530 m_reference->SetText( aReference );
531 }
532
536 void IncrementReference( int aDelta );
537
541 const wxString& GetValue() const
542 {
543 return m_value->GetText();
544 }
545
549 void SetValue( const wxString& aValue )
550 {
551 m_value->SetText( aValue );
552 }
553
555 FP_TEXT& Value() { return *m_value; }
557
559 FP_TEXT& Value() const { return *m_value; }
560 FP_TEXT& Reference() const { return *m_reference; }
561
562 const std::map<wxString, wxString>& GetProperties() const { return m_properties; }
563 void SetProperties( const std::map<wxString, wxString>& aProps ) { m_properties = aProps; }
564 const wxString& GetProperty( const wxString& aKey) { return m_properties[ aKey ]; }
565 bool HasProperty( const wxString& aKey)
566 {
567 return m_properties.find( aKey ) != m_properties.end();
568 }
569 void SetProperty( const wxString& aKey, const wxString& aVal ) { m_properties[ aKey ] = aVal; }
570
580 PAD* FindPadByNumber( const wxString& aPadNumber, PAD* aSearchAfterMe = nullptr ) const;
581
589 PAD* GetPad( const VECTOR2I& aPosition, LSET aLayerMask = LSET::AllLayersMask() );
590
598 unsigned GetPadCount( INCLUDE_NPTH_T aIncludeNPTH = INCLUDE_NPTH_T(INCLUDE_NPTH) ) const;
599
610 unsigned GetUniquePadCount( INCLUDE_NPTH_T aIncludeNPTH = INCLUDE_NPTH_T(INCLUDE_NPTH) ) const;
611
619 wxString GetNextPadNumber( const wxString& aLastPadName ) const;
620
625 wxString GetTypeName() const;
626
627 double GetArea( int aPadding = 0 ) const;
628
629 KIID GetLink() const { return m_link; }
630 void SetLink( const KIID& aLink ) { m_link = aLink; }
631
632 BOARD_ITEM* Duplicate() const override;
633
639 BOARD_ITEM* DuplicateItem( const BOARD_ITEM* aItem, bool aAddToFootprint = false );
640
646 void Add3DModel( FP_3DMODEL* a3DModel );
647
648 INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
649 const std::vector<KICAD_T>& aScanTypes ) override;
650
651 wxString GetClass() const override
652 {
653 return wxT( "FOOTPRINT" );
654 }
655
656 wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override;
657
658 BITMAPS GetMenuImage() const override;
659
660 EDA_ITEM* Clone() const override;
661
669 void RunOnChildren( const std::function<void (BOARD_ITEM*)>& aFunction ) const;
670
671 virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
672
673 double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
674
675 virtual const BOX2I ViewBBox() const override;
676
684 static bool IsLibNameValid( const wxString& aName );
685
695 static const wxChar* StringLibNameInvalidChars( bool aUserReadable );
696
700 bool FootprintNeedsUpdate( const FOOTPRINT* aLibFootprint );
701
716 void SetInitialComments( wxArrayString* aInitialComments )
717 {
718 delete m_initial_comments;
719 m_initial_comments = aInitialComments;
720 }
721
728 double CoverageRatio( const GENERAL_COLLECTOR& aCollector ) const;
729
730 static double GetCoverageArea( const BOARD_ITEM* aItem, const GENERAL_COLLECTOR& aCollector );
731
733 const wxArrayString* GetInitialComments() const { return m_initial_comments; }
734
740 const SHAPE_POLY_SET& GetCourtyard( PCB_LAYER_ID aLayer ) const;
741
748 void BuildCourtyardCaches( OUTLINE_ERROR_HANDLER* aErrorHandler = nullptr );
749
750 virtual std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
751 FLASHING aFlash = FLASHING::DEFAULT ) const override;
752
753 virtual void SwapData( BOARD_ITEM* aImage ) override;
754
756 {
757 bool operator()( const BOARD_ITEM* itemA, const BOARD_ITEM* itemB ) const;
758 };
759
760 struct cmp_pads
761 {
762 bool operator()( const PAD* aFirst, const PAD* aSecond ) const;
763 };
764
766 {
767 bool operator()( const FP_ZONE* aFirst, const FP_ZONE* aSecond ) const;
768 };
769
770
771#if defined(DEBUG)
772 virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
773#endif
774
775private:
776 DRAWINGS m_drawings; // BOARD_ITEMs for drawings on the board, owned by pointer.
777 PADS m_pads; // PAD items, owned by pointer
778 FP_ZONES m_fp_zones; // FP_ZONE items, owned by pointer
779 FP_GROUPS m_fp_groups; // PCB_GROUP items, owned by pointer
780
781 EDA_ANGLE m_orient; // Orientation
782 VECTOR2I m_pos; // Position of footprint on the board in internal units.
783 FP_TEXT* m_reference; // Component reference designator value (U34, R18..)
784 FP_TEXT* m_value; // Component value (74LS00, 22K..)
785 LIB_ID m_fpid; // The #LIB_ID of the FOOTPRINT.
786 int m_attributes; // Flag bits (see FOOTPRINT_ATTR_T)
787 int m_fpStatus; // For autoplace: flags (LOCKED, FIELDS_AUTOPLACED)
788
789 // Bounding box caching strategy:
790 // While we attempt to notice the low-hanging fruit operations and update the bounding boxes
791 // accordingly, we rely mostly on a "if anything changed then the caches are stale" approach.
792 // We implement this by having PCB_BASE_FRAME's OnModify() method increment an operation
793 // counter, and storing that as a timestamp for the various caches.
794 // This means caches will get regenerated often -- but still far less often than if we had no
795 // caches at all. The principal opitmization would be to change to dirty flag and make sure
796 // that any edit that could affect the bounding boxes (including edits to the footprint
797 // children) marked the bounding boxes dirty. It would definitely be faster -- but also more
798 // fragile.
807
808 // A list of pad groups, each of which is allowed to short nets within their group.
809 // A pad group is a comma-separated list of pad numbers.
810 std::vector<wxString> m_netTiePadGroups;
811
814 int m_localSolderMaskMargin; // Solder mask margin
815 int m_localSolderPasteMargin; // Solder paste margin absolute value
816 double m_localSolderPasteMarginRatio; // Solder mask margin ratio value of pad size
817
818 wxString m_doc; // File name and path for documentation file.
819 wxString m_keywords; // Search keywords to find footprint in library.
820 KIID_PATH m_path; // Path to associated symbol ([sheetUUID, .., symbolUUID]).
822 int m_arflag; // Use to trace ratsnest and auto routing.
823 KIID m_link; // Temporary logical link used during editing
824 LSET m_privateLayers; // Layers visible only in the footprint editor
825
826 std::vector<FP_3DMODEL> m_3D_Drawings; // 3D models.
827 std::map<wxString, wxString> m_properties;
828 wxArrayString* m_initial_comments; // s-expression comments in the footprint,
829 // lazily allocated only if needed for speed
830
831 SHAPE_POLY_SET m_courtyard_cache_front; // Note that a footprint can have both front and back
832 SHAPE_POLY_SET m_courtyard_cache_back; // courtyards populated.
834};
835
836#endif // FOOTPRINT_H
BITMAPS
A list of all bitmap identifiers.
Definition: bitmaps_list.h:33
Abstract interface for BOARD_ITEMs capable of storing other items inside.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:52
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:169
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:265
Implement a canvas based on a wxGLCanvas.
Definition: eda_3d_canvas.h:49
double AsDegrees() const
Definition: eda_angle.h:149
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:111
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:87
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:163
bool FixUuids()
Old footprints do not always have a valid UUID (some can be set to null uuid) However null UUIDs,...
Definition: footprint.cpp:226
void CheckShortingPads(const std::function< void(const PAD *, const PAD *, const VECTOR2I &)> &aErrorHandler)
Check for overlapping, different-numbered, non-net-tie pads.
Definition: footprint.cpp:2403
void SetPosition(const VECTOR2I &aPos) override
Definition: footprint.cpp:1636
void SetFPID(const LIB_ID &aFPID)
Definition: footprint.h:208
LIB_ID m_fpid
Definition: footprint.h:785
void SetLink(const KIID &aLink)
Definition: footprint.h:630
KIID_PATH m_path
Definition: footprint.h:820
void TransformFPShapesWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc, bool aIncludeText=true, bool aIncludeShapes=true, bool aIncludePrivateItems=false) const
Generate shapes of graphic items (outlines) on layer aLayer as polygons and adds these polygons to aC...
Definition: footprint.cpp:2761
BOX2I m_cachedTextExcludedBBox
Definition: footprint.h:803
void CheckPads(const std::function< void(const PAD *, int, const wxString &)> &aErrorHandler)
Run non-board-specific DRC checks on footprint's pads.
Definition: footprint.cpp:2323
void SetLocked(bool isLocked) override
Set the #MODULE_is_LOCKED bit in the m_ModuleStatus.
Definition: footprint.h:345
std::vector< PAD * > GetNetTiePads(PAD *aPad) const
Definition: footprint.cpp:2272
bool ResolveTextVar(wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the component.
Definition: footprint.cpp:481
EDA_ANGLE GetOrientation() const
Definition: footprint.h:195
const FP_GROUPS & Groups() const
Definition: footprint.h:184
FP_TEXT & Value() const
The const versions to keep the compiler happy.
Definition: footprint.h:559
void Remove(BOARD_ITEM *aItem, REMOVE_MODE aMode=REMOVE_MODE::NORMAL) override
Removes an item from the container.
Definition: footprint.cpp:609
void SetIsPlaced(bool isPlaced)
Definition: footprint.h:359
ZONE_CONNECTION m_zoneConnection
Definition: footprint.h:812
BOX2I m_cachedBoundingBox
Definition: footprint.h:799
static double GetCoverageArea(const BOARD_ITEM *aItem, const GENERAL_COLLECTOR &aCollector)
Return the initial comments block or NULL if none, without transfer of ownership.
Definition: footprint.cpp:1991
void SetOrientation(const EDA_ANGLE &aNewAngle)
Definition: footprint.cpp:1766
void SetFlag(int aFlag)
Definition: footprint.h:248
FP_ZONES m_fp_zones
Definition: footprint.h:778
static bool IsLibNameValid(const wxString &aName)
Test for validity of a name of a footprint to be used in a footprint library ( no spaces,...
Definition: footprint.cpp:1493
unsigned GetPadCount(INCLUDE_NPTH_T aIncludeNPTH=INCLUDE_NPTH_T(INCLUDE_NPTH)) const
Return the number of pads.
Definition: footprint.cpp:1187
void IncrementFlag()
Definition: footprint.h:249
void CheckNetTies(const std::function< void(const BOARD_ITEM *aItem, const BOARD_ITEM *bItem, const BOARD_ITEM *cItem, const VECTOR2I &)> &aErrorHandler)
Check for un-allowed shorting of pads in net-tie footprints.
Definition: footprint.cpp:2449
int m_fpStatus
Definition: footprint.h:787
void SetDescription(const wxString &aDoc)
Definition: footprint.h:214
void SetPath(const KIID_PATH &aPath)
Definition: footprint.h:220
double ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
Definition: footprint.cpp:1434
SHAPE_POLY_SET m_cachedHull
Definition: footprint.h:805
int GetLocalClearance() const
Definition: footprint.h:225
void SetKeywords(const wxString &aKeywords)
Definition: footprint.h:217
const DRAWINGS & GraphicalItems() const
Definition: footprint.h:178
int m_localSolderPasteMargin
Definition: footprint.h:815
void SetInitialComments(wxArrayString *aInitialComments)
Take ownership of caller's heap allocated aInitialComments block.
Definition: footprint.h:716
int m_attributes
Definition: footprint.h:786
std::vector< FP_3DMODEL > m_3D_Drawings
Definition: footprint.h:826
double CoverageRatio(const GENERAL_COLLECTOR &aCollector) const
Calculate the ratio of total area of the footprint pads and graphical items to the area of the footpr...
Definition: footprint.cpp:2078
BOARD_ITEM * DuplicateItem(const BOARD_ITEM *aItem, bool aAddToFootprint=false)
Duplicate a given item within the footprint, optionally adding it to the board.
Definition: footprint.cpp:1832
virtual std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=FLASHING::DEFAULT) const override
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
Definition: footprint.cpp:2147
void SetAttributes(int aAttributes)
Definition: footprint.h:246
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: footprint.cpp:1344
double m_localSolderPasteMarginRatio
Definition: footprint.h:816
wxArrayString * m_initial_comments
Definition: footprint.h:828
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: footprint.cpp:1350
BOX2I m_cachedVisibleBBox
Definition: footprint.h:801
double GetLocalSolderPasteMarginRatio() const
Definition: footprint.h:239
BOX2I GetFpPadsLocalBbox() const
Return the bounding box containing pads when the footprint is on the front side, orientation 0,...
Definition: footprint.cpp:761
int m_visibleBBoxCacheTimeStamp
Definition: footprint.h:802
std::map< wxString, wxString > m_properties
Definition: footprint.h:827
const wxString & GetKeywords() const
Definition: footprint.h:216
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
Definition: footprint.cpp:1528
int m_localClearance
Definition: footprint.h:813
void SetLocalSolderPasteMarginRatio(double aRatio)
Definition: footprint.h:240
void SetOrientationDegrees(double aOrientation)
Definition: footprint.h:198
FP_GROUPS & Groups()
Definition: footprint.h:183
void SetPrivateLayers(LSET aLayers)
Adds an item to the container.
Definition: footprint.h:125
std::map< wxString, int > MapPadNumbersToNetTieGroups() const
Definition: footprint.cpp:2252
void MoveAnchorPosition(const VECTOR2I &aMoveVector)
Move the reference point of the footprint.
Definition: footprint.cpp:1692
void SetProperty(const wxString &aKey, const wxString &aVal)
Definition: footprint.h:569
FOOTPRINT & operator=(const FOOTPRINT &aOther)
Definition: footprint.cpp:361
int m_arflag
Definition: footprint.h:822
double GetOrientationDegrees() const
Definition: footprint.h:202
BOARD_ITEM * Duplicate() const override
Create a copy of this BOARD_ITEM.
Definition: footprint.cpp:1819
void SetLocalSolderPasteMargin(int aMargin)
Definition: footprint.h:237
INSPECT_RESULT Visit(INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &aScanTypes) override
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: footprint.cpp:1248
int GetAttributes() const
Definition: footprint.h:245
int m_localSolderMaskMargin
Definition: footprint.h:814
virtual void SwapData(BOARD_ITEM *aImage) override
Swap data between aItem and aImage.
Definition: footprint.cpp:2584
FOOTPRINT(BOARD *parent)
Definition: footprint.cpp:55
void ClearNetTiePadGroups()
Definition: footprint.h:269
bool FootprintNeedsUpdate(const FOOTPRINT *aLibFootprint)
Return true if a board footprint differs from the library version.
LSET GetPrivateLayers() const
Definition: footprint.h:124
bool IsFlipped() const
Definition: footprint.h:319
int GetLocalClearance(wxString *aSource) const
Definition: footprint.h:228
PADS & Pads()
Definition: footprint.h:174
SHAPE_POLY_SET GetBoundingHull() const
Return a bounding polygon for the shapes and pads in the footprint.
Definition: footprint.cpp:913
int GetLocalSolderPasteMargin() const
Definition: footprint.h:236
FP_TEXT & Reference() const
Definition: footprint.h:560
wxString GetTypeName() const
Get the type of footprint.
Definition: footprint.cpp:749
DRAWINGS m_drawings
Definition: footprint.h:776
bool NeedsPlaced() const
Definition: footprint.h:367
SHAPE_POLY_SET m_courtyard_cache_back
Definition: footprint.h:832
int m_textExcludedBBoxCacheTimeStamp
Definition: footprint.h:804
const std::vector< wxString > & GetNetTiePadGroups() const
Definition: footprint.h:267
void SetLocalClearance(int aClearance)
Definition: footprint.h:226
const LIB_ID & GetFPID() const
Definition: footprint.h:207
void SetReference(const wxString &aReference)
Definition: footprint.h:528
bool IsLocked() const override
Definition: footprint.h:335
const wxString GetFPIDAsString() const
Definition: footprint.h:210
void SetLocalSolderMaskMargin(int aMargin)
Definition: footprint.h:223
int m_hullCacheTimeStamp
Definition: footprint.h:806
unsigned GetUniquePadCount(INCLUDE_NPTH_T aIncludeNPTH=INCLUDE_NPTH_T(INCLUDE_NPTH)) const
Return the number of unique non-blank pads.
Definition: footprint.cpp:1206
void AddNetTiePadGroup(const wxString &aGroup)
Definition: footprint.h:274
bool LegacyPadsLocked() const
Definition: footprint.h:376
virtual const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
Definition: footprint.cpp:1475
LSET m_privateLayers
Definition: footprint.h:824
void TransformPadsWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, PCB_LAYER_ID aLayer, int aClearance, int aMaxError, ERROR_LOC aErrorLoc, bool aSkipNPTHPadsWihNoCopper=false, bool aSkipPlatedPads=false, bool aSkipNonPlatedPads=false) const
Generate pads shapes on layer aLayer as polygons and adds these polygons to aCornerBuffer.
Definition: footprint.cpp:2683
int GetLikelyAttribute() const
Returns the most likely attribute based on pads Either FP_THROUGH_HOLE/FP_SMD/OTHER(0)
Definition: footprint.cpp:701
void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition: footprint.cpp:1521
static bool ClassOf(const EDA_ITEM *aItem)
Definition: footprint.h:119
VECTOR2I m_pos
Definition: footprint.h:782
std::vector< wxString > m_netTiePadGroups
Definition: footprint.h:810
PAD * GetPad(const VECTOR2I &aPosition, LSET aLayerMask=LSET::AllLayersMask())
Get a pad at aPosition on aLayerMask in the footprint.
Definition: footprint.cpp:1171
void Add3DModel(FP_3DMODEL *a3DModel)
Add a3DModel definition to the end of the 3D model list.
Definition: footprint.cpp:1237
void SetValue(const wxString &aValue)
Definition: footprint.h:549
bool HasProperty(const wxString &aKey)
Definition: footprint.h:565
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
Definition: footprint.cpp:996
FP_TEXT & Value()
read/write accessors:
Definition: footprint.h:555
void GetContextualTextVars(wxArrayString *aVars) const
Return the list of system text vars for this footprint.
Definition: footprint.cpp:468
SHAPE_POLY_SET m_courtyard_cache_front
Definition: footprint.h:831
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition: footprint.cpp:549
const wxString & GetDescription() const
Definition: footprint.h:213
wxString m_keywords
Definition: footprint.h:819
void ClearAllNets()
Clear (i.e.
Definition: footprint.cpp:540
void SetZoneConnection(ZONE_CONNECTION aType)
Definition: footprint.h:242
bool HasThroughHolePads() const
Definition: footprint.cpp:2592
void BuildCourtyardCaches(OUTLINE_ERROR_HANDLER *aErrorHandler=nullptr)
Build complex polygons of the courtyard areas from graphic items on the courtyard layers.
Definition: footprint.cpp:2195
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
A special IsOnLayer for footprints: return true if the footprint contains only items on the given lay...
Definition: footprint.cpp:1063
EDA_ANGLE m_orient
Definition: footprint.h:781
bool HitTestAccurate(const VECTOR2I &aPosition, int aAccuracy=0) const
Test if a point is inside the bounding polygon of the footprint.
Definition: footprint.cpp:1093
bool IsNetTie() const
Definition: footprint.h:252
wxString GetClass() const override
Return the class name.
Definition: footprint.h:651
const PADS & Pads() const
Definition: footprint.h:175
void IncrementReference(int aDelta)
Bump the current reference by aDelta.
Definition: footprint.cpp:1964
KIID m_link
Definition: footprint.h:823
const wxArrayString * GetInitialComments() const
Definition: footprint.h:733
KIID GetLink() const
Definition: footprint.h:629
bool IsConflicting() const
Definition: footprint.cpp:462
std::vector< FP_3DMODEL > & Models()
Definition: footprint.h:188
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction) const
Invoke a function on all BOARD_ITEMs that belong to the footprint (pads, drawings,...
Definition: footprint.cpp:1356
static const wxChar * StringLibNameInvalidChars(bool aUserReadable)
Test for validity of the name in a library of the footprint ( no spaces, dir separators ....
Definition: footprint.cpp:1504
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: footprint.cpp:1553
const wxString & GetValue() const
Definition: footprint.h:541
wxString GetSelectMenuText(UNITS_PROVIDER *aUnitsProvider) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
Definition: footprint.cpp:1333
double GetArea(int aPadding=0) const
Definition: footprint.cpp:691
FP_TEXT * m_value
Definition: footprint.h:784
void SetNeedsPlaced(bool needsPlaced)
Definition: footprint.h:368
ZONE_CONNECTION GetZoneConnection() const
Definition: footprint.h:243
const wxString & GetReference() const
Definition: footprint.h:519
void CheckNetTiePadGroups(const std::function< void(const wxString &)> &aErrorHandler)
Sanity check net-tie pad groups.
Definition: footprint.cpp:2555
void SetFPIDAsString(const wxString &aFPID)
Definition: footprint.h:211
const std::vector< FP_3DMODEL > & Models() const
Definition: footprint.h:189
void SetProperties(const std::map< wxString, wxString > &aProps)
Definition: footprint.h:563
timestamp_t m_lastEditTime
Definition: footprint.h:821
const SHAPE_POLY_SET & GetCourtyard(PCB_LAYER_ID aLayer) const
Used in DRC to test the courtyard area (a complex polygon).
Definition: footprint.cpp:2183
int GetFlag() const
Definition: footprint.h:250
virtual void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
Definition: footprint.cpp:1382
wxString m_doc
Definition: footprint.h:818
const KIID_PATH & GetPath() const
Definition: footprint.h:219
FP_ZONES & Zones()
Definition: footprint.h:180
void CheckFootprintAttributes(const std::function< void(const wxString &)> &aErrorHandler)
Test if footprint attributes for type (SMD/Through hole/Other) match the expected type based on the p...
Definition: footprint.cpp:2294
const wxString & GetProperty(const wxString &aKey)
Definition: footprint.h:564
PADS m_pads
Definition: footprint.h:777
wxString GetNextPadNumber(const wxString &aLastPadName) const
Return the next available pad number in the footprint.
Definition: footprint.cpp:1944
bool IsPlaced() const
Definition: footprint.h:358
int m_courtyard_cache_timestamp
Definition: footprint.h:833
int m_boundingBoxCacheTimeStamp
Definition: footprint.h:800
VECTOR2I GetPosition() const override
Definition: footprint.h:192
DRAWINGS & GraphicalItems()
Definition: footprint.h:177
FP_GROUPS m_fp_groups
Definition: footprint.h:779
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:1086
FP_TEXT & Reference()
Definition: footprint.h:556
const FP_ZONES & Zones() const
Definition: footprint.h:181
void TransformFPTextWithClearanceToPolygonSet(SHAPE_POLY_SET &aCornerBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc) const
This function is the same as TransformGraphicShapesWithClearanceToPolygonSet but only generate text.
Definition: footprint.h:478
PAD * FindPadByNumber(const wxString &aPadNumber, PAD *aSearchAfterMe=nullptr) const
Return a PAD with a matching number.
Definition: footprint.cpp:1151
int GetLocalSolderMaskMargin() const
Definition: footprint.h:222
const std::map< wxString, wxString > & GetProperties() const
Definition: footprint.h:562
FP_TEXT * m_reference
Definition: footprint.h:783
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: footprint.cpp:782
VECTOR3D m_Offset
3D model offset (mm)
Definition: footprint.h:97
double m_Opacity
Definition: footprint.h:98
VECTOR3D m_Rotation
3D model rotation (degrees)
Definition: footprint.h:96
FP_3DMODEL()
Definition: footprint.h:80
VECTOR3D m_Scale
3D model scaling factor (dimensionless)
Definition: footprint.h:95
wxString m_Filename
The 3D shape filename in 3D library.
Definition: footprint.h:99
bool m_Show
Include model in rendering.
Definition: footprint.h:100
A specialization of ZONE for use in footprints.
Definition: zone.h:897
Used when the right click button is pressed, or when the select tool is in effect.
Definition: collectors.h:204
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:69
Definition: kiid.h:47
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:49
int Parse(const UTF8 &aId, bool aFix=false)
Parse LIB_ID with the information from aId.
Definition: lib_id.cpp:50
UTF8 Format() const
Definition: lib_id.cpp:117
An abstract class from which implementation specific LINE_READERs may be derived to read single lines...
Definition: richio.h:81
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:530
static LSET AllLayersMask()
Definition: lset.cpp:808
EDA_MSG_PANEL items for displaying messages.
Definition: msgpanel.h:54
Definition: pad.h:58
Represent a set of closed polygons.
An abstract shape on 2D plane.
Definition: shape.h:123
const std::function< void(const wxString &msg, BOARD_ITEM *itemA, BOARD_ITEM *itemB, const VECTOR2I &pt)> OUTLINE_ERROR_HANDLER
#define _(s)
@ DEGREES_T
Definition: eda_angle.h:31
INSPECT_RESULT
Definition: eda_item.h:43
const INSPECTOR_FUNC & INSPECTOR
Definition: eda_item.h:92
INCLUDE_NPTH_T
Definition: footprint.h:55
@ INCLUDE_NPTH
Definition: footprint.h:57
@ DO_NOT_INCLUDE_NPTH
Definition: footprint.h:56
FOOTPRINT_ATTR_T
The set of attributes allowed within a FOOTPRINT, using FOOTPRINT::SetAttributes() and FOOTPRINT::Get...
Definition: footprint.h:66
@ FP_SMD
Definition: footprint.h:68
@ FP_ALLOW_MISSING_COURTYARD
Definition: footprint.h:74
@ FP_EXCLUDE_FROM_POS_FILES
Definition: footprint.h:69
@ FP_BOARD_ONLY
Definition: footprint.h:71
@ FP_EXCLUDE_FROM_BOM
Definition: footprint.h:70
@ FP_JUST_ADDED
Definition: footprint.h:72
@ FP_THROUGH_HOLE
Definition: footprint.h:67
@ FP_ALLOW_SOLDERMASK_BRIDGES
Definition: footprint.h:73
#define FP_is_PLACED
In autoplace: footprint automatically placed.
Definition: footprint.h:330
#define FP_is_LOCKED
footprint LOCKED: no autoplace allowed
Definition: footprint.h:329
#define FP_PADS_are_LOCKED
Definition: footprint.h:332
#define FP_to_PLACE
In autoplace: footprint waiting for autoplace.
Definition: footprint.h:331
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
uint32_t timestamp_t
timestamp_t is our type to represent unique IDs for all kinds of elements; historically simply the ti...
Definition: kiid.h:44
FLASHING
Enum used during connectivity building to ensure we do not query connectivity while building the data...
Definition: layer_ids.h:147
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:59
@ B_Cu
Definition: layer_ids.h:95
@ UNDEFINED_LAYER
Definition: layer_ids.h:60
The Cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:243
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
bool operator()(const BOARD_ITEM *itemA, const BOARD_ITEM *itemB) const
Definition: footprint.cpp:2608
bool operator()(const PAD *aFirst, const PAD *aSecond) const
Definition: footprint.cpp:2649
bool operator()(const FP_ZONE *aFirst, const FP_ZONE *aSecond) const
Definition: footprint.cpp:2664
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
Definition: typeinfo.h:86
ZONE_CONNECTION
How pads are covered by copper in zone.
Definition: zones.h:50