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
88 FP_DNP = 0x0100
89};
90
92{
93public:
95 // Initialize with sensible values
96 m_Scale { 1, 1, 1 },
97 m_Rotation { 0, 0, 0 },
98 m_Offset { 0, 0, 0 },
99 m_Opacity( 1.0 ),
100 m_Show( true )
101 {
102 }
103
107 double m_Opacity;
108 wxString m_Filename;
109 bool m_Show;
110
111 bool operator==( const FP_3DMODEL& aOther ) const
112 {
113 return m_Scale == aOther.m_Scale
114 && m_Rotation == aOther.m_Rotation
115 && m_Offset == aOther.m_Offset
116 && m_Opacity == aOther.m_Opacity
117 && m_Filename == aOther.m_Filename
118 && m_Show == aOther.m_Show;
119 }
120};
121
122
124{
125public:
126 FOOTPRINT( BOARD* parent );
127
128 FOOTPRINT( const FOOTPRINT& aFootprint );
129
130 // Move constructor and operator needed due to std containers inside the footprint
131 FOOTPRINT( FOOTPRINT&& aFootprint );
132
133 ~FOOTPRINT();
134
135 FOOTPRINT& operator=( const FOOTPRINT& aOther );
136 FOOTPRINT& operator=( FOOTPRINT&& aOther );
137
138 void CopyFrom( const BOARD_ITEM* aOther ) override;
139
140 void Serialize( google::protobuf::Any &aContainer ) const override;
141 bool Deserialize( const google::protobuf::Any &aContainer ) override;
142
143 static inline bool ClassOf( const EDA_ITEM* aItem )
144 {
145 return aItem && aItem->Type() == PCB_FOOTPRINT_T;
146 }
147
150
152 void SetPrivateLayers( const LSET& aLayers ) { m_privateLayers = aLayers; }
153
155 void Add( BOARD_ITEM* aItem, ADD_MODE aMode = ADD_MODE::INSERT,
156 bool aSkipConnectivity = false ) override;
157
159 void Remove( BOARD_ITEM* aItem, REMOVE_MODE aMode = REMOVE_MODE::NORMAL ) override;
160
168 void ClearAllNets();
169
177 bool FixUuids();
178
189
197
198 bool TextOnly() const;
199
200 // Virtual function
201 const BOX2I GetBoundingBox() const override;
202 const BOX2I GetBoundingBox( bool aIncludeText ) const;
203
207 const BOX2I GetLayerBoundingBox( const LSET& aLayers ) const;
208
209 VECTOR2I GetCenter() const override { return GetBoundingBox( false ).GetCenter(); }
210
211 std::deque<PAD*>& Pads() { return m_pads; }
212 const std::deque<PAD*>& Pads() const { return m_pads; }
213
214 DRAWINGS& GraphicalItems() { return m_drawings; }
215 const DRAWINGS& GraphicalItems() const { return m_drawings; }
216
217 ZONES& Zones() { return m_zones; }
218 const ZONES& Zones() const { return m_zones; }
219
220 GROUPS& Groups() { return m_groups; }
221 const GROUPS& Groups() const { return m_groups; }
222
223 bool HasThroughHolePads() const;
224
225 std::vector<FP_3DMODEL>& Models() { return m_3D_Drawings; }
226 const std::vector<FP_3DMODEL>& Models() const { return m_3D_Drawings; }
227
228 void SetPosition( const VECTOR2I& aPos ) override;
229 VECTOR2I GetPosition() const override { return m_pos; }
230
231 void SetOrientation( const EDA_ANGLE& aNewAngle );
233
238 void SetLayerAndFlip( PCB_LAYER_ID aLayer );
239
240 // to make property magic work
241 PCB_LAYER_ID GetLayer() const override { return BOARD_ITEM::GetLayer(); }
242
243 // For property system:
244 void SetOrientationDegrees( double aOrientation )
245 {
246 SetOrientation( EDA_ANGLE( aOrientation, DEGREES_T ) );
247 }
249 {
250 return m_orient.AsDegrees();
251 }
252
253 const LIB_ID& GetFPID() const { return m_fpid; }
254 void SetFPID( const LIB_ID& aFPID )
255 {
256 m_fpid = aFPID;
257 }
258
259 wxString GetFPIDAsString() const { return m_fpid.Format(); }
260 void SetFPIDAsString( const wxString& aFPID ) { m_fpid.Parse( aFPID ); }
261
262 wxString GetLibDescription() const { return m_libDescription; }
263 void SetLibDescription( const wxString& aDesc ) { m_libDescription = aDesc; }
264
265 wxString GetKeywords() const { return m_keywords; }
266 void SetKeywords( const wxString& aKeywords ) { m_keywords = aKeywords; }
267
268 const KIID_PATH& GetPath() const { return m_path; }
269 void SetPath( const KIID_PATH& aPath ) { m_path = aPath; }
270
271 wxString GetSheetname() const { return m_sheetname; }
272 void SetSheetname( const wxString& aSheetname ) { m_sheetname = aSheetname; }
273
274 wxString GetSheetfile() const { return m_sheetfile; }
275 void SetSheetfile( const wxString& aSheetfile ) { m_sheetfile = aSheetfile; }
276
277 wxString GetFilters() const { return m_filters; }
278 void SetFilters( const wxString& aFilters ) { m_filters = aFilters; }
279
280 std::optional<int> GetLocalClearance() const { return m_clearance; }
281 void SetLocalClearance( std::optional<int> aClearance ) { m_clearance = aClearance; }
282
283 std::optional<int> GetLocalSolderMaskMargin() const { return m_solderMaskMargin; }
284 void SetLocalSolderMaskMargin( std::optional<int> aMargin ) { m_solderMaskMargin = aMargin; }
285
286 std::optional<int> GetLocalSolderPasteMargin() const { return m_solderPasteMargin; }
287 void SetLocalSolderPasteMargin( std::optional<int> aMargin ) { m_solderPasteMargin = aMargin; }
288
289 std::optional<double> GetLocalSolderPasteMarginRatio() const { return m_solderPasteMarginRatio; }
290 void SetLocalSolderPasteMarginRatio( std::optional<double> aRatio ) { m_solderPasteMarginRatio = aRatio; }
291
294
295 int GetAttributes() const { return m_attributes; }
296 void SetAttributes( int aAttributes ) { m_attributes = aAttributes; }
297
298 void SetFlag( int aFlag ) { m_arflag = aFlag; }
299 void IncrementFlag() { m_arflag += 1; }
300 int GetFlag() const { return m_arflag; }
301
302 bool IsNetTie() const
303 {
304 for( const wxString& group : m_netTiePadGroups )
305 {
306 if( !group.IsEmpty() )
307 return true;
308 }
309
310 return false;
311 }
312
313 std::optional<int> GetLocalClearance( wxString* aSource ) const
314 {
315 if( m_clearance.has_value() && aSource )
316 *aSource = wxString::Format( _( "footprint %s" ), GetReference() );
317
318 return m_clearance;
319 }
320
327 std::optional<int> GetClearanceOverrides( wxString* aSource ) const
328 {
329 return GetLocalClearance( aSource );
330 }
331
333 {
334 if( m_zoneConnection != ZONE_CONNECTION::INHERITED && aSource )
335 *aSource = wxString::Format( _( "footprint %s" ), GetReference() );
336
337 return m_zoneConnection;
338 }
339
344 const std::vector<wxString>& GetNetTiePadGroups() const { return m_netTiePadGroups; }
345
347 {
348 m_netTiePadGroups.clear();
349 }
350
351 void AddNetTiePadGroup( const wxString& aGroup )
352 {
353 m_netTiePadGroups.emplace_back( aGroup );
354 }
355
360 std::map<wxString, int> MapPadNumbersToNetTieGroups() const;
361
365 std::vector<PAD*> GetNetTiePads( PAD* aPad ) const;
366
372 int GetLikelyAttribute() const;
373
374 void Move( const VECTOR2I& aMoveVector ) override;
375
376 void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override;
377
378 void Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
379
391 void MoveAnchorPosition( const VECTOR2I& aMoveVector );
392
396 bool IsFlipped() const { return GetLayer() == B_Cu; }
397
402 PCB_LAYER_ID GetSide() const;
403
407 bool IsOnLayer( PCB_LAYER_ID aLayer ) const override;
408
409// m_footprintStatus bits:
410#define FP_is_LOCKED 0x01
411#define FP_is_PLACED 0x02
412#define FP_to_PLACE 0x04
413#define FP_PADS_are_LOCKED 0x08
414
415
416 bool IsLocked() const override
417 {
418 return ( m_fpStatus & FP_is_LOCKED ) != 0;
419 }
420
426 void SetLocked( bool isLocked ) override
427 {
428 if( isLocked )
430 else
431 m_fpStatus &= ~FP_is_LOCKED;
432 }
433
437 bool IsConflicting() const;
438
439 bool IsPlaced() const { return m_fpStatus & FP_is_PLACED; }
440 void SetIsPlaced( bool isPlaced )
441 {
442 if( isPlaced )
444 else
445 m_fpStatus &= ~FP_is_PLACED;
446 }
447
448 bool NeedsPlaced() const { return m_fpStatus & FP_to_PLACE; }
449 void SetNeedsPlaced( bool needsPlaced )
450 {
451 if( needsPlaced )
453 else
454 m_fpStatus &= ~FP_to_PLACE;
455 }
456
458
469 void CheckFootprintAttributes( const std::function<void( const wxString& )>& aErrorHandler );
470
477 void CheckPads( UNITS_PROVIDER* aUnitsProvider,
478 const std::function<void( const PAD*, int, const wxString& )>& aErrorHandler );
479
485 void CheckShortingPads( const std::function<void( const PAD*, const PAD*, int aErrorCode,
486 const VECTOR2I& )>& aErrorHandler );
487
494 void CheckNetTies( const std::function<void( const BOARD_ITEM* aItem,
495 const BOARD_ITEM* bItem,
496 const BOARD_ITEM* cItem,
497 const VECTOR2I& )>& aErrorHandler );
498
505 void CheckNetTiePadGroups( const std::function<void( const wxString& )>& aErrorHandler );
506
507 void CheckClippedSilk( const std::function<void( BOARD_ITEM* aItemA,
508 BOARD_ITEM* aItemB,
509 const VECTOR2I& aPt )>& aErrorHandler );
513 void BuildNetTieCache();
514
518 const std::set<int>& GetNetTieCache( const BOARD_ITEM* aItem ) const
519 {
520 static const std::set<int> emptySet;
521
522 auto it = m_netTieCache.find( aItem );
523
524 if( it == m_netTieCache.end() )
525 return emptySet;
526
527 return it->second;
528 }
529
542 void TransformPadsToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
543 int aMaxError, ERROR_LOC aErrorLoc ) const;
544
559 void TransformFPShapesToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
560 int aError, ERROR_LOC aErrorLoc,
561 bool aIncludeText = true,
562 bool aIncludeShapes = true,
563 bool aIncludePrivateItems = false ) const;
564
568 void TransformFPTextToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
569 int aError, ERROR_LOC aErrorLoc ) const
570 {
571 TransformFPShapesToPolySet( aBuffer, aLayer, aClearance, aError, aErrorLoc, true, false );
572 }
573
577 void GetContextualTextVars( wxArrayString* aVars ) const;
578
584 bool ResolveTextVar( wxString* token, int aDepth = 0 ) const;
585
587 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
588
589 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
590
591 bool Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const override;
592
602 bool HitTestAccurate( const VECTOR2I& aPosition, int aAccuracy = 0 ) const;
603
604 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
605
614 bool HitTestOnLayer( const VECTOR2I& aPosition, PCB_LAYER_ID aLayer, int aAccuracy = 0 ) const;
615
616 bool HitTestOnLayer( const BOX2I& aRect, bool aContained, PCB_LAYER_ID aLayer, int aAccuracy = 0 ) const;
617
621 const wxString& GetReference() const { return Reference().GetText(); }
622
627 void SetReference( const wxString& aReference ) { Reference().SetText( aReference ); }
628
629 // Property system doesn't like const references
630 wxString GetReferenceAsString() const
631 {
632 return GetReference();
633 }
634
638 void IncrementReference( int aDelta );
639
643 const wxString& GetValue() const { return Value().GetText(); }
644
648 void SetValue( const wxString& aValue ) { Value().SetText( aValue ); }
649
650 // Property system doesn't like const references
651 wxString GetValueAsString() const
652 {
653 return GetValue();
654 }
655
657 PCB_FIELD& Value() { return *GetField( FIELD_T::VALUE ); }
658 PCB_FIELD& Reference() { return *GetField( FIELD_T::REFERENCE ); }
659
661 const PCB_FIELD& Value() const { return *GetField( FIELD_T::VALUE ); }
662 const PCB_FIELD& Reference() const { return *GetField( FIELD_T::REFERENCE ); }
663
664 //-----<Fields>-----------------------------------------------------------
665
670 PCB_FIELD* GetField( FIELD_T aFieldType );
671 const PCB_FIELD* GetField( FIELD_T aFieldNdx ) const;
672
680 PCB_FIELD* GetField( const wxString& aFieldName ) const;
681
682 bool HasField( const wxString& aFieldName ) const;
683
690 void GetFields( std::vector<PCB_FIELD*>& aVector, bool aVisibleOnly ) const;
691
695 const std::deque<PCB_FIELD*>& GetFields() const { return m_fields; }
696 std::deque<PCB_FIELD*>& GetFields() { return m_fields; }
697
701 int GetNextFieldOrdinal() const;
702
710 void ApplyDefaultSettings( const BOARD& board, bool aStyleFields, bool aStyleText,
711 bool aStyleShapes );
712
713 bool IsBoardOnly() const { return m_attributes & FP_BOARD_ONLY; }
714 void SetBoardOnly( bool aIsBoardOnly = true )
715 {
716 if( aIsBoardOnly )
718 else
719 m_attributes &= ~FP_BOARD_ONLY;
720 }
721
723 void SetExcludedFromPosFiles( bool aExclude = true )
724 {
725 if( aExclude )
727 else
728 m_attributes &= ~FP_EXCLUDE_FROM_POS_FILES;
729 }
730
732 void SetExcludedFromBOM( bool aExclude = true )
733 {
734 if( aExclude )
736 else
737 m_attributes &= ~FP_EXCLUDE_FROM_BOM;
738 }
739
741 void SetAllowMissingCourtyard( bool aAllow = true )
742 {
743 if( aAllow )
745 else
746 m_attributes &= ~FP_ALLOW_MISSING_COURTYARD;
747 }
748
749 bool IsDNP() const { return m_attributes & FP_DNP; }
750 void SetDNP( bool aDNP = true )
751 {
752 if( aDNP )
754 else
755 m_attributes &= ~FP_DNP;
756 }
757
758 void SetFileFormatVersionAtLoad( int aVersion ) { m_fileFormatVersionAtLoad = aVersion; }
760
770 PAD* FindPadByNumber( const wxString& aPadNumber, PAD* aSearchAfterMe = nullptr ) const;
771
779 PAD* GetPad( const VECTOR2I& aPosition, const LSET& aLayerMask = LSET::AllLayersMask() );
780
781 std::vector<const PAD*> GetPads( const wxString& aPadNumber,
782 const PAD* aIgnore = nullptr ) const;
783
791 unsigned GetPadCount( INCLUDE_NPTH_T aIncludeNPTH = INCLUDE_NPTH_T(INCLUDE_NPTH) ) const;
792
803 unsigned GetUniquePadCount( INCLUDE_NPTH_T aIncludeNPTH = INCLUDE_NPTH_T(INCLUDE_NPTH) ) const;
804
808 std::set<wxString>
810
818 wxString GetNextPadNumber( const wxString& aLastPadName ) const;
819
822
827 std::vector<std::set<wxString>>& JumperPadGroups() { return m_jumperPadGroups; }
828 const std::vector<std::set<wxString>>& JumperPadGroups() const { return m_jumperPadGroups; }
829
831 std::optional<const std::set<wxString>> GetJumperPadGroup( const wxString& aPadNumber ) const;
832
836 void AutoPositionFields();
837
842 wxString GetTypeName() const;
843
844 double GetArea( int aPadding = 0 ) const;
845
846 KIID GetLink() const { return m_link; }
847 void SetLink( const KIID& aLink ) { m_link = aLink; }
848
849 BOARD_ITEM* Duplicate() const override;
850
856 BOARD_ITEM* DuplicateItem( const BOARD_ITEM* aItem, bool aAddToFootprint = false );
857
863 void Add3DModel( FP_3DMODEL* a3DModel );
864
865 INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
866 const std::vector<KICAD_T>& aScanTypes ) override;
867
868 wxString GetClass() const override
869 {
870 return wxT( "FOOTPRINT" );
871 }
872
873 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
874
875 BITMAPS GetMenuImage() const override;
876
877 EDA_ITEM* Clone() const override;
878
880 void RunOnChildren( const std::function<void( BOARD_ITEM* )>& aFunction, RECURSE_MODE aMode ) const override;
881
882 virtual std::vector<int> ViewGetLayers() const override;
883
884 double ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const override;
885
886 virtual const BOX2I ViewBBox() const override;
887
895 static bool IsLibNameValid( const wxString& aName );
896
906 static const wxChar* StringLibNameInvalidChars( bool aUserReadable );
907
911 bool FootprintNeedsUpdate( const FOOTPRINT* aLibFP, int aCompareFlags = 0,
912 REPORTER* aReporter = nullptr );
913
928 void SetInitialComments( wxArrayString* aInitialComments )
929 {
930 delete m_initial_comments;
931 m_initial_comments = aInitialComments;
932 }
933
940 double CoverageRatio( const GENERAL_COLLECTOR& aCollector ) const;
941
942 static double GetCoverageArea( const BOARD_ITEM* aItem, const GENERAL_COLLECTOR& aCollector );
943
945 const wxArrayString* GetInitialComments() const { return m_initial_comments; }
946
952 const SHAPE_POLY_SET& GetCourtyard( PCB_LAYER_ID aLayer ) const;
953
959 const SHAPE_POLY_SET& GetCachedCourtyard( PCB_LAYER_ID aLayer ) const;
960
967 void BuildCourtyardCaches( OUTLINE_ERROR_HANDLER* aErrorHandler = nullptr );
968
969 // @copydoc BOARD_ITEM::GetEffectiveShape
970 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
971 FLASHING aFlash = FLASHING::DEFAULT ) const override;
972
974 {
975 return static_cast<EMBEDDED_FILES*>( this );
976 }
977
979 {
980 return static_cast<const EMBEDDED_FILES*>( this );
981 }
982
986 std::set<KIFONT::OUTLINE_FONT*> GetFonts() const override;
987
988 void EmbedFonts() override;
989
990 double Similarity( const BOARD_ITEM& aOther ) const override;
991
993 void SetStaticComponentClass( const COMPONENT_CLASS* aClass ) const;
994
997
999 const COMPONENT_CLASS* GetComponentClass() const;
1000
1002 wxString GetComponentClassAsString() const;
1003
1005 void RecomputeComponentClass() const;
1006
1008 void InvalidateComponentClassCache() const;
1009
1016 void SetTransientComponentClassNames( const std::unordered_set<wxString>& classNames )
1017 {
1018 m_transientComponentClassNames = classNames;
1019 }
1020
1022 const std::unordered_set<wxString>& GetTransientComponentClassNames()
1023 {
1025 }
1026
1029
1031 void ResolveComponentClassNames( BOARD* aBoard,
1032 const std::unordered_set<wxString>& aComponentClassNames );
1033
1034 bool operator==( const BOARD_ITEM& aOther ) const override;
1035 bool operator==( const FOOTPRINT& aOther ) const;
1036
1037#if defined(DEBUG)
1038 virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
1039#endif
1040
1042 {
1043 bool operator()( const BOARD_ITEM* itemA, const BOARD_ITEM* itemB ) const;
1044 };
1045
1047 {
1048 bool operator()( const PAD* aFirst, const PAD* aSecond ) const;
1049 };
1050 // TODO(JE) padstacks -- this code isn't used anywhere though
1051#if 0
1052 struct cmp_padstack
1053 {
1054 bool operator()( const PAD* aFirst, const PAD* aSecond ) const;
1055 };
1056#endif
1058 {
1059 bool operator()( const ZONE* aFirst, const ZONE* aSecond ) const;
1060 };
1061
1062protected:
1063 virtual void swapData( BOARD_ITEM* aImage ) override;
1064
1066
1067private:
1068 std::deque<PCB_FIELD*> m_fields; // Fields, mapped by name, owned by pointer
1069 std::deque<BOARD_ITEM*> m_drawings; // Drawings in the footprint, owned by pointer
1070 std::deque<PAD*> m_pads; // Pads, owned by pointer
1071 std::vector<ZONE*> m_zones; // Rule area zones, owned by pointer
1072 std::deque<PCB_GROUP*> m_groups; // Groups, owned by pointer
1073
1074 EDA_ANGLE m_orient; // Orientation
1075 VECTOR2I m_pos; // Position of footprint on the board in internal units.
1076 LIB_ID m_fpid; // The #LIB_ID of the FOOTPRINT.
1077 int m_attributes; // Flag bits (see FOOTPRINT_ATTR_T)
1078 int m_fpStatus; // For autoplace: flags (LOCKED, FIELDS_AUTOPLACED)
1080
1081 // Bounding box caching strategy:
1082 // While we attempt to notice the low-hanging fruit operations and update the bounding boxes
1083 // accordingly, we rely mostly on a "if anything changed then the caches are stale" approach.
1084 // We implement this by having PCB_BASE_FRAME's OnModify() method increment an operation
1085 // counter, and storing that as a timestamp for the various caches.
1086 // This means caches will get regenerated often -- but still far less often than if we had no
1087 // caches at all. The principal opitmization would be to change to dirty flag and make sure
1088 // that any edit that could affect the bounding boxes (including edits to the footprint
1089 // children) marked the bounding boxes dirty. It would definitely be faster -- but also more
1090 // fragile.
1097
1098 // A list of pad groups, each of which is allowed to short nets within their group.
1099 // A pad group is a comma-separated list of pad numbers.
1100 std::vector<wxString> m_netTiePadGroups;
1101
1102 // A list of 1:N footprint item to allowed net numbers
1103 std::map<const BOARD_ITEM*, std::set<int>> m_netTieCache;
1104
1105 // Optional overrides
1107 std::optional<int> m_clearance;
1108 std::optional<int> m_solderMaskMargin; // Solder mask margin
1109 std::optional<int> m_solderPasteMargin; // Solder paste margin absolute value
1110 std::optional<double> m_solderPasteMarginRatio; // Solder mask margin ratio of pad size
1111 // The final margin is the sum of these 2 values
1112
1113 wxString m_libDescription; // File name and path for documentation file.
1114 wxString m_keywords; // Search keywords to find footprint in library.
1115 KIID_PATH m_path; // Path to associated symbol ([sheetUUID, .., symbolUUID]).
1116 wxString m_sheetname; // Name of the sheet containing the symbol for this footprint
1117 wxString m_sheetfile; // File of the sheet containing the symbol for this footprint
1118 wxString m_filters; // Footprint filters from symbol
1120 int m_arflag; // Use to trace ratsnest and auto routing.
1121 KIID m_link; // Temporary logical link used during editing
1122 LSET m_privateLayers; // Layers visible only in the footprint editor
1123
1124 std::vector<FP_3DMODEL> m_3D_Drawings; // 3D models.
1125 wxArrayString* m_initial_comments; // s-expression comments in the footprint,
1126 // lazily allocated only if needed for speed
1127
1130 std::vector<std::set<wxString>> m_jumperPadGroups;
1131
1135
1136 SHAPE_POLY_SET m_courtyard_cache_front; // Note that a footprint can have both front and back
1137 SHAPE_POLY_SET m_courtyard_cache_back; // courtyards populated.
1140 mutable std::mutex m_courtyard_cache_mutex;
1141
1142 std::unordered_set<wxString> m_transientComponentClassNames;
1143 std::unique_ptr<COMPONENT_CLASS_CACHE_PROXY> m_componentClassCacheProxy;
1144};
1145
1146#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:78
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:229
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:297
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:96
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:108
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:697
bool GetDuplicatePadNumbersAreJumpers() const
Definition: footprint.h:820
std::optional< int > GetClearanceOverrides(wxString *aSource) const
Return any local clearance overrides set in the "classic" (ie: pre-rule) system.
Definition: footprint.h:327
void EmbedFonts() override
Definition: footprint.cpp:4032
void SetPosition(const VECTOR2I &aPos) override
Definition: footprint.cpp:2462
void SetFPID(const LIB_ID &aFPID)
Definition: footprint.h:254
LIB_ID m_fpid
Definition: footprint.h:1076
wxString GetLibDescription() const
Definition: footprint.h:262
ZONE_CONNECTION GetLocalZoneConnection() const
Definition: footprint.h:293
void SetLink(const KIID &aLink)
Definition: footprint.h:847
KIID_PATH m_path
Definition: footprint.h:1115
std::deque< BOARD_ITEM * > m_drawings
Definition: footprint.h:1069
bool IsBoardOnly() const
Definition: footprint.h:713
BOX2I m_cachedTextExcludedBBox
Definition: footprint.h:1093
void InvalidateComponentClassCache() const
Forces deferred (on next access) recalculation of the component class for this footprint.
Definition: footprint.cpp:4089
const std::deque< PAD * > & Pads() const
Definition: footprint.h:212
bool IsDNP() const
Definition: footprint.h:749
void SetLocked(bool isLocked) override
Set the #MODULE_is_LOCKED bit in the m_ModuleStatus.
Definition: footprint.h:426
VECTOR2I GetCenter() const override
This defaults to the center of the bounding box if not overridden.
Definition: footprint.h:209
HASH_128 m_courtyard_cache_back_hash
Definition: footprint.h:1139
std::vector< PAD * > GetNetTiePads(PAD *aPad) const
Definition: footprint.cpp:3240
bool ResolveTextVar(wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the component.
Definition: footprint.cpp:995
EDA_ANGLE GetOrientation() const
Definition: footprint.h:232
ZONES & Zones()
Definition: footprint.h:217
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition: footprint.cpp:399
void CheckClippedSilk(const std::function< void(BOARD_ITEM *aItemA, BOARD_ITEM *aItemB, const VECTOR2I &aPt)> &aErrorHandler)
Definition: footprint.cpp:3511
void Remove(BOARD_ITEM *aItem, REMOVE_MODE aMode=REMOVE_MODE::NORMAL) override
Removes an item from the container.
Definition: footprint.cpp:1133
void SetIsPlaced(bool isPlaced)
Definition: footprint.h:440
ZONE_CONNECTION m_zoneConnection
Definition: footprint.h:1106
BOX2I m_cachedBoundingBox
Definition: footprint.h:1091
int GetNextFieldOrdinal() const
Return the next ordinal for a user field for this footprint.
Definition: footprint.cpp:653
static double GetCoverageArea(const BOARD_ITEM *aItem, const GENERAL_COLLECTOR &aCollector)
Definition: footprint.cpp:2800
bool IsExcludedFromBOM() const
Definition: footprint.h:731
void SetOrientation(const EDA_ANGLE &aNewAngle)
Definition: footprint.cpp:2544
void SetFlag(int aFlag)
Definition: footprint.h:298
std::optional< double > m_solderPasteMarginRatio
Definition: footprint.h:1110
void SetDNP(bool aDNP=true)
Definition: footprint.h:750
void RecomputeComponentClass() const
Forces immediate recalculation of the component class for this footprint.
Definition: footprint.cpp:4056
std::vector< ZONE * > m_zones
Definition: footprint.h:1071
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:2333
unsigned GetPadCount(INCLUDE_NPTH_T aIncludeNPTH=INCLUDE_NPTH_T(INCLUDE_NPTH)) const
Return the number of pads.
Definition: footprint.cpp:2010
void SetLocalSolderPasteMarginRatio(std::optional< double > aRatio)
Definition: footprint.h:290
void IncrementFlag()
Definition: footprint.h:299
double ViewGetLOD(int aLayer, const KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
Definition: footprint.cpp:2289
std::optional< int > m_clearance
Definition: footprint.h:1107
bool m_duplicatePadNumbersAreJumpers
Flag that this footprint should automatically treat sets of two or more pads with the same number as ...
Definition: footprint.h:1134
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:3374
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:3287
void SetExcludedFromBOM(bool aExclude=true)
Definition: footprint.h:732
wxString GetSheetname() const
Definition: footprint.h:271
int m_fpStatus
Definition: footprint.h:1078
void SetPath(const KIID_PATH &aPath)
Definition: footprint.h:269
SHAPE_POLY_SET m_cachedHull
Definition: footprint.h:1095
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:2029
void SetFilters(const wxString &aFilters)
Definition: footprint.h:278
void SetAllowMissingCourtyard(bool aAllow=true)
Definition: footprint.h:741
void SetKeywords(const wxString &aKeywords)
Definition: footprint.h:266
void SetStaticComponentClass(const COMPONENT_CLASS *aClass) const
Sets the component class object pointer for this footprint.
Definition: footprint.cpp:4044
const DRAWINGS & GraphicalItems() const
Definition: footprint.h:215
void SetInitialComments(wxArrayString *aInitialComments)
Take ownership of caller's heap allocated aInitialComments block.
Definition: footprint.h:928
int m_attributes
Definition: footprint.h:1077
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:1764
const BOX2I GetLayerBoundingBox(const LSET &aLayers) const
Return the bounding box of the footprint on a given set of layers.
Definition: footprint.cpp:1489
std::vector< FP_3DMODEL > m_3D_Drawings
Definition: footprint.h:1124
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:2893
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction, RECURSE_MODE aMode) const override
Invoke a function on all children.
Definition: footprint.cpp:2205
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:2586
bool FootprintNeedsUpdate(const FOOTPRINT *aLibFP, int aCompareFlags=0, REPORTER *aReporter=nullptr)
Return true if a board footprint differs from the library version.
std::unordered_set< wxString > m_transientComponentClassNames
Definition: footprint.h:1142
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:2957
void SetAttributes(int aAttributes)
Definition: footprint.h:296
void SetSheetfile(const wxString &aSheetfile)
Definition: footprint.h:275
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: footprint.cpp:2193
std::optional< int > GetLocalSolderPasteMargin() const
Definition: footprint.h:286
std::unique_ptr< COMPONENT_CLASS_CACHE_PROXY > m_componentClassCacheProxy
Definition: footprint.h:1143
wxArrayString * m_initial_comments
Definition: footprint.h:1125
EDA_ITEM * Clone() const override
Invoke a function on all children.
Definition: footprint.cpp:2199
BOX2I GetFpPadsLocalBbox() const
Return the bounding box containing pads when the footprint is on the front side, orientation 0,...
Definition: footprint.cpp:1299
std::deque< PCB_FIELD * > m_fields
Definition: footprint.h:1068
PCB_FIELD & Value()
read/write accessors:
Definition: footprint.h:657
const EMBEDDED_FILES * GetEmbeddedFiles() const
Definition: footprint.h:978
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
Definition: footprint.cpp:2371
std::optional< int > m_solderPasteMargin
Definition: footprint.h:1109
const std::vector< std::set< wxString > > & JumperPadGroups() const
Definition: footprint.h:828
void SetFileFormatVersionAtLoad(int aVersion)
Definition: footprint.h:758
std::mutex m_courtyard_cache_mutex
Definition: footprint.h:1140
void SetExcludedFromPosFiles(bool aExclude=true)
Definition: footprint.h:723
void SetOrientationDegrees(double aOrientation)
Definition: footprint.h:244
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:2733
void ApplyDefaultSettings(const BOARD &board, bool aStyleFields, bool aStyleText, bool aStyleShapes)
Apply default board settings to the footprint field text properties.
Definition: footprint.cpp:664
std::map< wxString, int > MapPadNumbersToNetTieGroups() const
Definition: footprint.cpp:3185
std::optional< int > GetLocalClearance() const
Definition: footprint.h:280
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:3647
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:568
void MoveAnchorPosition(const VECTOR2I &aMoveVector)
Move the reference point of the footprint.
Definition: footprint.cpp:2493
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:827
void SetDuplicatePadNumbersAreJumpers(bool aEnabled)
Definition: footprint.h:821
FOOTPRINT & operator=(const FOOTPRINT &aOther)
Definition: footprint.cpp:850
bool HasField(const wxString &aFieldName) const
Definition: footprint.cpp:612
PCB_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this footprint.
Definition: footprint.cpp:585
int m_arflag
Definition: footprint.h:1120
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:3876
double GetOrientationDegrees() const
Definition: footprint.h:248
BOARD_ITEM * Duplicate() const override
Create a copy of this BOARD_ITEM.
Definition: footprint.cpp:2572
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:2095
std::deque< PAD * > & Pads()
Definition: footprint.h:211
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:4079
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition: footprint.cpp:276
int GetAttributes() const
Definition: footprint.h:295
bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const override
Compare the item against the search criteria in aSearchData.
Definition: footprint.cpp:2076
std::optional< int > GetLocalClearance(wxString *aSource) const
Definition: footprint.h:313
const COMPONENT_CLASS * GetComponentClass() const
Returns the component class for this footprint.
Definition: footprint.cpp:4062
void SetLocalZoneConnection(ZONE_CONNECTION aType)
Definition: footprint.h:292
void ClearNetTiePadGroups()
Definition: footprint.h:346
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: footprint.h:241
LSET GetPrivateLayers() const
Definition: footprint.h:151
wxString GetFPIDAsString() const
Definition: footprint.h:259
wxString GetValueAsString() const
Definition: footprint.h:651
bool AllowMissingCourtyard() const
Definition: footprint.h:740
const ZONES & Zones() const
Definition: footprint.h:218
wxString GetComponentClassAsString() const
Used for display in the properties panel.
Definition: footprint.cpp:4068
bool IsFlipped() const
Definition: footprint.h:396
wxString GetSheetfile() const
Definition: footprint.h:274
SHAPE_POLY_SET GetBoundingHull() const
Return a bounding polygon for the shapes and pads in the footprint.
Definition: footprint.cpp:1534
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:3947
wxString GetTypeName() const
Get the type of footprint.
Definition: footprint.cpp:1287
bool NeedsPlaced() const
Definition: footprint.h:448
SHAPE_POLY_SET m_courtyard_cache_back
Definition: footprint.h:1137
int m_textExcludedBBoxCacheTimeStamp
Definition: footprint.h:1094
const std::vector< wxString > & GetNetTiePadGroups() const
Definition: footprint.h:344
const LIB_ID & GetFPID() const
Definition: footprint.h:253
const std::unordered_set< wxString > & GetTransientComponentClassNames()
Gets the transient component class names.
Definition: footprint.h:1022
void SetReference(const wxString &aReference)
Definition: footprint.h:627
bool IsLocked() const override
Definition: footprint.h:416
const GROUPS & Groups() const
Definition: footprint.h:221
bool IsExcludedFromPosFiles() const
Definition: footprint.h:722
void SetLayerAndFlip(PCB_LAYER_ID aLayer)
Used as Layer property setter – performs a flip if necessary to set the footprint layer.
Definition: footprint.cpp:2394
int m_hullCacheTimeStamp
Definition: footprint.h:1096
unsigned GetUniquePadCount(INCLUDE_NPTH_T aIncludeNPTH=INCLUDE_NPTH_T(INCLUDE_NPTH)) const
Return the number of unique non-blank pads.
Definition: footprint.cpp:2060
void AddNetTiePadGroup(const wxString &aGroup)
Definition: footprint.h:351
bool LegacyPadsLocked() const
Definition: footprint.h:457
virtual const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
Definition: footprint.cpp:2318
LSET m_privateLayers
Definition: footprint.h:1122
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:518
const std::deque< PCB_FIELD * > & GetFields() const
Return a reference to the deque holding the footprint's fields.
Definition: footprint.h:695
int GetLikelyAttribute() const
Returns the most likely attribute based on pads Either FP_THROUGH_HOLE/FP_SMD/OTHER(0)
Definition: footprint.cpp:1234
std::deque< PCB_GROUP * > m_groups
Definition: footprint.h:1072
void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition: footprint.cpp:2361
static bool ClassOf(const EDA_ITEM *aItem)
Definition: footprint.h:143
wxString m_libDescription
Definition: footprint.h:1113
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:1826
VECTOR2I m_pos
Definition: footprint.h:1075
void ClearTransientComponentClassNames()
Remove the transient component class names.
Definition: footprint.h:1028
ZONE_CONNECTION GetZoneConnectionOverrides(wxString *aSource) const
Definition: footprint.h:332
std::vector< wxString > m_netTiePadGroups
Definition: footprint.h:1100
void InvalidateGeometryCaches()
Resets the caches for this footprint, for example if it was modified via the API.
Definition: footprint.cpp:964
virtual std::vector< int > ViewGetLayers() const override
Return the all the layers within the VIEW the object is painted on.
Definition: footprint.cpp:2236
std::set< KIFONT::OUTLINE_FONT * > GetFonts() const override
Get a list of outline fonts referenced in the footprint.
Definition: footprint.cpp:4003
void Add3DModel(FP_3DMODEL *a3DModel)
Add a3DModel definition to the end of the 3D model list.
Definition: footprint.cpp:2066
void SetValue(const wxString &aValue)
Definition: footprint.h:648
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:1677
PCB_FIELD & Reference()
Definition: footprint.h:658
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:1130
const PCB_FIELD & Value() const
The const versions to keep the compiler happy.
Definition: footprint.h:661
wxString GetReferenceAsString() const
Definition: footprint.h:630
wxString m_sheetfile
Definition: footprint.h:1117
void GetContextualTextVars(wxArrayString *aVars) const
Return the list of system text vars for this footprint.
Definition: footprint.cpp:981
std::optional< int > m_solderMaskMargin
Definition: footprint.h:1108
SHAPE_POLY_SET m_courtyard_cache_front
Definition: footprint.h:1136
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition: footprint.cpp:1072
std::vector< const PAD * > GetPads(const wxString &aPadNumber, const PAD *aIgnore=nullptr) const
Definition: footprint.cpp:1994
void AutoPositionFields()
Position Reference and Value fields at the top and bottom of footprint's bounding box.
Definition: footprint.cpp:2745
void addMandatoryFields()
wxString m_keywords
Definition: footprint.h:1114
const PCB_FIELD & Reference() const
Definition: footprint.h:662
void SetTransientComponentClassNames(const std::unordered_set< wxString > &classNames)
Sets the transient component class names.
Definition: footprint.h:1016
void ClearAllNets()
Clear (i.e.
Definition: footprint.cpp:1063
std::deque< PAD * > m_pads
Definition: footprint.h:1070
bool HasThroughHolePads() const
Definition: footprint.cpp:3573
void BuildCourtyardCaches(OUTLINE_ERROR_HANDLER *aErrorHandler=nullptr)
Build complex polygons of the courtyard areas from graphic items on the courtyard layers.
Definition: footprint.cpp:3016
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
Definition: footprint.cpp:1795
EDA_ANGLE m_orient
Definition: footprint.h:1074
bool HitTestAccurate(const VECTOR2I &aPosition, int aAccuracy=0) const
Test if a point is inside the bounding polygon of the footprint.
Definition: footprint.cpp:1901
bool IsNetTie() const
Definition: footprint.h:302
wxString GetClass() const override
Return the class name.
Definition: footprint.h:868
void IncrementReference(int aDelta)
Bump the current reference by aDelta.
Definition: footprint.cpp:2773
int GetFileFormatVersionAtLoad() const
Definition: footprint.h:759
std::optional< double > GetLocalSolderPasteMarginRatio() const
Definition: footprint.h:289
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
Definition: footprint.cpp:2403
KIID m_link
Definition: footprint.h:1121
GROUPS & Groups()
Definition: footprint.h:220
wxString GetFilters() const
Definition: footprint.h:277
void SetSheetname(const wxString &aSheetname)
Definition: footprint.h:272
const wxArrayString * GetInitialComments() const
Return the initial comments block or NULL if none, without transfer of ownership.
Definition: footprint.h:945
KIID GetLink() const
Definition: footprint.h:846
void BuildNetTieCache()
Cache the pads that are allowed to connect to each other in the footprint.
Definition: footprint.cpp:3118
bool IsConflicting() const
Definition: footprint.cpp:975
std::vector< FP_3DMODEL > & Models()
Definition: footprint.h:225
const SHAPE_POLY_SET & GetCachedCourtyard(PCB_LAYER_ID aLayer) const
Return the cached courtyard area.
Definition: footprint.cpp:3007
std::deque< PCB_FIELD * > & GetFields()
Definition: footprint.h:696
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:2344
void SetLibDescription(const wxString &aDesc)
Definition: footprint.h:263
bool TextOnly() const
Definition: footprint.cpp:1324
const wxString & GetValue() const
Definition: footprint.h:643
const COMPONENT_CLASS * GetStaticComponentClass() const
Returns the component class for this footprint.
Definition: footprint.cpp:4050
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:3305
double GetArea(int aPadding=0) const
Definition: footprint.cpp:1224
void SetNeedsPlaced(bool needsPlaced)
Definition: footprint.h:449
wxString m_filters
Definition: footprint.h:1118
const wxString & GetReference() const
Definition: footprint.h:621
void CopyFrom(const BOARD_ITEM *aOther) override
Definition: footprint.cpp:954
void CheckNetTiePadGroups(const std::function< void(const wxString &)> &aErrorHandler)
Sanity check net-tie pad groups.
Definition: footprint.cpp:3488
void SetFPIDAsString(const wxString &aFPID)
Definition: footprint.h:260
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
Definition: footprint.cpp:2182
void SetBoardOnly(bool aIsBoardOnly=true)
Definition: footprint.h:714
const std::vector< FP_3DMODEL > & Models() const
Definition: footprint.h:226
void SetLocalSolderMaskMargin(std::optional< int > aMargin)
Definition: footprint.h:284
timestamp_t m_lastEditTime
Definition: footprint.h:1119
PAD * GetPad(const VECTOR2I &aPosition, const LSET &aLayerMask=LSET::AllLayersMask())
Get a pad at aPosition on aLayerMask in the footprint.
Definition: footprint.cpp:1978
const SHAPE_POLY_SET & GetCourtyard(PCB_LAYER_ID aLayer) const
Used in DRC to test the courtyard area (a complex polygon).
Definition: footprint.cpp:2993
int GetFlag() const
Definition: footprint.h:300
std::map< const BOARD_ITEM *, std::set< int > > m_netTieCache
Definition: footprint.h:1103
wxString m_sheetname
Definition: footprint.h:1116
int m_fileFormatVersionAtLoad
Definition: footprint.h:1079
void SetLocalClearance(std::optional< int > aClearance)
Definition: footprint.h:281
void SetPrivateLayers(const LSET &aLayers)
Adds an item to the container.
Definition: footprint.h:152
const KIID_PATH & GetPath() const
Definition: footprint.h:268
std::optional< int > GetLocalSolderMaskMargin() const
Definition: footprint.h:283
void SetLocalSolderPasteMargin(std::optional< int > aMargin)
Definition: footprint.h:287
wxString GetKeywords() const
Definition: footprint.h:265
bool operator==(const BOARD_ITEM &aOther) const override
Definition: footprint.cpp:3585
EMBEDDED_FILES * GetEmbeddedFiles() override
Definition: footprint.h:973
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:3262
virtual void swapData(BOARD_ITEM *aImage) override
Definition: footprint.cpp:3549
wxString GetNextPadNumber(const wxString &aLastPadName) const
Return the next available pad number in the footprint.
Definition: footprint.cpp:2713
bool IsPlaced() const
Definition: footprint.h:439
int m_boundingBoxCacheTimeStamp
Definition: footprint.h:1092
VECTOR2I GetPosition() const override
Definition: footprint.h:229
DRAWINGS & GraphicalItems()
Definition: footprint.h:214
HASH_128 m_courtyard_cache_front_hash
Definition: footprint.h:1138
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:1894
PAD * FindPadByNumber(const wxString &aPadNumber, PAD *aSearchAfterMe=nullptr) const
Return a PAD with a matching number.
Definition: footprint.cpp:1958
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: footprint.cpp:1339
bool operator==(const FP_3DMODEL &aOther) const
Definition: footprint.h:111
VECTOR3D m_Offset
3D model offset (mm)
Definition: footprint.h:106
double m_Opacity
Definition: footprint.h:107
VECTOR3D m_Rotation
3D model rotation (degrees)
Definition: footprint.h:105
FP_3DMODEL()
Definition: footprint.h:94
VECTOR3D m_Scale
3D model scaling factor (dimensionless)
Definition: footprint.h:104
wxString m_Filename
The 3D shape filename in 3D library.
Definition: footprint.h:108
bool m_Show
Include model in rendering.
Definition: footprint.h:109
Used when the right click button is pressed, or when the select tool is in effect.
Definition: collectors.h:202
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:67
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:627
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 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:49
INSPECT_RESULT
Definition: eda_item.h:43
const INSPECTOR_FUNC & INSPECTOR
std::function passed to nested users by ref, avoids copying std::function.
Definition: eda_item.h:89
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:88
@ FP_ALLOW_MISSING_COURTYARD
Definition: footprint.h:87
@ 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
@ FP_ALLOW_SOLDERMASK_BRIDGES
Definition: footprint.h:86
#define FP_is_PLACED
In autoplace: footprint automatically placed.
Definition: footprint.h:411
#define FP_is_LOCKED
footprint LOCKED: no autoplace allowed
Definition: footprint.h:410
#define FP_PADS_are_LOCKED
Definition: footprint.h:413
#define FP_to_PLACE
In autoplace: footprint waiting for autoplace.
Definition: footprint.h:412
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:32
std::vector< ZONE * > ZONES
Definition: pcb_io_eagle.h:47
bool operator()(const BOARD_ITEM *itemA, const BOARD_ITEM *itemB) const
Definition: footprint.cpp:3670
bool operator()(const PAD *aFirst, const PAD *aSecond) const
Definition: footprint.cpp:3747
bool operator()(const ZONE *aFirst, const ZONE *aSecond) const
Definition: footprint.cpp:3850
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