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#include <math/vector3.h>
43
44class LINE_READER;
45class EDA_3D_CANVAS;
46class PAD;
47class BOARD;
48class MSG_PANEL_ITEM;
49class SHAPE;
50
51namespace KIGFX {
52class VIEW;
53}
54
56{
58 INCLUDE_NPTH = true
59};
60
67{
69 FP_SMD = 0x0002,
72 FP_BOARD_ONLY = 0x0010, // Footprint has no corresponding symbol
73 FP_JUST_ADDED = 0x0020, // Footprint just added by netlist update
76};
77
79{
80public:
82 // Initialize with sensible values
83 m_Scale { 1, 1, 1 },
84 m_Rotation { 0, 0, 0 },
85 m_Offset { 0, 0, 0 },
86 m_Opacity( 1.0 ),
87 m_Show( true )
88 {
89 }
90
94 double m_Opacity;
95 wxString m_Filename;
96 bool m_Show;
97};
98
99
101{
102public:
103 FOOTPRINT( BOARD* parent );
104
105 FOOTPRINT( const FOOTPRINT& aFootprint );
106
107 // Move constructor and operator needed due to std containers inside the footprint
108 FOOTPRINT( FOOTPRINT&& aFootprint );
109
110 ~FOOTPRINT();
111
112 FOOTPRINT& operator=( const FOOTPRINT& aOther );
113 FOOTPRINT& operator=( FOOTPRINT&& aOther );
114
115 static inline bool ClassOf( const EDA_ITEM* aItem )
116 {
117 return aItem && aItem->Type() == PCB_FOOTPRINT_T;
118 }
119
121 void SetPrivateLayers( LSET aLayers ) { m_privateLayers = aLayers; }
122
124 void Add( BOARD_ITEM* aItem, ADD_MODE aMode = ADD_MODE::INSERT,
125 bool aSkipConnectivity = false ) override;
126
128 void Remove( BOARD_ITEM* aItem, REMOVE_MODE aMode = REMOVE_MODE::NORMAL ) override;
129
137 void ClearAllNets();
138
146 bool FixUuids();
147
158
165
166 // Virtual function
167 const BOX2I GetBoundingBox() const override;
168 const BOX2I GetBoundingBox( bool aIncludeText, bool aIncludeInvisibleText ) const;
169
170 PADS& Pads() { return m_pads; }
171 const PADS& Pads() const { return m_pads; }
172
173 DRAWINGS& GraphicalItems() { return m_drawings; }
174 const DRAWINGS& GraphicalItems() const { return m_drawings; }
175
176 FP_ZONES& Zones() { return m_fp_zones; }
177 const FP_ZONES& Zones() const { return m_fp_zones; }
178
179 FP_GROUPS& Groups() { return m_fp_groups; }
180 const FP_GROUPS& Groups() const { return m_fp_groups; }
181
182 bool HasThroughHolePads() const;
183
184 std::vector<FP_3DMODEL>& Models() { return m_3D_Drawings; }
185 const std::vector<FP_3DMODEL>& Models() const { return m_3D_Drawings; }
186
187 void SetPosition( const VECTOR2I& aPos ) override;
188 VECTOR2I GetPosition() const override { return m_pos; }
189
190 void SetOrientation( const EDA_ANGLE& aNewAngle );
192
197 void SetLayerAndFlip( PCB_LAYER_ID aLayer );
198
199 // to make property magic work
200 PCB_LAYER_ID GetLayer() const override { return BOARD_ITEM::GetLayer(); }
201
202 // For property system:
203 void SetOrientationDegrees( double aOrientation )
204 {
205 SetOrientation( EDA_ANGLE( aOrientation, DEGREES_T ) );
206 }
208 {
209 return m_orient.AsDegrees();
210 }
211
212 const LIB_ID& GetFPID() const { return m_fpid; }
213 void SetFPID( const LIB_ID& aFPID ) { m_fpid = aFPID; }
214
215 wxString GetFPIDAsString() const { return m_fpid.Format(); }
216 void SetFPIDAsString( const wxString& aFPID ) { m_fpid.Parse( aFPID ); }
217
218 wxString GetDescription() const { return m_doc; }
219 void SetDescription( const wxString& aDoc ) { m_doc = aDoc; }
220
221 wxString GetKeywords() const { return m_keywords; }
222 void SetKeywords( const wxString& aKeywords ) { m_keywords = aKeywords; }
223
224 const KIID_PATH& GetPath() const { return m_path; }
225 void SetPath( const KIID_PATH& aPath ) { m_path = aPath; }
226
228 void SetLocalSolderMaskMargin( int aMargin ) { m_localSolderMaskMargin = aMargin; }
229
230 int GetLocalClearance() const { return m_localClearance; }
231 void SetLocalClearance( int aClearance ) { m_localClearance = aClearance; }
232
233 int GetLocalClearance( wxString* aSource ) const
234 {
235 if( aSource )
236 *aSource = wxString::Format( _( "footprint %s" ), GetReference() );
237
238 return m_localClearance;
239 }
240
242 void SetLocalSolderPasteMargin( int aMargin ) { m_localSolderPasteMargin = aMargin; }
243
246
249
250 int GetAttributes() const { return m_attributes; }
251 void SetAttributes( int aAttributes ) { m_attributes = aAttributes; }
252
253 void SetFlag( int aFlag ) { m_arflag = aFlag; }
254 void IncrementFlag() { m_arflag += 1; }
255 int GetFlag() const { return m_arflag; }
256
257 bool IsNetTie() const
258 {
259 for( const wxString& group : m_netTiePadGroups )
260 {
261 if( !group.IsEmpty() )
262 return true;
263 }
264
265 return false;
266 }
267
272 const std::vector<wxString>& GetNetTiePadGroups() const { return m_netTiePadGroups; }
273
275 {
276 m_netTiePadGroups.clear();
277 }
278
279 void AddNetTiePadGroup( const wxString& aGroup )
280 {
281 m_netTiePadGroups.emplace_back( aGroup );
282 }
283
288 std::map<wxString, int> MapPadNumbersToNetTieGroups() const;
289
293 std::vector<PAD*> GetNetTiePads( PAD* aPad ) const;
294
300 int GetLikelyAttribute() const;
301
302 void Move( const VECTOR2I& aMoveVector ) override;
303
304 void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override;
305
306 void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) override;
307
319 void MoveAnchorPosition( const VECTOR2I& aMoveVector );
320
324 bool IsFlipped() const { return GetLayer() == B_Cu; }
325
331 bool IsOnLayer( PCB_LAYER_ID aLayer ) const override;
332
333// m_footprintStatus bits:
334#define FP_is_LOCKED 0x01
335#define FP_is_PLACED 0x02
336#define FP_to_PLACE 0x04
337#define FP_PADS_are_LOCKED 0x08
338
339
340 bool IsLocked() const override
341 {
342 return ( m_fpStatus & FP_is_LOCKED ) != 0;
343 }
344
350 void SetLocked( bool isLocked ) override
351 {
352 if( isLocked )
354 else
355 m_fpStatus &= ~FP_is_LOCKED;
356 }
357
361 bool IsConflicting() const;
362
363 bool IsPlaced() const { return m_fpStatus & FP_is_PLACED; }
364 void SetIsPlaced( bool isPlaced )
365 {
366 if( isPlaced )
368 else
369 m_fpStatus &= ~FP_is_PLACED;
370 }
371
372 bool NeedsPlaced() const { return m_fpStatus & FP_to_PLACE; }
373 void SetNeedsPlaced( bool needsPlaced )
374 {
375 if( needsPlaced )
377 else
378 m_fpStatus &= ~FP_to_PLACE;
379 }
380
382
393 void CheckFootprintAttributes( const std::function<void( const wxString& )>& aErrorHandler );
394
401 void CheckPads( const std::function<void( const PAD*, int, const wxString& )>& aErrorHandler );
402
408 void CheckShortingPads( const std::function<void( const PAD*,
409 const PAD*,
410 const VECTOR2I& )>& aErrorHandler );
411
418 void CheckNetTies( const std::function<void( const BOARD_ITEM* aItem,
419 const BOARD_ITEM* bItem,
420 const BOARD_ITEM* cItem,
421 const VECTOR2I& )>& aErrorHandler );
422
429 void CheckNetTiePadGroups( const std::function<void( const wxString& )>& aErrorHandler );
430
451 void TransformPadsToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
452 int aMaxError, ERROR_LOC aErrorLoc,
453 bool aSkipNPTHPadsWihNoCopper = false,
454 bool aSkipPlatedPads = false,
455 bool aSkipNonPlatedPads = false ) const;
456
471 void TransformFPShapesToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
472 int aError, ERROR_LOC aErrorLoc,
473 bool aIncludeText = true,
474 bool aIncludeShapes = true,
475 bool aIncludePrivateItems = false ) const;
476
480 void TransformFPTextToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
481 int aError, ERROR_LOC aErrorLoc ) const
482 {
483 TransformFPShapesToPolySet( aBuffer, aLayer, aClearance, aError, 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
533 // Property system doesn't like const references
534 wxString GetReferenceAsString() const
535 {
536 return GetReference();
537 }
538
542 void IncrementReference( int aDelta );
543
547 const wxString& GetValue() const
548 {
549 return m_value->GetText();
550 }
551
555 void SetValue( const wxString& aValue )
556 {
557 m_value->SetText( aValue );
558 }
559
560 // Property system doesn't like const references
561 wxString GetValueAsString() const
562 {
563 return GetValue();
564 }
565
567 FP_TEXT& Value() { return *m_value; }
569
571 FP_TEXT& Value() const { return *m_value; }
572 FP_TEXT& Reference() const { return *m_reference; }
573
574 const std::map<wxString, wxString>& GetProperties() const { return m_properties; }
575 void SetProperties( const std::map<wxString, wxString>& aProps ) { m_properties = aProps; }
576 const wxString& GetProperty( const wxString& aKey) { return m_properties[ aKey ]; }
577 bool HasProperty( const wxString& aKey)
578 {
579 return m_properties.find( aKey ) != m_properties.end();
580 }
581 void SetProperty( const wxString& aKey, const wxString& aVal ) { m_properties[ aKey ] = aVal; }
582
583 bool IsBoardOnly() const { return m_attributes & FP_BOARD_ONLY; }
584 void SetBoardOnly( bool aIsBoardOnly = true )
585 {
586 if( aIsBoardOnly )
588 else
589 m_attributes &= ~FP_BOARD_ONLY;
590 }
591
593 void SetExcludedFromPosFiles( bool aExclude = true )
594 {
595 if( aExclude )
597 else
598 m_attributes &= ~FP_EXCLUDE_FROM_POS_FILES;
599 }
600
602 void SetExcludedFromBOM( bool aExclude = true )
603 {
604 if( aExclude )
606 else
607 m_attributes &= ~FP_EXCLUDE_FROM_BOM;
608 }
609
611 void SetAllowMissingCourtyard( bool aAllow = true )
612 {
613 if( aAllow )
615 else
616 m_attributes &= ~FP_ALLOW_MISSING_COURTYARD;
617 }
618
619 void SetFileFormatVersionAtLoad( int aVersion ) { m_fileFormatVersionAtLoad = aVersion; }
621
631 PAD* FindPadByNumber( const wxString& aPadNumber, PAD* aSearchAfterMe = nullptr ) const;
632
640 PAD* GetPad( const VECTOR2I& aPosition, LSET aLayerMask = LSET::AllLayersMask() );
641
649 unsigned GetPadCount( INCLUDE_NPTH_T aIncludeNPTH = INCLUDE_NPTH_T(INCLUDE_NPTH) ) const;
650
661 unsigned GetUniquePadCount( INCLUDE_NPTH_T aIncludeNPTH = INCLUDE_NPTH_T(INCLUDE_NPTH) ) const;
662
670 wxString GetNextPadNumber( const wxString& aLastPadName ) const;
671
676 wxString GetTypeName() const;
677
678 double GetArea( int aPadding = 0 ) const;
679
680 KIID GetLink() const { return m_link; }
681 void SetLink( const KIID& aLink ) { m_link = aLink; }
682
683 BOARD_ITEM* Duplicate() const override;
684
690 BOARD_ITEM* DuplicateItem( const BOARD_ITEM* aItem, bool aAddToFootprint = false );
691
697 void Add3DModel( FP_3DMODEL* a3DModel );
698
699 INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
700 const std::vector<KICAD_T>& aScanTypes ) override;
701
702 wxString GetClass() const override
703 {
704 return wxT( "FOOTPRINT" );
705 }
706
707 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
708
709 BITMAPS GetMenuImage() const override;
710
711 EDA_ITEM* Clone() const override;
712
720 void RunOnChildren( const std::function<void (BOARD_ITEM*)>& aFunction ) const;
721
722 virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
723
724 double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
725
726 virtual const BOX2I ViewBBox() const override;
727
735 static bool IsLibNameValid( const wxString& aName );
736
746 static const wxChar* StringLibNameInvalidChars( bool aUserReadable );
747
751 bool FootprintNeedsUpdate( const FOOTPRINT* aLibFootprint );
752
767 void SetInitialComments( wxArrayString* aInitialComments )
768 {
769 delete m_initial_comments;
770 m_initial_comments = aInitialComments;
771 }
772
779 double CoverageRatio( const GENERAL_COLLECTOR& aCollector ) const;
780
781 static double GetCoverageArea( const BOARD_ITEM* aItem, const GENERAL_COLLECTOR& aCollector );
782
784 const wxArrayString* GetInitialComments() const { return m_initial_comments; }
785
791 const SHAPE_POLY_SET& GetCourtyard( PCB_LAYER_ID aLayer ) const;
792
799 void BuildCourtyardCaches( OUTLINE_ERROR_HANDLER* aErrorHandler = nullptr );
800
801 // @copydoc BOARD_ITEM::GetEffectiveShape
802 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
803 FLASHING aFlash = FLASHING::DEFAULT ) const override;
804
805#if defined(DEBUG)
806 virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
807#endif
808
810 {
811 bool operator()( const BOARD_ITEM* itemA, const BOARD_ITEM* itemB ) const;
812 };
813
814 struct cmp_pads
815 {
816 bool operator()( const PAD* aFirst, const PAD* aSecond ) const;
817 };
818
820 {
821 bool operator()( const FP_ZONE* aFirst, const FP_ZONE* aSecond ) const;
822 };
823
824protected:
825 virtual void swapData( BOARD_ITEM* aImage ) override;
826
827private:
828 DRAWINGS m_drawings; // BOARD_ITEMs for drawings on the board, owned by pointer.
829 PADS m_pads; // PAD items, owned by pointer
830 FP_ZONES m_fp_zones; // FP_ZONE items, owned by pointer
831 FP_GROUPS m_fp_groups; // PCB_GROUP items, owned by pointer
832
833 EDA_ANGLE m_orient; // Orientation
834 VECTOR2I m_pos; // Position of footprint on the board in internal units.
835 FP_TEXT* m_reference; // Component reference designator value (U34, R18..)
836 FP_TEXT* m_value; // Component value (74LS00, 22K..)
837 LIB_ID m_fpid; // The #LIB_ID of the FOOTPRINT.
838 int m_attributes; // Flag bits (see FOOTPRINT_ATTR_T)
839 int m_fpStatus; // For autoplace: flags (LOCKED, FIELDS_AUTOPLACED)
841
842 // Bounding box caching strategy:
843 // While we attempt to notice the low-hanging fruit operations and update the bounding boxes
844 // accordingly, we rely mostly on a "if anything changed then the caches are stale" approach.
845 // We implement this by having PCB_BASE_FRAME's OnModify() method increment an operation
846 // counter, and storing that as a timestamp for the various caches.
847 // This means caches will get regenerated often -- but still far less often than if we had no
848 // caches at all. The principal opitmization would be to change to dirty flag and make sure
849 // that any edit that could affect the bounding boxes (including edits to the footprint
850 // children) marked the bounding boxes dirty. It would definitely be faster -- but also more
851 // fragile.
860
861 // A list of pad groups, each of which is allowed to short nets within their group.
862 // A pad group is a comma-separated list of pad numbers.
863 std::vector<wxString> m_netTiePadGroups;
864
867 int m_localSolderMaskMargin; // Solder mask margin
868 int m_localSolderPasteMargin; // Solder paste margin absolute value
869 double m_localSolderPasteMarginRatio; // Solder mask margin ratio value of pad size
870
871 wxString m_doc; // File name and path for documentation file.
872 wxString m_keywords; // Search keywords to find footprint in library.
873 KIID_PATH m_path; // Path to associated symbol ([sheetUUID, .., symbolUUID]).
875 int m_arflag; // Use to trace ratsnest and auto routing.
876 KIID m_link; // Temporary logical link used during editing
877 LSET m_privateLayers; // Layers visible only in the footprint editor
878
879 std::vector<FP_3DMODEL> m_3D_Drawings; // 3D models.
880 std::map<wxString, wxString> m_properties;
881 wxArrayString* m_initial_comments; // s-expression comments in the footprint,
882 // lazily allocated only if needed for speed
883
884 SHAPE_POLY_SET m_courtyard_cache_front; // Note that a footprint can have both front and back
885 SHAPE_POLY_SET m_courtyard_cache_back; // courtyards populated.
887};
888
889#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:58
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:180
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:85
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
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:238
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:2465
void SetPosition(const VECTOR2I &aPos) override
Definition: footprint.cpp:1670
void SetFPID(const LIB_ID &aFPID)
Definition: footprint.h:213
LIB_ID m_fpid
Definition: footprint.h:837
void SetLink(const KIID &aLink)
Definition: footprint.h:681
KIID_PATH m_path
Definition: footprint.h:873
bool IsBoardOnly() const
Definition: footprint.h:583
BOX2I m_cachedTextExcludedBBox
Definition: footprint.h:856
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:2386
void SetLocked(bool isLocked) override
Set the #MODULE_is_LOCKED bit in the m_ModuleStatus.
Definition: footprint.h:350
std::vector< PAD * > GetNetTiePads(PAD *aPad) const
Definition: footprint.cpp:2339
bool ResolveTextVar(wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the component.
Definition: footprint.cpp:493
EDA_ANGLE GetOrientation() const
Definition: footprint.h:191
const FP_GROUPS & Groups() const
Definition: footprint.h:180
FP_TEXT & Value() const
The const versions to keep the compiler happy.
Definition: footprint.h:571
void Remove(BOARD_ITEM *aItem, REMOVE_MODE aMode=REMOVE_MODE::NORMAL) override
Removes an item from the container.
Definition: footprint.cpp:627
void SetIsPlaced(bool isPlaced)
Definition: footprint.h:364
ZONE_CONNECTION m_zoneConnection
Definition: footprint.h:865
BOX2I m_cachedBoundingBox
Definition: footprint.h:852
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:2028
bool IsExcludedFromBOM() const
Definition: footprint.h:601
void SetOrientation(const EDA_ANGLE &aNewAngle)
Definition: footprint.cpp:1802
void SetFlag(int aFlag)
Definition: footprint.h:253
FP_ZONES m_fp_zones
Definition: footprint.h:830
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:1516
unsigned GetPadCount(INCLUDE_NPTH_T aIncludeNPTH=INCLUDE_NPTH_T(INCLUDE_NPTH)) const
Return the number of pads.
Definition: footprint.cpp:1210
void IncrementFlag()
Definition: footprint.h:254
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:2511
void SetExcludedFromBOM(bool aExclude=true)
Definition: footprint.h:602
int m_fpStatus
Definition: footprint.h:839
void SetDescription(const wxString &aDoc)
Definition: footprint.h:219
void SetPath(const KIID_PATH &aPath)
Definition: footprint.h:225
double ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
Definition: footprint.cpp:1457
SHAPE_POLY_SET m_cachedHull
Definition: footprint.h:858
int GetLocalClearance() const
Definition: footprint.h:230
void SetAllowMissingCourtyard(bool aAllow=true)
Definition: footprint.h:611
void SetKeywords(const wxString &aKeywords)
Definition: footprint.h:222
const DRAWINGS & GraphicalItems() const
Definition: footprint.h:174
int m_localSolderPasteMargin
Definition: footprint.h:868
void SetInitialComments(wxArrayString *aInitialComments)
Take ownership of caller's heap allocated aInitialComments block.
Definition: footprint.h:767
int m_attributes
Definition: footprint.h:838
std::vector< FP_3DMODEL > m_3D_Drawings
Definition: footprint.h:879
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:2111
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:1869
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:2179
void SetAttributes(int aAttributes)
Definition: footprint.h:251
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: footprint.cpp:1367
double m_localSolderPasteMarginRatio
Definition: footprint.h:869
void TransformPadsToPolySet(SHAPE_POLY_SET &aBuffer, 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 aBuffer.
Definition: footprint.cpp:2742
wxArrayString * m_initial_comments
Definition: footprint.h:881
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: footprint.cpp:1373
wxString GetDescription() const
Definition: footprint.h:218
BOX2I m_cachedVisibleBBox
Definition: footprint.h:854
double GetLocalSolderPasteMarginRatio() const
Definition: footprint.h:244
BOX2I GetFpPadsLocalBbox() const
Return the bounding box containing pads when the footprint is on the front side, orientation 0,...
Definition: footprint.cpp:781
int m_visibleBBoxCacheTimeStamp
Definition: footprint.h:855
std::map< wxString, wxString > m_properties
Definition: footprint.h:880
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
Definition: footprint.cpp:1551
void SetFileFormatVersionAtLoad(int aVersion)
Definition: footprint.h:619
void SetExcludedFromPosFiles(bool aExclude=true)
Definition: footprint.h:593
int m_localClearance
Definition: footprint.h:866
void SetLocalSolderPasteMarginRatio(double aRatio)
Definition: footprint.h:245
void SetOrientationDegrees(double aOrientation)
Definition: footprint.h:203
FP_GROUPS & Groups()
Definition: footprint.h:179
void SetPrivateLayers(LSET aLayers)
Adds an item to the container.
Definition: footprint.h:121
std::map< wxString, int > MapPadNumbersToNetTieGroups() const
Definition: footprint.cpp:2284
void TransformFPTextToPolySet(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc) const
This function is the same as TransformFPShapesToPolySet but only generates text.
Definition: footprint.h:480
void MoveAnchorPosition(const VECTOR2I &aMoveVector)
Move the reference point of the footprint.
Definition: footprint.cpp:1728
void SetProperty(const wxString &aKey, const wxString &aVal)
Definition: footprint.h:581
FOOTPRINT & operator=(const FOOTPRINT &aOther)
Definition: footprint.cpp:373
int m_arflag
Definition: footprint.h:875
double GetOrientationDegrees() const
Definition: footprint.h:207
BOARD_ITEM * Duplicate() const override
Create a copy of this BOARD_ITEM.
Definition: footprint.cpp:1856
void SetLocalSolderPasteMargin(int aMargin)
Definition: footprint.h:242
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:1271
int GetAttributes() const
Definition: footprint.h:250
int m_localSolderMaskMargin
Definition: footprint.h:867
FOOTPRINT(BOARD *parent)
Definition: footprint.cpp:55
void ClearNetTiePadGroups()
Definition: footprint.h:274
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: footprint.h:200
bool FootprintNeedsUpdate(const FOOTPRINT *aLibFootprint)
Return true if a board footprint differs from the library version.
LSET GetPrivateLayers() const
Definition: footprint.h:120
wxString GetFPIDAsString() const
Definition: footprint.h:215
wxString GetValueAsString() const
Definition: footprint.h:561
bool AllowMissingCourtyard() const
Definition: footprint.h:610
bool IsFlipped() const
Definition: footprint.h:324
int GetLocalClearance(wxString *aSource) const
Definition: footprint.h:233
PADS & Pads()
Definition: footprint.h:170
SHAPE_POLY_SET GetBoundingHull() const
Return a bounding polygon for the shapes and pads in the footprint.
Definition: footprint.cpp:935
int GetLocalSolderPasteMargin() const
Definition: footprint.h:241
void TransformFPShapesToPolySet(SHAPE_POLY_SET &aBuffer, 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 aB...
Definition: footprint.cpp:2815
FP_TEXT & Reference() const
Definition: footprint.h:572
wxString GetTypeName() const
Get the type of footprint.
Definition: footprint.cpp:769
DRAWINGS m_drawings
Definition: footprint.h:828
bool NeedsPlaced() const
Definition: footprint.h:372
SHAPE_POLY_SET m_courtyard_cache_back
Definition: footprint.h:885
int m_textExcludedBBoxCacheTimeStamp
Definition: footprint.h:857
const std::vector< wxString > & GetNetTiePadGroups() const
Definition: footprint.h:272
void SetLocalClearance(int aClearance)
Definition: footprint.h:231
const LIB_ID & GetFPID() const
Definition: footprint.h:212
void SetReference(const wxString &aReference)
Definition: footprint.h:528
bool IsLocked() const override
Definition: footprint.h:340
bool IsExcludedFromPosFiles() const
Definition: footprint.h:592
void SetLayerAndFlip(PCB_LAYER_ID aLayer)
Used as Layer property setter – performs a flip if necessary to set the footprint layer.
Definition: footprint.cpp:1577
void SetLocalSolderMaskMargin(int aMargin)
Definition: footprint.h:228
int m_hullCacheTimeStamp
Definition: footprint.h:859
unsigned GetUniquePadCount(INCLUDE_NPTH_T aIncludeNPTH=INCLUDE_NPTH_T(INCLUDE_NPTH)) const
Return the number of unique non-blank pads.
Definition: footprint.cpp:1229
void AddNetTiePadGroup(const wxString &aGroup)
Definition: footprint.h:279
bool LegacyPadsLocked() const
Definition: footprint.h:381
virtual const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
Definition: footprint.cpp:1498
LSET m_privateLayers
Definition: footprint.h:877
int GetLikelyAttribute() const
Returns the most likely attribute based on pads Either FP_THROUGH_HOLE/FP_SMD/OTHER(0)
Definition: footprint.cpp:719
void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition: footprint.cpp:1544
static bool ClassOf(const EDA_ITEM *aItem)
Definition: footprint.h:115
VECTOR2I m_pos
Definition: footprint.h:834
std::vector< wxString > m_netTiePadGroups
Definition: footprint.h:863
PAD * GetPad(const VECTOR2I &aPosition, LSET aLayerMask=LSET::AllLayersMask())
Get a pad at aPosition on aLayerMask in the footprint.
Definition: footprint.cpp:1194
void Add3DModel(FP_3DMODEL *a3DModel)
Add a3DModel definition to the end of the 3D model list.
Definition: footprint.cpp:1260
void SetValue(const wxString &aValue)
Definition: footprint.h:555
bool HasProperty(const wxString &aKey)
Definition: footprint.h:577
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:1017
wxString GetReferenceAsString() const
Definition: footprint.h:534
FP_TEXT & Value()
read/write accessors:
Definition: footprint.h:567
void GetContextualTextVars(wxArrayString *aVars) const
Return the list of system text vars for this footprint.
Definition: footprint.cpp:480
SHAPE_POLY_SET m_courtyard_cache_front
Definition: footprint.h:884
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition: footprint.cpp:567
wxString m_keywords
Definition: footprint.h:872
void ClearAllNets()
Clear (i.e.
Definition: footprint.cpp:558
void SetZoneConnection(ZONE_CONNECTION aType)
Definition: footprint.h:247
bool HasThroughHolePads() const
Definition: footprint.cpp:2650
void BuildCourtyardCaches(OUTLINE_ERROR_HANDLER *aErrorHandler=nullptr)
Build complex polygons of the courtyard areas from graphic items on the courtyard layers.
Definition: footprint.cpp:2227
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:1086
EDA_ANGLE m_orient
Definition: footprint.h:833
bool HitTestAccurate(const VECTOR2I &aPosition, int aAccuracy=0) const
Test if a point is inside the bounding polygon of the footprint.
Definition: footprint.cpp:1116
bool IsNetTie() const
Definition: footprint.h:257
wxString GetClass() const override
Return the class name.
Definition: footprint.h:702
const PADS & Pads() const
Definition: footprint.h:171
void IncrementReference(int aDelta)
Bump the current reference by aDelta.
Definition: footprint.cpp:2001
int GetFileFormatVersionAtLoad() const
Definition: footprint.h:620
KIID m_link
Definition: footprint.h:876
const wxArrayString * GetInitialComments() const
Definition: footprint.h:784
KIID GetLink() const
Definition: footprint.h:680
bool IsConflicting() const
Definition: footprint.cpp:474
std::vector< FP_3DMODEL > & Models()
Definition: footprint.h:184
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:1379
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:1527
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: footprint.cpp:1586
const wxString & GetValue() const
Definition: footprint.h:547
double GetArea(int aPadding=0) const
Definition: footprint.cpp:709
FP_TEXT * m_value
Definition: footprint.h:836
void SetNeedsPlaced(bool needsPlaced)
Definition: footprint.h:373
ZONE_CONNECTION GetZoneConnection() const
Definition: footprint.h:248
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:2617
void SetFPIDAsString(const wxString &aFPID)
Definition: footprint.h:216
void SetBoardOnly(bool aIsBoardOnly=true)
Definition: footprint.h:584
const std::vector< FP_3DMODEL > & Models() const
Definition: footprint.h:185
void SetProperties(const std::map< wxString, wxString > &aProps)
Definition: footprint.h:575
timestamp_t m_lastEditTime
Definition: footprint.h:874
const SHAPE_POLY_SET & GetCourtyard(PCB_LAYER_ID aLayer) const
Used in DRC to test the courtyard area (a complex polygon).
Definition: footprint.cpp:2215
int GetFlag() const
Definition: footprint.h:255
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:1405
int m_fileFormatVersionAtLoad
Definition: footprint.h:840
wxString m_doc
Definition: footprint.h:871
const KIID_PATH & GetPath() const
Definition: footprint.h:224
FP_ZONES & Zones()
Definition: footprint.h:176
wxString GetKeywords() const
Definition: footprint.h:221
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:2361
const wxString & GetProperty(const wxString &aKey)
Definition: footprint.h:576
PADS m_pads
Definition: footprint.h:829
virtual void swapData(BOARD_ITEM *aImage) override
Definition: footprint.cpp:2642
wxString GetNextPadNumber(const wxString &aLastPadName) const
Return the next available pad number in the footprint.
Definition: footprint.cpp:1981
bool IsPlaced() const
Definition: footprint.h:363
int m_courtyard_cache_timestamp
Definition: footprint.h:886
int m_boundingBoxCacheTimeStamp
Definition: footprint.h:853
VECTOR2I GetPosition() const override
Definition: footprint.h:188
DRAWINGS & GraphicalItems()
Definition: footprint.h:173
FP_GROUPS m_fp_groups
Definition: footprint.h:831
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:1109
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
Definition: footprint.cpp:1356
FP_TEXT & Reference()
Definition: footprint.h:568
const FP_ZONES & Zones() const
Definition: footprint.h:177
PAD * FindPadByNumber(const wxString &aPadNumber, PAD *aSearchAfterMe=nullptr) const
Return a PAD with a matching number.
Definition: footprint.cpp:1174
int GetLocalSolderMaskMargin() const
Definition: footprint.h:227
const std::map< wxString, wxString > & GetProperties() const
Definition: footprint.h:574
FP_TEXT * m_reference
Definition: footprint.h:835
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: footprint.cpp:804
VECTOR3D m_Offset
3D model offset (mm)
Definition: footprint.h:93
double m_Opacity
Definition: footprint.h:94
VECTOR3D m_Rotation
3D model rotation (degrees)
Definition: footprint.h:92
FP_3DMODEL()
Definition: footprint.h:81
VECTOR3D m_Scale
3D model scaling factor (dimensionless)
Definition: footprint.h:91
wxString m_Filename
The 3D shape filename in 3D library.
Definition: footprint.h:95
bool m_Show
Include model in rendering.
Definition: footprint.h:96
A specialization of ZONE for use in footprints.
Definition: zone.h:910
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:48
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:59
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:42
const INSPECTOR_FUNC & INSPECTOR
Definition: eda_item.h:78
INCLUDE_NPTH_T
Definition: footprint.h:56
@ INCLUDE_NPTH
Definition: footprint.h:58
@ DO_NOT_INCLUDE_NPTH
Definition: footprint.h:57
FOOTPRINT_ATTR_T
The set of attributes allowed within a FOOTPRINT, using FOOTPRINT::SetAttributes() and FOOTPRINT::Get...
Definition: footprint.h:67
@ FP_SMD
Definition: footprint.h:69
@ FP_ALLOW_MISSING_COURTYARD
Definition: footprint.h:75
@ FP_EXCLUDE_FROM_POS_FILES
Definition: footprint.h:70
@ FP_BOARD_ONLY
Definition: footprint.h:72
@ FP_EXCLUDE_FROM_BOM
Definition: footprint.h:71
@ FP_JUST_ADDED
Definition: footprint.h:73
@ FP_THROUGH_HOLE
Definition: footprint.h:68
@ FP_ALLOW_SOLDERMASK_BRIDGES
Definition: footprint.h:74
#define FP_is_PLACED
In autoplace: footprint automatically placed.
Definition: footprint.h:335
#define FP_is_LOCKED
footprint LOCKED: no autoplace allowed
Definition: footprint.h:334
#define FP_PADS_are_LOCKED
Definition: footprint.h:337
#define FP_to_PLACE
In autoplace: footprint waiting for autoplace.
Definition: footprint.h:336
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:45
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:266
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:2666
bool operator()(const PAD *aFirst, const PAD *aSecond) const
Definition: footprint.cpp:2707
bool operator()(const FP_ZONE *aFirst, const FP_ZONE *aSecond) const
Definition: footprint.cpp:2723
@ 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