KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 The 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
30#include <template_fieldnames.h>
31
33#include <board_item.h>
34#include <collectors.h>
36#include <embedded_files.h>
37#include <layer_ids.h> // ALL_LAYERS definition.
38#include <lset.h>
39#include <lib_id.h>
40#include <list>
41
42#include <zones.h>
44#include <pcb_item_containers.h>
45#include <pcb_text.h>
46#include <pcb_field.h>
47#include <functional>
48#include <math/vector3.h>
49
50class LINE_READER;
51class EDA_3D_CANVAS;
52class PAD;
53class BOARD;
54class MSG_PANEL_ITEM;
55class SHAPE;
56class REPORTER;
58
59namespace KIGFX {
60class VIEW;
61}
62
63namespace KIFONT {
64class OUTLINE_FONT;
65}
66
68{
70 INCLUDE_NPTH = true
71};
72
79{
81 FP_SMD = 0x0002,
84 FP_BOARD_ONLY = 0x0010, // Footprint has no corresponding symbol
85 FP_JUST_ADDED = 0x0020, // Footprint just added by netlist update
86 FP_DNP = 0x0040
87};
88
90{
91public:
93 // Initialize with sensible values
94 m_Scale { 1, 1, 1 },
95 m_Rotation { 0, 0, 0 },
96 m_Offset { 0, 0, 0 },
97 m_Opacity( 1.0 ),
98 m_Show( true )
99 {
100 }
101
105 double m_Opacity;
106 wxString m_Filename;
107 bool m_Show;
108
109 bool operator==( const FP_3DMODEL& aOther ) const
110 {
111 return m_Scale == aOther.m_Scale
112 && m_Rotation == aOther.m_Rotation
113 && m_Offset == aOther.m_Offset
114 && m_Opacity == aOther.m_Opacity
115 && m_Filename == aOther.m_Filename
116 && m_Show == aOther.m_Show;
117 }
118};
119
120
122{
123public:
124 FOOTPRINT( BOARD* parent );
125
126 FOOTPRINT( const FOOTPRINT& aFootprint );
127
128 // Move constructor and operator needed due to std containers inside the footprint
129 FOOTPRINT( FOOTPRINT&& aFootprint );
130
131 ~FOOTPRINT();
132
133 FOOTPRINT& operator=( const FOOTPRINT& aOther );
134 FOOTPRINT& operator=( FOOTPRINT&& aOther );
135
136 void CopyFrom( const BOARD_ITEM* aOther ) override;
137
138 void Serialize( google::protobuf::Any &aContainer ) const override;
139 bool Deserialize( const google::protobuf::Any &aContainer ) override;
140
141 static inline bool ClassOf( const EDA_ITEM* aItem )
142 {
143 return aItem && aItem->Type() == PCB_FOOTPRINT_T;
144 }
145
148
150 void SetPrivateLayers( const LSET& aLayers ) { m_privateLayers = aLayers; }
151
153 void Add( BOARD_ITEM* aItem, ADD_MODE aMode = ADD_MODE::INSERT,
154 bool aSkipConnectivity = false ) override;
155
157 void Remove( BOARD_ITEM* aItem, REMOVE_MODE aMode = REMOVE_MODE::NORMAL ) override;
158
166 void ClearAllNets();
167
175 bool FixUuids();
176
187
195
196 bool TextOnly() const;
197
198 // Virtual function
199 const BOX2I GetBoundingBox() const override;
200 const BOX2I GetBoundingBox( bool aIncludeText ) const;
201
205 const BOX2I GetLayerBoundingBox( const LSET& aLayers ) const;
206
207 VECTOR2I GetCenter() const override { return GetBoundingBox( false ).GetCenter(); }
208
209 std::deque<PAD*>& Pads() { return m_pads; }
210 const std::deque<PAD*>& Pads() const { return m_pads; }
211
212 DRAWINGS& GraphicalItems() { return m_drawings; }
213 const DRAWINGS& GraphicalItems() const { return m_drawings; }
214
215 ZONES& Zones() { return m_zones; }
216 const ZONES& Zones() const { return m_zones; }
217
218 GROUPS& Groups() { return m_groups; }
219 const GROUPS& Groups() const { return m_groups; }
220
221 bool HasThroughHolePads() const;
222
223 std::vector<FP_3DMODEL>& Models() { return m_3D_Drawings; }
224 const std::vector<FP_3DMODEL>& Models() const { return m_3D_Drawings; }
225
226 void SetPosition( const VECTOR2I& aPos ) override;
227 VECTOR2I GetPosition() const override { return m_pos; }
228
229 void SetOrientation( const EDA_ANGLE& aNewAngle );
231
236 void SetLayerAndFlip( PCB_LAYER_ID aLayer );
237
238 // to make property magic work
239 PCB_LAYER_ID GetLayer() const override { return BOARD_ITEM::GetLayer(); }
240
241 // For property system:
242 void SetOrientationDegrees( double aOrientation )
243 {
244 SetOrientation( EDA_ANGLE( aOrientation, DEGREES_T ) );
245 }
247 {
248 return m_orient.AsDegrees();
249 }
250
251 const LIB_ID& GetFPID() const { return m_fpid; }
252 void SetFPID( const LIB_ID& aFPID )
253 {
254 m_fpid = aFPID;
255 }
256
257 wxString GetFPIDAsString() const { return m_fpid.Format(); }
258 void SetFPIDAsString( const wxString& aFPID ) { m_fpid.Parse( aFPID ); }
259
260 wxString GetLibDescription() const { return m_libDescription; }
261 void SetLibDescription( const wxString& aDesc ) { m_libDescription = aDesc; }
262
263 wxString GetKeywords() const { return m_keywords; }
264 void SetKeywords( const wxString& aKeywords ) { m_keywords = aKeywords; }
265
266 const KIID_PATH& GetPath() const { return m_path; }
267 void SetPath( const KIID_PATH& aPath ) { m_path = aPath; }
268
269 wxString GetSheetname() const { return m_sheetname; }
270 void SetSheetname( const wxString& aSheetname ) { m_sheetname = aSheetname; }
271
272 wxString GetSheetfile() const { return m_sheetfile; }
273 void SetSheetfile( const wxString& aSheetfile ) { m_sheetfile = aSheetfile; }
274
275 wxString GetFilters() const { return m_filters; }
276 void SetFilters( const wxString& aFilters ) { m_filters = aFilters; }
277
278 std::optional<int> GetLocalClearance() const { return m_clearance; }
279 void SetLocalClearance( std::optional<int> aClearance ) { m_clearance = aClearance; }
280
281 std::optional<int> GetLocalSolderMaskMargin() const { return m_solderMaskMargin; }
282 void SetLocalSolderMaskMargin( std::optional<int> aMargin ) { m_solderMaskMargin = aMargin; }
283
284 std::optional<int> GetLocalSolderPasteMargin() const { return m_solderPasteMargin; }
285 void SetLocalSolderPasteMargin( std::optional<int> aMargin ) { m_solderPasteMargin = aMargin; }
286
287 std::optional<double> GetLocalSolderPasteMarginRatio() const { return m_solderPasteMarginRatio; }
288 void SetLocalSolderPasteMarginRatio( std::optional<double> aRatio ) { m_solderPasteMarginRatio = aRatio; }
289
292
293 int GetAttributes() const { return m_attributes; }
294 void SetAttributes( int aAttributes ) { m_attributes = aAttributes; }
295
297 void SetAllowMissingCourtyard( bool aAllow ) { m_allowMissingCourtyard = aAllow; }
298
300 void SetAllowSolderMaskBridges( bool aAllow ) { m_allowSolderMaskBridges = aAllow; }
301
302 void SetFlag( int aFlag ) { m_arflag = aFlag; }
303 void IncrementFlag() { m_arflag += 1; }
304 int GetFlag() const { return m_arflag; }
305
306 bool IsNetTie() const
307 {
308 for( const wxString& group : m_netTiePadGroups )
309 {
310 if( !group.IsEmpty() )
311 return true;
312 }
313
314 return false;
315 }
316
317 std::optional<int> GetLocalClearance( wxString* aSource ) const
318 {
319 if( m_clearance.has_value() && aSource )
320 *aSource = wxString::Format( _( "footprint %s" ), GetReference() );
321
322 return m_clearance;
323 }
324
331 std::optional<int> GetClearanceOverrides( wxString* aSource ) const
332 {
333 return GetLocalClearance( aSource );
334 }
335
337 {
338 if( m_zoneConnection != ZONE_CONNECTION::INHERITED && aSource )
339 *aSource = wxString::Format( _( "footprint %s" ), GetReference() );
340
341 return m_zoneConnection;
342 }
343
348 const std::vector<wxString>& GetNetTiePadGroups() const { return m_netTiePadGroups; }
349
351 {
352 m_netTiePadGroups.clear();
353 }
354
355 void AddNetTiePadGroup( const wxString& aGroup )
356 {
357 m_netTiePadGroups.emplace_back( aGroup );
358 }
359
364 std::map<wxString, int> MapPadNumbersToNetTieGroups() const;
365
369 std::vector<PAD*> GetNetTiePads( PAD* aPad ) const;
370
376 int GetLikelyAttribute() const;
377
378 void Move( const VECTOR2I& aMoveVector ) override;
379
380 void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override;
381
382 void Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
383
395 void MoveAnchorPosition( const VECTOR2I& aMoveVector );
396
400 bool IsFlipped() const { return GetLayer() == B_Cu; }
401
406 PCB_LAYER_ID GetSide() const;
407
411 bool IsOnLayer( PCB_LAYER_ID aLayer ) const override;
412
413// m_footprintStatus bits:
414#define FP_is_LOCKED 0x01
415#define FP_is_PLACED 0x02
416#define FP_to_PLACE 0x04
417#define FP_PADS_are_LOCKED 0x08
418
419
420 bool IsLocked() const override
421 {
422 return ( m_fpStatus & FP_is_LOCKED ) != 0;
423 }
424
430 void SetLocked( bool isLocked ) override
431 {
432 if( isLocked )
434 else
435 m_fpStatus &= ~FP_is_LOCKED;
436 }
437
441 bool IsConflicting() const;
442
443 bool IsPlaced() const { return m_fpStatus & FP_is_PLACED; }
444 void SetIsPlaced( bool isPlaced )
445 {
446 if( isPlaced )
448 else
449 m_fpStatus &= ~FP_is_PLACED;
450 }
451
452 bool NeedsPlaced() const { return m_fpStatus & FP_to_PLACE; }
453 void SetNeedsPlaced( bool needsPlaced )
454 {
455 if( needsPlaced )
457 else
458 m_fpStatus &= ~FP_to_PLACE;
459 }
460
462
473 void CheckFootprintAttributes( const std::function<void( const wxString& )>& aErrorHandler );
474
481 void CheckPads( UNITS_PROVIDER* aUnitsProvider,
482 const std::function<void( const PAD*, int, const wxString& )>& aErrorHandler );
483
489 void CheckShortingPads( const std::function<void( const PAD*, const PAD*, int aErrorCode,
490 const VECTOR2I& )>& aErrorHandler );
491
498 void CheckNetTies( const std::function<void( const BOARD_ITEM* aItem,
499 const BOARD_ITEM* bItem,
500 const BOARD_ITEM* cItem,
501 const VECTOR2I& )>& aErrorHandler );
502
509 void CheckNetTiePadGroups( const std::function<void( const wxString& )>& aErrorHandler );
510
511 void CheckClippedSilk( const std::function<void( BOARD_ITEM* aItemA,
512 BOARD_ITEM* aItemB,
513 const VECTOR2I& aPt )>& aErrorHandler );
517 void BuildNetTieCache();
518
522 const std::set<int>& GetNetTieCache( const BOARD_ITEM* aItem ) const
523 {
524 static const std::set<int> emptySet;
525
526 auto it = m_netTieCache.find( aItem );
527
528 if( it == m_netTieCache.end() )
529 return emptySet;
530
531 return it->second;
532 }
533
546 void TransformPadsToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
547 int aMaxError, ERROR_LOC aErrorLoc ) const;
548
563 void TransformFPShapesToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
564 int aError, ERROR_LOC aErrorLoc,
565 bool aIncludeText = true,
566 bool aIncludeShapes = true,
567 bool aIncludePrivateItems = false ) const;
568
572 void TransformFPTextToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
573 int aError, ERROR_LOC aErrorLoc ) const
574 {
575 TransformFPShapesToPolySet( aBuffer, aLayer, aClearance, aError, aErrorLoc, true, false );
576 }
577
581 void GetContextualTextVars( wxArrayString* aVars ) const;
582
588 bool ResolveTextVar( wxString* token, int aDepth = 0 ) const;
589
591 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
592
593 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
594
595 bool Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const override;
596
606 bool HitTestAccurate( const VECTOR2I& aPosition, int aAccuracy = 0 ) const;
607
608 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
609
610 bool HitTest( const SHAPE_LINE_CHAIN& aPoly, bool aContained ) const override;
611
620 bool HitTestOnLayer( const VECTOR2I& aPosition, PCB_LAYER_ID aLayer, int aAccuracy = 0 ) const;
621
622 bool HitTestOnLayer( const BOX2I& aRect, bool aContained, PCB_LAYER_ID aLayer, int aAccuracy = 0 ) const;
623
627 const wxString& GetReference() const { return Reference().GetText(); }
628
633 void SetReference( const wxString& aReference ) { Reference().SetText( aReference ); }
634
635 // Property system doesn't like const references
636 wxString GetReferenceAsString() const
637 {
638 return GetReference();
639 }
640
644 void IncrementReference( int aDelta );
645
649 const wxString& GetValue() const { return Value().GetText(); }
650
654 void SetValue( const wxString& aValue ) { Value().SetText( aValue ); }
655
656 // Property system doesn't like const references
657 wxString GetValueAsString() const
658 {
659 return GetValue();
660 }
661
663 PCB_FIELD& Value() { return *GetField( FIELD_T::VALUE ); }
664 PCB_FIELD& Reference() { return *GetField( FIELD_T::REFERENCE ); }
665
667 const PCB_FIELD& Value() const { return *GetField( FIELD_T::VALUE ); }
668 const PCB_FIELD& Reference() const { return *GetField( FIELD_T::REFERENCE ); }
669
670 //-----<Fields>-----------------------------------------------------------
671
676 PCB_FIELD* GetField( FIELD_T aFieldType );
677 const PCB_FIELD* GetField( FIELD_T aFieldNdx ) const;
678
686 PCB_FIELD* GetField( const wxString& aFieldName ) const;
687
688 bool HasField( const wxString& aFieldName ) const;
689
696 void GetFields( std::vector<PCB_FIELD*>& aVector, bool aVisibleOnly ) const;
697
701 const std::deque<PCB_FIELD*>& GetFields() const { return m_fields; }
702 std::deque<PCB_FIELD*>& GetFields() { return m_fields; }
703
707 int GetNextFieldOrdinal() const;
708
716 void ApplyDefaultSettings( const BOARD& board, bool aStyleFields, bool aStyleText,
717 bool aStyleShapes );
718
719 bool IsBoardOnly() const { return m_attributes & FP_BOARD_ONLY; }
720 void SetBoardOnly( bool aIsBoardOnly = true )
721 {
722 if( aIsBoardOnly )
724 else
725 m_attributes &= ~FP_BOARD_ONLY;
726 }
727
729 void SetExcludedFromPosFiles( bool aExclude = true )
730 {
731 if( aExclude )
733 else
734 m_attributes &= ~FP_EXCLUDE_FROM_POS_FILES;
735 }
736
738 void SetExcludedFromBOM( bool aExclude = true )
739 {
740 if( aExclude )
742 else
743 m_attributes &= ~FP_EXCLUDE_FROM_BOM;
744 }
745
746 bool IsDNP() const { return m_attributes & FP_DNP; }
747 void SetDNP( bool aDNP = true )
748 {
749 if( aDNP )
751 else
752 m_attributes &= ~FP_DNP;
753 }
754
755 void SetFileFormatVersionAtLoad( int aVersion ) { m_fileFormatVersionAtLoad = aVersion; }
757
767 PAD* FindPadByNumber( const wxString& aPadNumber, PAD* aSearchAfterMe = nullptr ) const;
768
776 PAD* GetPad( const VECTOR2I& aPosition, const LSET& aLayerMask = LSET::AllLayersMask() );
777
778 std::vector<const PAD*> GetPads( const wxString& aPadNumber,
779 const PAD* aIgnore = nullptr ) const;
780
788 unsigned GetPadCount( INCLUDE_NPTH_T aIncludeNPTH = INCLUDE_NPTH_T(INCLUDE_NPTH) ) const;
789
800 unsigned GetUniquePadCount( INCLUDE_NPTH_T aIncludeNPTH = INCLUDE_NPTH_T(INCLUDE_NPTH) ) const;
801
805 std::set<wxString>
807
815 wxString GetNextPadNumber( const wxString& aLastPadName ) const;
816
819
824 std::vector<std::set<wxString>>& JumperPadGroups() { return m_jumperPadGroups; }
825 const std::vector<std::set<wxString>>& JumperPadGroups() const { return m_jumperPadGroups; }
826
828 std::optional<const std::set<wxString>> GetJumperPadGroup( const wxString& aPadNumber ) const;
829
833 void AutoPositionFields();
834
839 wxString GetTypeName() const;
840
841 double GetArea( int aPadding = 0 ) const;
842
843 KIID GetLink() const { return m_link; }
844 void SetLink( const KIID& aLink ) { m_link = aLink; }
845
846 BOARD_ITEM* Duplicate( bool addToParentGroup, BOARD_COMMIT* aCommit = nullptr ) const override;
847
853 BOARD_ITEM* DuplicateItem( bool addToParentGroup, BOARD_COMMIT* aCommit, const BOARD_ITEM* aItem,
854 bool addToFootprint = false );
855
861 void Add3DModel( FP_3DMODEL* a3DModel );
862
863 INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
864 const std::vector<KICAD_T>& aScanTypes ) override;
865
866 wxString GetClass() const override
867 {
868 return wxT( "FOOTPRINT" );
869 }
870
871 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
872
873 BITMAPS GetMenuImage() const override;
874
875 EDA_ITEM* Clone() const override;
876
878 void RunOnChildren( const std::function<void( BOARD_ITEM* )>& aFunction, RECURSE_MODE aMode ) const override;
879
880 virtual std::vector<int> ViewGetLayers() const override;
881
882 double ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const override;
883
884 virtual const BOX2I ViewBBox() const override;
885
893 static bool IsLibNameValid( const wxString& aName );
894
904 static const wxChar* StringLibNameInvalidChars( bool aUserReadable );
905
909 bool FootprintNeedsUpdate( const FOOTPRINT* aLibFP, int aCompareFlags = 0,
910 REPORTER* aReporter = nullptr );
911
926 void SetInitialComments( wxArrayString* aInitialComments )
927 {
928 delete m_initial_comments;
929 m_initial_comments = aInitialComments;
930 }
931
938 double CoverageRatio( const GENERAL_COLLECTOR& aCollector ) const;
939
940 static double GetCoverageArea( const BOARD_ITEM* aItem, const GENERAL_COLLECTOR& aCollector );
941
943 const wxArrayString* GetInitialComments() const { return m_initial_comments; }
944
950 const SHAPE_POLY_SET& GetCourtyard( PCB_LAYER_ID aLayer ) const;
951
957 const SHAPE_POLY_SET& GetCachedCourtyard( PCB_LAYER_ID aLayer ) const;
958
965 void BuildCourtyardCaches( OUTLINE_ERROR_HANDLER* aErrorHandler = nullptr );
966
967 // @copydoc BOARD_ITEM::GetEffectiveShape
968 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
969 FLASHING aFlash = FLASHING::DEFAULT ) const override;
970
972 {
973 return static_cast<EMBEDDED_FILES*>( this );
974 }
975
977 {
978 return static_cast<const EMBEDDED_FILES*>( this );
979 }
980
984 std::set<KIFONT::OUTLINE_FONT*> GetFonts() const override;
985
986 void EmbedFonts() override;
987
988 double Similarity( const BOARD_ITEM& aOther ) const override;
989
991 void SetStaticComponentClass( const COMPONENT_CLASS* aClass ) const;
992
995
997 const COMPONENT_CLASS* GetComponentClass() const;
998
1000 wxString GetComponentClassAsString() const;
1001
1003 void RecomputeComponentClass() const;
1004
1006 void InvalidateComponentClassCache() const;
1007
1014 void SetTransientComponentClassNames( const std::unordered_set<wxString>& classNames )
1015 {
1016 m_transientComponentClassNames = classNames;
1017 }
1018
1020 const std::unordered_set<wxString>& GetTransientComponentClassNames()
1021 {
1023 }
1024
1027
1029 void ResolveComponentClassNames( BOARD* aBoard,
1030 const std::unordered_set<wxString>& aComponentClassNames );
1031
1032 bool operator==( const BOARD_ITEM& aOther ) const override;
1033 bool operator==( const FOOTPRINT& aOther ) const;
1034
1035#if defined(DEBUG)
1036 virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
1037#endif
1038
1040 {
1041 bool operator()( const BOARD_ITEM* itemA, const BOARD_ITEM* itemB ) const;
1042 };
1043
1045 {
1046 bool operator()( const PAD* aFirst, const PAD* aSecond ) const;
1047 };
1048 // TODO(JE) padstacks -- this code isn't used anywhere though
1049#if 0
1050 struct cmp_padstack
1051 {
1052 bool operator()( const PAD* aFirst, const PAD* aSecond ) const;
1053 };
1054#endif
1056 {
1057 bool operator()( const ZONE* aFirst, const ZONE* aSecond ) const;
1058 };
1059
1060protected:
1061 virtual void swapData( BOARD_ITEM* aImage ) override;
1062
1064
1065private:
1066 std::deque<PCB_FIELD*> m_fields; // Fields, mapped by name, owned by pointer
1067 std::deque<BOARD_ITEM*> m_drawings; // Drawings in the footprint, owned by pointer
1068 std::deque<PAD*> m_pads; // Pads, owned by pointer
1069 std::vector<ZONE*> m_zones; // Rule area zones, owned by pointer
1070 std::deque<PCB_GROUP*> m_groups; // Groups, owned by pointer
1071
1072 EDA_ANGLE m_orient; // Orientation
1073 VECTOR2I m_pos; // Position of footprint on the board in internal units.
1074 LIB_ID m_fpid; // The #LIB_ID of the FOOTPRINT.
1075 int m_attributes; // Flag bits (see FOOTPRINT_ATTR_T)
1076 int m_fpStatus; // For autoplace: flags (LOCKED, FIELDS_AUTOPLACED)
1078
1079 // Bounding box caching strategy:
1080 // While we attempt to notice the low-hanging fruit operations and update the bounding boxes
1081 // accordingly, we rely mostly on a "if anything changed then the caches are stale" approach.
1082 // We implement this by having PCB_BASE_FRAME's OnModify() method increment an operation
1083 // counter, and storing that as a timestamp for the various caches.
1084 // This means caches will get regenerated often -- but still far less often than if we had no
1085 // caches at all. The principal opitmization would be to change to dirty flag and make sure
1086 // that any edit that could affect the bounding boxes (including edits to the footprint
1087 // children) marked the bounding boxes dirty. It would definitely be faster -- but also more
1088 // fragile.
1095
1096 // A list of pad groups, each of which is allowed to short nets within their group.
1097 // A pad group is a comma-separated list of pad numbers.
1098 std::vector<wxString> m_netTiePadGroups;
1099
1100 // A list of 1:N footprint item to allowed net numbers
1101 std::map<const BOARD_ITEM*, std::set<int>> m_netTieCache;
1102
1105 std::vector<std::set<wxString>> m_jumperPadGroups;
1106
1110
1113
1114 // Optional overrides
1116 std::optional<int> m_clearance;
1117 std::optional<int> m_solderMaskMargin; // Solder mask margin
1118 std::optional<int> m_solderPasteMargin; // Solder paste margin absolute value
1119 std::optional<double> m_solderPasteMarginRatio; // Solder mask margin ratio of pad size
1120 // The final margin is the sum of these 2 values
1121
1122 wxString m_libDescription; // File name and path for documentation file.
1123 wxString m_keywords; // Search keywords to find footprint in library.
1124 KIID_PATH m_path; // Path to associated symbol ([sheetUUID, .., symbolUUID]).
1125 wxString m_sheetname; // Name of the sheet containing the symbol for this footprint
1126 wxString m_sheetfile; // File of the sheet containing the symbol for this footprint
1127 wxString m_filters; // Footprint filters from symbol
1129 int m_arflag; // Use to trace ratsnest and auto routing.
1130 KIID m_link; // Temporary logical link used during editing
1131 LSET m_privateLayers; // Layers visible only in the footprint editor
1132
1133 std::vector<FP_3DMODEL> m_3D_Drawings; // 3D models.
1134 wxArrayString* m_initial_comments; // s-expression comments in the footprint,
1135 // lazily allocated only if needed for speed
1136
1137 SHAPE_POLY_SET m_courtyard_cache_front; // Note that a footprint can have both front and back
1138 SHAPE_POLY_SET m_courtyard_cache_back; // courtyards populated.
1141 mutable std::mutex m_courtyard_cache_mutex;
1142
1143 std::unordered_set<wxString> m_transientComponentClassNames;
1144 std::unique_ptr<COMPONENT_CLASS_CACHE_PROXY> m_componentClassCacheProxy;
1145};
1146
1147#endif // FOOTPRINT_H
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
Definition: approximation.h:32
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:79
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:232
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:317
constexpr const Vec GetCenter() const
Definition: box2.h:230
A lightweight representation of a component class.
Implement a canvas based on a wxGLCanvas.
Definition: eda_3d_canvas.h:51
double AsDegrees() const
Definition: eda_angle.h:116
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:98
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:110
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:97
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:270
bool FixUuids()
Old footprints do not always have a valid UUID (some can be set to null uuid) However null UUIDs,...
Definition: footprint.cpp:705
bool GetDuplicatePadNumbersAreJumpers() const
Definition: footprint.h:817
std::optional< int > GetClearanceOverrides(wxString *aSource) const
Return any local clearance overrides set in the "classic" (ie: pre-rule) system.
Definition: footprint.h:331
void EmbedFonts() override
Definition: footprint.cpp:4094
bool AllowSolderMaskBridges() const
Definition: footprint.h:299
void SetPosition(const VECTOR2I &aPos) override
Definition: footprint.cpp:2513
void SetFPID(const LIB_ID &aFPID)
Definition: footprint.h:252
LIB_ID m_fpid
Definition: footprint.h:1074
wxString GetLibDescription() const
Definition: footprint.h:260
ZONE_CONNECTION GetLocalZoneConnection() const
Definition: footprint.h:291
void SetLink(const KIID &aLink)
Definition: footprint.h:844
KIID_PATH m_path
Definition: footprint.h:1124
std::deque< BOARD_ITEM * > m_drawings
Definition: footprint.h:1067
bool IsBoardOnly() const
Definition: footprint.h:719
BOX2I m_cachedTextExcludedBBox
Definition: footprint.h:1091
void InvalidateComponentClassCache() const
Forces deferred (on next access) recalculation of the component class for this footprint.
Definition: footprint.cpp:4146
const std::deque< PAD * > & Pads() const
Definition: footprint.h:210
bool IsDNP() const
Definition: footprint.h:746
void SetLocked(bool isLocked) override
Set the #MODULE_is_LOCKED bit in the m_ModuleStatus.
Definition: footprint.h:430
VECTOR2I GetCenter() const override
This defaults to the center of the bounding box if not overridden.
Definition: footprint.h:207
HASH_128 m_courtyard_cache_back_hash
Definition: footprint.h:1140
std::vector< PAD * > GetNetTiePads(PAD *aPad) const
Definition: footprint.cpp:3305
bool ResolveTextVar(wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the component.
Definition: footprint.cpp:1003
EDA_ANGLE GetOrientation() const
Definition: footprint.h:230
ZONES & Zones()
Definition: footprint.h:215
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition: footprint.cpp:405
void CheckClippedSilk(const std::function< void(BOARD_ITEM *aItemA, BOARD_ITEM *aItemB, const VECTOR2I &aPt)> &aErrorHandler)
Definition: footprint.cpp:3573
void Remove(BOARD_ITEM *aItem, REMOVE_MODE aMode=REMOVE_MODE::NORMAL) override
Removes an item from the container.
Definition: footprint.cpp:1149
void SetIsPlaced(bool isPlaced)
Definition: footprint.h:444
ZONE_CONNECTION m_zoneConnection
Definition: footprint.h:1115
BOX2I m_cachedBoundingBox
Definition: footprint.h:1089
int GetNextFieldOrdinal() const
Return the next ordinal for a user field for this footprint.
Definition: footprint.cpp:661
static double GetCoverageArea(const BOARD_ITEM *aItem, const GENERAL_COLLECTOR &aCollector)
Definition: footprint.cpp:2865
bool IsExcludedFromBOM() const
Definition: footprint.h:737
void SetOrientation(const EDA_ANGLE &aNewAngle)
Definition: footprint.cpp:2595
void SetFlag(int aFlag)
Definition: footprint.h:302
std::optional< double > m_solderPasteMarginRatio
Definition: footprint.h:1119
void SetDNP(bool aDNP=true)
Definition: footprint.h:747
void SetAllowSolderMaskBridges(bool aAllow)
Definition: footprint.h:300
void RecomputeComponentClass() const
Forces immediate recalculation of the component class for this footprint.
Definition: footprint.cpp:4116
std::vector< ZONE * > m_zones
Definition: footprint.h:1069
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:2384
unsigned GetPadCount(INCLUDE_NPTH_T aIncludeNPTH=INCLUDE_NPTH_T(INCLUDE_NPTH)) const
Return the number of pads.
Definition: footprint.cpp:2061
void SetLocalSolderPasteMarginRatio(std::optional< double > aRatio)
Definition: footprint.h:288
void IncrementFlag()
Definition: footprint.h:303
double ViewGetLOD(int aLayer, const KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
Definition: footprint.cpp:2340
std::optional< int > m_clearance
Definition: footprint.h:1116
bool m_duplicatePadNumbersAreJumpers
Flag that this footprint should automatically treat sets of two or more pads with the same number as ...
Definition: footprint.h:1109
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:3439
void CheckPads(UNITS_PROVIDER *aUnitsProvider, const std::function< void(const PAD *, int, const wxString &)> &aErrorHandler)
Run non-board-specific DRC checks on footprint's pads.
Definition: footprint.cpp:3352
void SetExcludedFromBOM(bool aExclude=true)
Definition: footprint.h:738
wxString GetSheetname() const
Definition: footprint.h:269
int m_fpStatus
Definition: footprint.h:1076
void SetPath(const KIID_PATH &aPath)
Definition: footprint.h:267
SHAPE_POLY_SET m_cachedHull
Definition: footprint.h:1093
std::set< wxString > GetUniquePadNumbers(INCLUDE_NPTH_T aIncludeNPTH=INCLUDE_NPTH_T(INCLUDE_NPTH)) const
Return the names of the unique, non-blank pads.
Definition: footprint.cpp:2080
void SetFilters(const wxString &aFilters)
Definition: footprint.h:276
void SetKeywords(const wxString &aKeywords)
Definition: footprint.h:264
void SetStaticComponentClass(const COMPONENT_CLASS *aClass) const
Sets the component class object pointer for this footprint.
Definition: footprint.cpp:4104
const DRAWINGS & GraphicalItems() const
Definition: footprint.h:213
void SetInitialComments(wxArrayString *aInitialComments)
Take ownership of caller's heap allocated aInitialComments block.
Definition: footprint.h:926
int m_attributes
Definition: footprint.h:1075
PCB_LAYER_ID GetSide() const
Use instead of IsFlipped() when you also need to account for unsided footprints (those purely on user...
Definition: footprint.cpp:1772
const BOX2I GetLayerBoundingBox(const LSET &aLayers) const
Return the bounding box of the footprint on a given set of layers.
Definition: footprint.cpp:1497
std::vector< FP_3DMODEL > m_3D_Drawings
Definition: footprint.h:1133
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:2958
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction, RECURSE_MODE aMode) const override
Invoke a function on all children.
Definition: footprint.cpp:2256
bool FootprintNeedsUpdate(const FOOTPRINT *aLibFP, int aCompareFlags=0, REPORTER *aReporter=nullptr)
Return true if a board footprint differs from the library version.
bool m_allowMissingCourtyard
Definition: footprint.h:1111
std::unordered_set< wxString > m_transientComponentClassNames
Definition: footprint.h:1143
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:3022
void SetAttributes(int aAttributes)
Definition: footprint.h:294
void SetSheetfile(const wxString &aSheetfile)
Definition: footprint.h:273
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: footprint.cpp:2244
std::optional< int > GetLocalSolderPasteMargin() const
Definition: footprint.h:284
std::unique_ptr< COMPONENT_CLASS_CACHE_PROXY > m_componentClassCacheProxy
Definition: footprint.h:1144
wxArrayString * m_initial_comments
Definition: footprint.h:1134
EDA_ITEM * Clone() const override
Invoke a function on all children.
Definition: footprint.cpp:2250
BOX2I GetFpPadsLocalBbox() const
Return the bounding box containing pads when the footprint is on the front side, orientation 0,...
Definition: footprint.cpp:1311
std::deque< PCB_FIELD * > m_fields
Definition: footprint.h:1066
PCB_FIELD & Value()
read/write accessors:
Definition: footprint.h:663
const EMBEDDED_FILES * GetEmbeddedFiles() const
Definition: footprint.h:976
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
Definition: footprint.cpp:2422
std::optional< int > m_solderPasteMargin
Definition: footprint.h:1118
const std::vector< std::set< wxString > > & JumperPadGroups() const
Definition: footprint.h:825
void SetFileFormatVersionAtLoad(int aVersion)
Definition: footprint.h:755
std::mutex m_courtyard_cache_mutex
Definition: footprint.h:1141
void SetExcludedFromPosFiles(bool aExclude=true)
Definition: footprint.h:729
void SetOrientationDegrees(double aOrientation)
Definition: footprint.h:242
std::optional< const std::set< wxString > > GetJumperPadGroup(const wxString &aPadNumber) const
Retrieves the jumper group containing the specified pad number, if one exists.
Definition: footprint.cpp:2798
void ApplyDefaultSettings(const BOARD &board, bool aStyleFields, bool aStyleText, bool aStyleShapes)
Apply default board settings to the footprint field text properties.
Definition: footprint.cpp:672
std::map< wxString, int > MapPadNumbersToNetTieGroups() const
Definition: footprint.cpp:3250
std::optional< int > GetLocalClearance() const
Definition: footprint.h:278
double Similarity(const BOARD_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
Definition: footprint.cpp:3709
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:572
void MoveAnchorPosition(const VECTOR2I &aMoveVector)
Move the reference point of the footprint.
Definition: footprint.cpp:2544
std::vector< std::set< wxString > > & JumperPadGroups()
Each jumper pad group is a set of pad numbers that should be treated as internally connected.
Definition: footprint.h:824
void SetDuplicatePadNumbersAreJumpers(bool aEnabled)
Definition: footprint.h:818
bool m_allowSolderMaskBridges
Definition: footprint.h:1112
FOOTPRINT & operator=(const FOOTPRINT &aOther)
Definition: footprint.cpp:858
bool HasField(const wxString &aFieldName) const
Definition: footprint.cpp:620
PCB_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this footprint.
Definition: footprint.cpp:593
int m_arflag
Definition: footprint.h:1129
void TransformPadsToPolySet(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aMaxError, ERROR_LOC aErrorLoc) const
Generate pads shapes on layer aLayer as polygons and adds these polygons to aBuffer.
Definition: footprint.cpp:3938
double GetOrientationDegrees() const
Definition: footprint.h:246
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:2146
std::deque< PAD * > & Pads()
Definition: footprint.h:209
void ResolveComponentClassNames(BOARD *aBoard, const std::unordered_set< wxString > &aComponentClassNames)
Resolves a set of component class names to this footprint's actual component class.
Definition: footprint.cpp:4137
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition: footprint.cpp:282
int GetAttributes() const
Definition: footprint.h:293
bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const override
Compare the item against the search criteria in aSearchData.
Definition: footprint.cpp:2127
std::optional< int > GetLocalClearance(wxString *aSource) const
Definition: footprint.h:317
const COMPONENT_CLASS * GetComponentClass() const
Returns the component class for this footprint.
Definition: footprint.cpp:4122
void SetLocalZoneConnection(ZONE_CONNECTION aType)
Definition: footprint.h:290
BOARD_ITEM * DuplicateItem(bool addToParentGroup, BOARD_COMMIT *aCommit, const BOARD_ITEM *aItem, bool addToFootprint=false)
Duplicate a given item within the footprint, optionally adding it to the board.
Definition: footprint.cpp:2637
void ClearNetTiePadGroups()
Definition: footprint.h:350
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: footprint.h:239
LSET GetPrivateLayers() const
Definition: footprint.h:149
wxString GetFPIDAsString() const
Definition: footprint.h:257
wxString GetValueAsString() const
Definition: footprint.h:657
bool AllowMissingCourtyard() const
Definition: footprint.h:296
const ZONES & Zones() const
Definition: footprint.h:216
wxString GetComponentClassAsString() const
Used for display in the properties panel.
Definition: footprint.cpp:4128
bool IsFlipped() const
Definition: footprint.h:400
wxString GetSheetfile() const
Definition: footprint.h:272
SHAPE_POLY_SET GetBoundingHull() const
Return a bounding polygon for the shapes and pads in the footprint.
Definition: footprint.cpp:1542
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:4008
wxString GetTypeName() const
Get the type of footprint.
Definition: footprint.cpp:1299
bool NeedsPlaced() const
Definition: footprint.h:452
SHAPE_POLY_SET m_courtyard_cache_back
Definition: footprint.h:1138
int m_textExcludedBBoxCacheTimeStamp
Definition: footprint.h:1092
const std::vector< wxString > & GetNetTiePadGroups() const
Definition: footprint.h:348
const LIB_ID & GetFPID() const
Definition: footprint.h:251
const std::unordered_set< wxString > & GetTransientComponentClassNames()
Gets the transient component class names.
Definition: footprint.h:1020
void SetReference(const wxString &aReference)
Definition: footprint.h:633
bool IsLocked() const override
Definition: footprint.h:420
const GROUPS & Groups() const
Definition: footprint.h:219
bool IsExcludedFromPosFiles() const
Definition: footprint.h:728
void SetLayerAndFlip(PCB_LAYER_ID aLayer)
Used as Layer property setter – performs a flip if necessary to set the footprint layer.
Definition: footprint.cpp:2445
int m_hullCacheTimeStamp
Definition: footprint.h:1094
unsigned GetUniquePadCount(INCLUDE_NPTH_T aIncludeNPTH=INCLUDE_NPTH_T(INCLUDE_NPTH)) const
Return the number of unique non-blank pads.
Definition: footprint.cpp:2111
void AddNetTiePadGroup(const wxString &aGroup)
Definition: footprint.h:355
bool LegacyPadsLocked() const
Definition: footprint.h:461
virtual const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
Definition: footprint.cpp:2369
LSET m_privateLayers
Definition: footprint.h:1131
const std::set< int > & GetNetTieCache(const BOARD_ITEM *aItem) const
Get the set of net codes that are allowed to connect to a footprint item.
Definition: footprint.h:522
const std::deque< PCB_FIELD * > & GetFields() const
Return a reference to the deque holding the footprint's fields.
Definition: footprint.h:701
int GetLikelyAttribute() const
Returns the most likely attribute based on pads Either FP_THROUGH_HOLE/FP_SMD/OTHER(0)
Definition: footprint.cpp:1245
std::deque< PCB_GROUP * > m_groups
Definition: footprint.h:1070
void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition: footprint.cpp:2412
static bool ClassOf(const EDA_ITEM *aItem)
Definition: footprint.h:141
wxString m_libDescription
Definition: footprint.h:1122
bool HitTestOnLayer(const VECTOR2I &aPosition, PCB_LAYER_ID aLayer, int aAccuracy=0) const
Test if the point hits one or more of the footprint elements on a given layer.
Definition: footprint.cpp:1834
VECTOR2I m_pos
Definition: footprint.h:1073
void ClearTransientComponentClassNames()
Remove the transient component class names.
Definition: footprint.h:1026
ZONE_CONNECTION GetZoneConnectionOverrides(wxString *aSource) const
Definition: footprint.h:336
std::vector< wxString > m_netTiePadGroups
Definition: footprint.h:1098
void InvalidateGeometryCaches()
Resets the caches for this footprint, for example if it was modified via the API.
Definition: footprint.cpp:972
virtual std::vector< int > ViewGetLayers() const override
Return the all the layers within the VIEW the object is painted on.
Definition: footprint.cpp:2287
std::set< KIFONT::OUTLINE_FONT * > GetFonts() const override
Get a list of outline fonts referenced in the footprint.
Definition: footprint.cpp:4060
void Add3DModel(FP_3DMODEL *a3DModel)
Add a3DModel definition to the end of the 3D model list.
Definition: footprint.cpp:2117
void SetValue(const wxString &aValue)
Definition: footprint.h:654
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:1685
PCB_FIELD & Reference()
Definition: footprint.h:664
std::vector< std::set< wxString > > m_jumperPadGroups
A list of jumper pad groups, each of which is a set of pad numbers that should be jumpered together (...
Definition: footprint.h:1105
const PCB_FIELD & Value() const
The const versions to keep the compiler happy.
Definition: footprint.h:667
wxString GetReferenceAsString() const
Definition: footprint.h:636
wxString m_sheetfile
Definition: footprint.h:1126
void GetContextualTextVars(wxArrayString *aVars) const
Return the list of system text vars for this footprint.
Definition: footprint.cpp:989
std::optional< int > m_solderMaskMargin
Definition: footprint.h:1117
SHAPE_POLY_SET m_courtyard_cache_front
Definition: footprint.h:1137
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition: footprint.cpp:1080
std::vector< const PAD * > GetPads(const wxString &aPadNumber, const PAD *aIgnore=nullptr) const
Definition: footprint.cpp:2045
void AutoPositionFields()
Position Reference and Value fields at the top and bottom of footprint's bounding box.
Definition: footprint.cpp:2810
void addMandatoryFields()
wxString m_keywords
Definition: footprint.h:1123
const PCB_FIELD & Reference() const
Definition: footprint.h:668
void SetTransientComponentClassNames(const std::unordered_set< wxString > &classNames)
Sets the transient component class names.
Definition: footprint.h:1014
void ClearAllNets()
Clear (i.e.
Definition: footprint.cpp:1071
std::deque< PAD * > m_pads
Definition: footprint.h:1068
bool HasThroughHolePads() const
Definition: footprint.cpp:3635
void BuildCourtyardCaches(OUTLINE_ERROR_HANDLER *aErrorHandler=nullptr)
Build complex polygons of the courtyard areas from graphic items on the courtyard layers.
Definition: footprint.cpp:3081
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
Definition: footprint.cpp:1803
EDA_ANGLE m_orient
Definition: footprint.h:1072
bool HitTestAccurate(const VECTOR2I &aPosition, int aAccuracy=0) const
Test if a point is inside the bounding polygon of the footprint.
Definition: footprint.cpp:1909
bool IsNetTie() const
Definition: footprint.h:306
wxString GetClass() const override
Return the class name.
Definition: footprint.h:866
void IncrementReference(int aDelta)
Bump the current reference by aDelta.
Definition: footprint.cpp:2838
int GetFileFormatVersionAtLoad() const
Definition: footprint.h:756
std::optional< double > GetLocalSolderPasteMarginRatio() const
Definition: footprint.h:287
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
Definition: footprint.cpp:2454
KIID m_link
Definition: footprint.h:1130
GROUPS & Groups()
Definition: footprint.h:218
wxString GetFilters() const
Definition: footprint.h:275
void SetSheetname(const wxString &aSheetname)
Definition: footprint.h:270
const wxArrayString * GetInitialComments() const
Return the initial comments block or NULL if none, without transfer of ownership.
Definition: footprint.h:943
KIID GetLink() const
Definition: footprint.h:843
void SetAllowMissingCourtyard(bool aAllow)
Definition: footprint.h:297
void BuildNetTieCache()
Cache the pads that are allowed to connect to each other in the footprint.
Definition: footprint.cpp:3183
bool IsConflicting() const
Definition: footprint.cpp:983
std::vector< FP_3DMODEL > & Models()
Definition: footprint.h:223
BOARD_ITEM * Duplicate(bool addToParentGroup, BOARD_COMMIT *aCommit=nullptr) const override
Create a copy of this BOARD_ITEM.
Definition: footprint.cpp:2623
const SHAPE_POLY_SET & GetCachedCourtyard(PCB_LAYER_ID aLayer) const
Return the cached courtyard area.
Definition: footprint.cpp:3072
std::deque< PCB_FIELD * > & GetFields()
Definition: footprint.h:702
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:2395
void SetLibDescription(const wxString &aDesc)
Definition: footprint.h:261
bool TextOnly() const
Definition: footprint.cpp:1332
const wxString & GetValue() const
Definition: footprint.h:649
const COMPONENT_CLASS * GetStaticComponentClass() const
Returns the component class for this footprint.
Definition: footprint.cpp:4110
void CheckShortingPads(const std::function< void(const PAD *, const PAD *, int aErrorCode, const VECTOR2I &)> &aErrorHandler)
Check for overlapping, different-numbered, non-net-tie pads.
Definition: footprint.cpp:3370
double GetArea(int aPadding=0) const
Definition: footprint.cpp:1235
void SetNeedsPlaced(bool needsPlaced)
Definition: footprint.h:453
wxString m_filters
Definition: footprint.h:1127
const wxString & GetReference() const
Definition: footprint.h:627
void CopyFrom(const BOARD_ITEM *aOther) override
Definition: footprint.cpp:962
void CheckNetTiePadGroups(const std::function< void(const wxString &)> &aErrorHandler)
Sanity check net-tie pad groups.
Definition: footprint.cpp:3550
void SetFPIDAsString(const wxString &aFPID)
Definition: footprint.h:258
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
Definition: footprint.cpp:2233
void SetBoardOnly(bool aIsBoardOnly=true)
Definition: footprint.h:720
const std::vector< FP_3DMODEL > & Models() const
Definition: footprint.h:224
void SetLocalSolderMaskMargin(std::optional< int > aMargin)
Definition: footprint.h:282
timestamp_t m_lastEditTime
Definition: footprint.h:1128
PAD * GetPad(const VECTOR2I &aPosition, const LSET &aLayerMask=LSET::AllLayersMask())
Get a pad at aPosition on aLayerMask in the footprint.
Definition: footprint.cpp:2029
const SHAPE_POLY_SET & GetCourtyard(PCB_LAYER_ID aLayer) const
Used in DRC to test the courtyard area (a complex polygon).
Definition: footprint.cpp:3058
int GetFlag() const
Definition: footprint.h:304
std::map< const BOARD_ITEM *, std::set< int > > m_netTieCache
Definition: footprint.h:1101
wxString m_sheetname
Definition: footprint.h:1125
int m_fileFormatVersionAtLoad
Definition: footprint.h:1077
void SetLocalClearance(std::optional< int > aClearance)
Definition: footprint.h:279
void SetPrivateLayers(const LSET &aLayers)
Adds an item to the container.
Definition: footprint.h:150
const KIID_PATH & GetPath() const
Definition: footprint.h:266
std::optional< int > GetLocalSolderMaskMargin() const
Definition: footprint.h:281
void SetLocalSolderPasteMargin(std::optional< int > aMargin)
Definition: footprint.h:285
wxString GetKeywords() const
Definition: footprint.h:263
bool operator==(const BOARD_ITEM &aOther) const override
Definition: footprint.cpp:3647
EMBEDDED_FILES * GetEmbeddedFiles() override
Definition: footprint.h:971
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:3327
virtual void swapData(BOARD_ITEM *aImage) override
Definition: footprint.cpp:3611
wxString GetNextPadNumber(const wxString &aLastPadName) const
Return the next available pad number in the footprint.
Definition: footprint.cpp:2778
bool IsPlaced() const
Definition: footprint.h:443
int m_boundingBoxCacheTimeStamp
Definition: footprint.h:1090
VECTOR2I GetPosition() const override
Definition: footprint.h:227
DRAWINGS & GraphicalItems()
Definition: footprint.h:212
HASH_128 m_courtyard_cache_front_hash
Definition: footprint.h:1139
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:1902
PAD * FindPadByNumber(const wxString &aPadNumber, PAD *aSearchAfterMe=nullptr) const
Return a PAD with a matching number.
Definition: footprint.cpp:2009
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: footprint.cpp:1347
bool operator==(const FP_3DMODEL &aOther) const
Definition: footprint.h:109
VECTOR3D m_Offset
3D model offset (mm)
Definition: footprint.h:104
double m_Opacity
Definition: footprint.h:105
VECTOR3D m_Rotation
3D model rotation (degrees)
Definition: footprint.h:103
FP_3DMODEL()
Definition: footprint.h:92
VECTOR3D m_Scale
3D model scaling factor (dimensionless)
Definition: footprint.h:102
wxString m_Filename
The 3D shape filename in 3D library.
Definition: footprint.h:106
bool m_Show
Include model in rendering.
Definition: footprint.h:107
Used when the right click button is pressed, or when the select tool is in effect.
Definition: collectors.h:207
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:66
Definition: kiid.h:49
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:52
UTF8 Format() const
Definition: lib_id.cpp:119
An abstract class from which implementation specific LINE_READERs may be derived to read single lines...
Definition: richio.h:93
LSET is a set of PCB_LAYER_IDs.
Definition: lset.h:37
static const LSET & AllLayersMask()
Definition: lset.cpp:624
EDA_MSG_PANEL items for displaying messages.
Definition: msgpanel.h:54
Definition: pad.h:54
A pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:73
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
Represent a set of closed polygons.
An abstract shape on 2D plane.
Definition: shape.h:126
Handle a list of polygons defining a copper zone.
Definition: zone.h:74
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
RECURSE_MODE
Definition: eda_item.h:50
INSPECT_RESULT
Definition: eda_item.h:44
const INSPECTOR_FUNC & INSPECTOR
std::function passed to nested users by ref, avoids copying std::function.
Definition: eda_item.h:91
INCLUDE_NPTH_T
Definition: footprint.h:68
@ INCLUDE_NPTH
Definition: footprint.h:70
@ DO_NOT_INCLUDE_NPTH
Definition: footprint.h:69
FOOTPRINT_ATTR_T
The set of attributes allowed within a FOOTPRINT, using FOOTPRINT::SetAttributes() and FOOTPRINT::Get...
Definition: footprint.h:79
@ FP_SMD
Definition: footprint.h:81
@ FP_DNP
Definition: footprint.h:86
@ FP_EXCLUDE_FROM_POS_FILES
Definition: footprint.h:82
@ FP_BOARD_ONLY
Definition: footprint.h:84
@ FP_EXCLUDE_FROM_BOM
Definition: footprint.h:83
@ FP_JUST_ADDED
Definition: footprint.h:85
@ FP_THROUGH_HOLE
Definition: footprint.h:80
#define FP_is_PLACED
In autoplace: footprint automatically placed.
Definition: footprint.h:415
#define FP_is_LOCKED
footprint LOCKED: no autoplace allowed
Definition: footprint.h:414
#define FP_PADS_are_LOCKED
Definition: footprint.h:417
#define FP_to_PLACE
In autoplace: footprint waiting for autoplace.
Definition: footprint.h:416
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:46
FLASHING
Enum used during connectivity building to ensure we do not query connectivity while building the data...
Definition: layer_ids.h:184
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:60
@ B_Cu
Definition: layer_ids.h:65
@ UNDEFINED_LAYER
Definition: layer_ids.h:61
FLIP_DIRECTION
Definition: mirror.h:27
The Cairo implementation of the graphics abstraction layer.
Definition: eda_group.h:33
std::vector< ZONE * > ZONES
Definition: pcb_io_eagle.h:47
bool operator()(const BOARD_ITEM *itemA, const BOARD_ITEM *itemB) const
Definition: footprint.cpp:3732
bool operator()(const PAD *aFirst, const PAD *aSecond) const
Definition: footprint.cpp:3809
bool operator()(const ZONE *aFirst, const ZONE *aSecond) const
Definition: footprint.cpp:3912
A storage class for 128-bit hash value.
Definition: hash_128.h:36
FIELD_T
The set of all field indices assuming an array like sequence that a SCH_COMPONENT or LIB_PART can hol...
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
Definition: typeinfo.h:86
ZONE_CONNECTION
How pads are covered by copper in zone.
Definition: zones.h:47