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;
58class PCB_POINT;
59
60namespace KIGFX {
61class VIEW;
62}
63
64namespace KIFONT {
65class OUTLINE_FONT;
66}
67
73
80{
82 FP_SMD = 0x0002,
85 FP_BOARD_ONLY = 0x0010, // Footprint has no corresponding symbol
86 FP_JUST_ADDED = 0x0020, // Footprint just added by netlist update
87 FP_DNP = 0x0040
88};
89
103
105{
106public:
108 // Initialize with sensible values
109 m_Scale { 1, 1, 1 },
110 m_Rotation { 0, 0, 0 },
111 m_Offset { 0, 0, 0 },
112 m_Opacity( 1.0 ),
113 m_Show( true )
114 {
115 }
116
120 double m_Opacity;
121 wxString m_Filename;
122 bool m_Show;
123
124 bool operator==( const FP_3DMODEL& aOther ) const
125 {
126 return m_Scale == aOther.m_Scale
127 && m_Rotation == aOther.m_Rotation
128 && m_Offset == aOther.m_Offset
129 && m_Opacity == aOther.m_Opacity
130 && m_Filename == aOther.m_Filename
131 && m_Show == aOther.m_Show;
132 }
133};
134
135
137{
138public:
139 FOOTPRINT( BOARD* parent );
140
141 FOOTPRINT( const FOOTPRINT& aFootprint );
142
143 // Move constructor and operator needed due to std containers inside the footprint
144 FOOTPRINT( FOOTPRINT&& aFootprint );
145
146 ~FOOTPRINT();
147
148 FOOTPRINT& operator=( const FOOTPRINT& aOther );
149 FOOTPRINT& operator=( FOOTPRINT&& aOther );
150
151 void CopyFrom( const BOARD_ITEM* aOther ) override;
152
153 void Serialize( google::protobuf::Any &aContainer ) const override;
154 bool Deserialize( const google::protobuf::Any &aContainer ) override;
155
156 static inline bool ClassOf( const EDA_ITEM* aItem )
157 {
158 return aItem && aItem->Type() == PCB_FOOTPRINT_T;
159 }
160
163
165 void SetPrivateLayers( const LSET& aLayers ) { m_privateLayers = aLayers; }
166
168 void Add( BOARD_ITEM* aItem, ADD_MODE aMode = ADD_MODE::INSERT,
169 bool aSkipConnectivity = false ) override;
170
172 void Remove( BOARD_ITEM* aItem, REMOVE_MODE aMode = REMOVE_MODE::NORMAL ) override;
173
181 void ClearAllNets();
182
190 bool FixUuids();
191
202
210
211 bool TextOnly() const;
212
213 // Virtual function
214 const BOX2I GetBoundingBox() const override;
215 const BOX2I GetBoundingBox( bool aIncludeText ) const;
216
220 const BOX2I GetLayerBoundingBox( const LSET& aLayers ) const;
221
222 VECTOR2I GetCenter() const override { return GetBoundingBox( false ).GetCenter(); }
223
224 std::deque<PAD*>& Pads() { return m_pads; }
225 const std::deque<PAD*>& Pads() const { return m_pads; }
226
227 DRAWINGS& GraphicalItems() { return m_drawings; }
228 const DRAWINGS& GraphicalItems() const { return m_drawings; }
229
230 ZONES& Zones() { return m_zones; }
231 const ZONES& Zones() const { return m_zones; }
232
233 GROUPS& Groups() { return m_groups; }
234 const GROUPS& Groups() const { return m_groups; }
235
236 PCB_POINTS& Points() { return m_points; }
237 const PCB_POINTS& Points() const { return m_points; }
238
239 bool HasThroughHolePads() const;
240
241 std::vector<FP_3DMODEL>& Models() { return m_3D_Drawings; }
242 const std::vector<FP_3DMODEL>& Models() const { return m_3D_Drawings; }
243
244 void SetPosition( const VECTOR2I& aPos ) override;
245 VECTOR2I GetPosition() const override { return m_pos; }
246
247 void SetOrientation( const EDA_ANGLE& aNewAngle );
249
254 void SetLayerAndFlip( PCB_LAYER_ID aLayer );
255
256 // to make property magic work
257 PCB_LAYER_ID GetLayer() const override { return BOARD_ITEM::GetLayer(); }
258
259 // For property system:
260 void SetOrientationDegrees( double aOrientation )
261 {
262 SetOrientation( EDA_ANGLE( aOrientation, DEGREES_T ) );
263 }
265 {
266 return m_orient.AsDegrees();
267 }
268
269 const LIB_ID& GetFPID() const { return m_fpid; }
270 void SetFPID( const LIB_ID& aFPID )
271 {
272 m_fpid = aFPID;
273 }
274
275 wxString GetFPIDAsString() const { return m_fpid.Format(); }
276 void SetFPIDAsString( const wxString& aFPID ) { m_fpid.Parse( aFPID ); }
277
278 wxString GetLibDescription() const { return m_libDescription; }
279 void SetLibDescription( const wxString& aDesc ) { m_libDescription = aDesc; }
280
281 wxString GetKeywords() const { return m_keywords; }
282 void SetKeywords( const wxString& aKeywords ) { m_keywords = aKeywords; }
283
284 const KIID_PATH& GetPath() const { return m_path; }
285 void SetPath( const KIID_PATH& aPath ) { m_path = aPath; }
286
287 wxString GetSheetname() const { return m_sheetname; }
288 void SetSheetname( const wxString& aSheetname ) { m_sheetname = aSheetname; }
289
290 wxString GetSheetfile() const { return m_sheetfile; }
291 void SetSheetfile( const wxString& aSheetfile ) { m_sheetfile = aSheetfile; }
292
293 wxString GetFilters() const { return m_filters; }
294 void SetFilters( const wxString& aFilters ) { m_filters = aFilters; }
295
296 std::optional<int> GetLocalClearance() const { return m_clearance; }
297 void SetLocalClearance( std::optional<int> aClearance ) { m_clearance = aClearance; }
298
299 std::optional<int> GetLocalSolderMaskMargin() const { return m_solderMaskMargin; }
300 void SetLocalSolderMaskMargin( std::optional<int> aMargin ) { m_solderMaskMargin = aMargin; }
301
302 std::optional<int> GetLocalSolderPasteMargin() const { return m_solderPasteMargin; }
303 void SetLocalSolderPasteMargin( std::optional<int> aMargin ) { m_solderPasteMargin = aMargin; }
304
305 std::optional<double> GetLocalSolderPasteMarginRatio() const { return m_solderPasteMarginRatio; }
306 void SetLocalSolderPasteMarginRatio( std::optional<double> aRatio ) { m_solderPasteMarginRatio = aRatio; }
307
310
317 void SetStackupMode( FOOTPRINT_STACKUP aMode );
319
324 void SetStackupLayers( LSET aLayers );
325 const LSET& GetStackupLayers() const { return m_stackupLayers; }
326
327 int GetAttributes() const { return m_attributes; }
328 void SetAttributes( int aAttributes ) { m_attributes = aAttributes; }
329
331 void SetAllowMissingCourtyard( bool aAllow ) { m_allowMissingCourtyard = aAllow; }
332
334 void SetAllowSolderMaskBridges( bool aAllow ) { m_allowSolderMaskBridges = aAllow; }
335
336 void SetFlag( int aFlag ) { m_arflag = aFlag; }
337 void IncrementFlag() { m_arflag += 1; }
338 int GetFlag() const { return m_arflag; }
339
340 bool IsNetTie() const
341 {
342 for( const wxString& group : m_netTiePadGroups )
343 {
344 if( !group.IsEmpty() )
345 return true;
346 }
347
348 return false;
349 }
350
351 std::optional<int> GetLocalClearance( wxString* aSource ) const
352 {
353 if( m_clearance.has_value() && aSource )
354 *aSource = wxString::Format( _( "footprint %s" ), GetReference() );
355
356 return m_clearance;
357 }
358
365 std::optional<int> GetClearanceOverrides( wxString* aSource ) const
366 {
367 return GetLocalClearance( aSource );
368 }
369
371 {
373 *aSource = wxString::Format( _( "footprint %s" ), GetReference() );
374
375 return m_zoneConnection;
376 }
377
382 const std::vector<wxString>& GetNetTiePadGroups() const { return m_netTiePadGroups; }
383
385 {
386 m_netTiePadGroups.clear();
387 }
388
389 void AddNetTiePadGroup( const wxString& aGroup )
390 {
391 m_netTiePadGroups.emplace_back( aGroup );
392 }
393
398 std::map<wxString, int> MapPadNumbersToNetTieGroups() const;
399
403 std::vector<PAD*> GetNetTiePads( PAD* aPad ) const;
404
410 int GetLikelyAttribute() const;
411
412 void Move( const VECTOR2I& aMoveVector ) override;
413
414 void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override;
415
416 void Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
417
429 void MoveAnchorPosition( const VECTOR2I& aMoveVector );
430
434 bool IsFlipped() const { return GetLayer() == B_Cu; }
435
440 PCB_LAYER_ID GetSide() const;
441
445 bool IsOnLayer( PCB_LAYER_ID aLayer ) const override;
446
447// m_footprintStatus bits:
448#define FP_is_LOCKED 0x01
449#define FP_is_PLACED 0x02
450#define FP_to_PLACE 0x04
451#define FP_PADS_are_LOCKED 0x08
452
453
454 bool IsLocked() const override
455 {
456 return ( m_fpStatus & FP_is_LOCKED ) != 0;
457 }
458
464 void SetLocked( bool isLocked ) override
465 {
466 if( isLocked )
468 else
470 }
471
475 bool IsConflicting() const;
476
477 bool IsPlaced() const { return m_fpStatus & FP_is_PLACED; }
478 void SetIsPlaced( bool isPlaced )
479 {
480 if( isPlaced )
482 else
484 }
485
486 bool NeedsPlaced() const { return m_fpStatus & FP_to_PLACE; }
487 void SetNeedsPlaced( bool needsPlaced )
488 {
489 if( needsPlaced )
491 else
493 }
494
496
507 void CheckFootprintAttributes( const std::function<void( const wxString& )>& aErrorHandler );
508
515 void CheckPads( UNITS_PROVIDER* aUnitsProvider,
516 const std::function<void( const PAD*, int, const wxString& )>& aErrorHandler );
517
523 void CheckShortingPads( const std::function<void( const PAD*, const PAD*, int aErrorCode,
524 const VECTOR2I& )>& aErrorHandler );
525
532 void CheckNetTies( const std::function<void( const BOARD_ITEM* aItem,
533 const BOARD_ITEM* bItem,
534 const BOARD_ITEM* cItem,
535 const VECTOR2I& )>& aErrorHandler );
536
543 void CheckNetTiePadGroups( const std::function<void( const wxString& )>& aErrorHandler );
544
545 void CheckClippedSilk( const std::function<void( BOARD_ITEM* aItemA,
546 BOARD_ITEM* aItemB,
547 const VECTOR2I& aPt )>& aErrorHandler );
551 void BuildNetTieCache();
552
556 const std::set<int>& GetNetTieCache( const BOARD_ITEM* aItem ) const
557 {
558 static const std::set<int> emptySet;
559
560 auto it = m_netTieCache.find( aItem );
561
562 if( it == m_netTieCache.end() )
563 return emptySet;
564
565 return it->second;
566 }
567
580 void TransformPadsToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
581 int aMaxError, ERROR_LOC aErrorLoc ) const;
582
597 void TransformFPShapesToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
598 int aError, ERROR_LOC aErrorLoc,
599 bool aIncludeText = true,
600 bool aIncludeShapes = true,
601 bool aIncludePrivateItems = false ) const;
602
606 void TransformFPTextToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
607 int aError, ERROR_LOC aErrorLoc ) const
608 {
609 TransformFPShapesToPolySet( aBuffer, aLayer, aClearance, aError, aErrorLoc, true, false );
610 }
611
615 void GetContextualTextVars( wxArrayString* aVars ) const;
616
622 bool ResolveTextVar( wxString* token, int aDepth = 0 ) const;
623
625 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
626
627 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
628
629 bool Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const override;
630
640 bool HitTestAccurate( const VECTOR2I& aPosition, int aAccuracy = 0 ) const;
641
642 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
643
644 bool HitTest( const SHAPE_LINE_CHAIN& aPoly, bool aContained ) const override;
645
654 bool HitTestOnLayer( const VECTOR2I& aPosition, PCB_LAYER_ID aLayer, int aAccuracy = 0 ) const;
655
656 bool HitTestOnLayer( const BOX2I& aRect, bool aContained, PCB_LAYER_ID aLayer, int aAccuracy = 0 ) const;
657
661 const wxString& GetReference() const { return Reference().GetText(); }
662
667 void SetReference( const wxString& aReference ) { Reference().SetText( aReference ); }
668
669 // Property system doesn't like const references
670 wxString GetReferenceAsString() const
671 {
672 return GetReference();
673 }
674
678 void IncrementReference( int aDelta );
679
683 const wxString& GetValue() const { return Value().GetText(); }
684
688 void SetValue( const wxString& aValue ) { Value().SetText( aValue ); }
689
690 // Property system doesn't like const references
691 wxString GetValueAsString() const
692 {
693 return GetValue();
694 }
695
699
701 const PCB_FIELD& Value() const { return *GetField( FIELD_T::VALUE ); }
702 const PCB_FIELD& Reference() const { return *GetField( FIELD_T::REFERENCE ); }
703
704 //-----<Fields>-----------------------------------------------------------
705
710 PCB_FIELD* GetField( FIELD_T aFieldType );
711 const PCB_FIELD* GetField( FIELD_T aFieldNdx ) const;
712
720 PCB_FIELD* GetField( const wxString& aFieldName ) const;
721
722 bool HasField( const wxString& aFieldName ) const;
723
730 void GetFields( std::vector<PCB_FIELD*>& aVector, bool aVisibleOnly ) const;
731
735 const std::deque<PCB_FIELD*>& GetFields() const { return m_fields; }
736 std::deque<PCB_FIELD*>& GetFields() { return m_fields; }
737
741 int GetNextFieldOrdinal() const;
742
750 void ApplyDefaultSettings( const BOARD& board, bool aStyleFields, bool aStyleText,
751 bool aStyleShapes );
752
754 {
755 wxString m_unitName; // e.g. A
756 std::vector<wxString> m_pins; // pin numbers in this unit
757 };
758
759 void SetUnitInfo( const std::vector<FP_UNIT_INFO>& aUnits ) { m_unitInfo = aUnits; }
760 const std::vector<FP_UNIT_INFO>& GetUnitInfo() const { return m_unitInfo; }
761
762 bool IsBoardOnly() const { return m_attributes & FP_BOARD_ONLY; }
763 void SetBoardOnly( bool aIsBoardOnly = true )
764 {
765 if( aIsBoardOnly )
767 else
769 }
770
772 void SetExcludedFromPosFiles( bool aExclude = true )
773 {
774 if( aExclude )
776 else
778 }
779
781 void SetExcludedFromBOM( bool aExclude = true )
782 {
783 if( aExclude )
785 else
787 }
788
789 bool IsDNP() const { return m_attributes & FP_DNP; }
790 void SetDNP( bool aDNP = true )
791 {
792 if( aDNP )
794 else
796 }
797
798 void SetFileFormatVersionAtLoad( int aVersion ) { m_fileFormatVersionAtLoad = aVersion; }
800
810 PAD* FindPadByNumber( const wxString& aPadNumber, PAD* aSearchAfterMe = nullptr ) const;
811
819 PAD* GetPad( const VECTOR2I& aPosition, const LSET& aLayerMask = LSET::AllLayersMask() );
820
821 std::vector<const PAD*> GetPads( const wxString& aPadNumber,
822 const PAD* aIgnore = nullptr ) const;
823
831 unsigned GetPadCount( INCLUDE_NPTH_T aIncludeNPTH = INCLUDE_NPTH_T(INCLUDE_NPTH) ) const;
832
843 unsigned GetUniquePadCount( INCLUDE_NPTH_T aIncludeNPTH = INCLUDE_NPTH_T(INCLUDE_NPTH) ) const;
844
848 std::set<wxString>
850
858 wxString GetNextPadNumber( const wxString& aLastPadName ) const;
859
862
867 std::vector<std::set<wxString>>& JumperPadGroups() { return m_jumperPadGroups; }
868 const std::vector<std::set<wxString>>& JumperPadGroups() const { return m_jumperPadGroups; }
869
871 std::optional<const std::set<wxString>> GetJumperPadGroup( const wxString& aPadNumber ) const;
872
876 void AutoPositionFields();
877
882 wxString GetTypeName() const;
883
884 double GetArea( int aPadding = 0 ) const;
885
886 KIID GetLink() const { return m_link; }
887 void SetLink( const KIID& aLink ) { m_link = aLink; }
888
889 BOARD_ITEM* Duplicate( bool addToParentGroup, BOARD_COMMIT* aCommit = nullptr ) const override;
890
896 BOARD_ITEM* DuplicateItem( bool addToParentGroup, BOARD_COMMIT* aCommit, const BOARD_ITEM* aItem,
897 bool addToFootprint = false );
898
904 void Add3DModel( FP_3DMODEL* a3DModel );
905
906 INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
907 const std::vector<KICAD_T>& aScanTypes ) override;
908
909 wxString GetClass() const override
910 {
911 return wxT( "FOOTPRINT" );
912 }
913
914 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
915
916 BITMAPS GetMenuImage() const override;
917
918 EDA_ITEM* Clone() const override;
919
921 void RunOnChildren( const std::function<void( BOARD_ITEM* )>& aFunction, RECURSE_MODE aMode ) const override;
922
923 virtual std::vector<int> ViewGetLayers() const override;
924
925 double ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const override;
926
927 virtual const BOX2I ViewBBox() const override;
928
936 static bool IsLibNameValid( const wxString& aName );
937
947 static const wxChar* StringLibNameInvalidChars( bool aUserReadable );
948
952 bool FootprintNeedsUpdate( const FOOTPRINT* aLibFP, int aCompareFlags = 0,
953 REPORTER* aReporter = nullptr );
954
969 void SetInitialComments( wxArrayString* aInitialComments )
970 {
971 delete m_initial_comments;
972 m_initial_comments = aInitialComments;
973 }
974
981 double CoverageRatio( const GENERAL_COLLECTOR& aCollector ) const;
982
983 static double GetCoverageArea( const BOARD_ITEM* aItem, const GENERAL_COLLECTOR& aCollector );
984
986 const wxArrayString* GetInitialComments() const { return m_initial_comments; }
987
993 const SHAPE_POLY_SET& GetCourtyard( PCB_LAYER_ID aLayer ) const;
994
1000 const SHAPE_POLY_SET& GetCachedCourtyard( PCB_LAYER_ID aLayer ) const;
1001
1008 void BuildCourtyardCaches( OUTLINE_ERROR_HANDLER* aErrorHandler = nullptr );
1009
1010 // @copydoc BOARD_ITEM::GetEffectiveShape
1011 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
1012 FLASHING aFlash = FLASHING::DEFAULT ) const override;
1013
1015 {
1016 return static_cast<EMBEDDED_FILES*>( this );
1017 }
1018
1020 {
1021 return static_cast<const EMBEDDED_FILES*>( this );
1022 }
1023
1027 std::set<KIFONT::OUTLINE_FONT*> GetFonts() const override;
1028
1029 void EmbedFonts() override;
1030
1031 double Similarity( const BOARD_ITEM& aOther ) const override;
1032
1034 void SetStaticComponentClass( const COMPONENT_CLASS* aClass ) const;
1035
1038
1040 const COMPONENT_CLASS* GetComponentClass() const;
1041
1043 wxString GetComponentClassAsString() const;
1044
1046 void RecomputeComponentClass() const;
1047
1049 void InvalidateComponentClassCache() const;
1050
1057 void SetTransientComponentClassNames( const std::unordered_set<wxString>& classNames )
1058 {
1059 m_transientComponentClassNames = classNames;
1060 }
1061
1063 const std::unordered_set<wxString>& GetTransientComponentClassNames()
1064 {
1066 }
1067
1070
1072 void ResolveComponentClassNames( BOARD* aBoard,
1073 const std::unordered_set<wxString>& aComponentClassNames );
1074
1075 bool operator==( const BOARD_ITEM& aOther ) const override;
1076 bool operator==( const FOOTPRINT& aOther ) const;
1077
1078#if defined(DEBUG)
1079 virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
1080#endif
1081
1083 {
1084 bool operator()( const BOARD_ITEM* itemA, const BOARD_ITEM* itemB ) const;
1085 };
1086
1088 {
1089 bool operator()( const PAD* aFirst, const PAD* aSecond ) const;
1090 };
1091 // TODO(JE) padstacks -- this code isn't used anywhere though
1092#if 0
1093 struct cmp_padstack
1094 {
1095 bool operator()( const PAD* aFirst, const PAD* aSecond ) const;
1096 };
1097#endif
1099 {
1100 bool operator()( const ZONE* aFirst, const ZONE* aSecond ) const;
1101 };
1102
1103protected:
1104 virtual void swapData( BOARD_ITEM* aImage ) override;
1105
1107
1108private:
1109 std::deque<PCB_FIELD*> m_fields; // Fields, mapped by name, owned by pointer
1110 std::deque<BOARD_ITEM*> m_drawings; // Drawings in the footprint, owned by pointer
1111 std::deque<PAD*> m_pads; // Pads, owned by pointer
1112 std::vector<ZONE*> m_zones; // Rule area zones, owned by pointer
1113 std::deque<PCB_GROUP*> m_groups; // Groups, owned by pointer
1114 std::deque<PCB_POINT*> m_points; // Points, owned by pointer
1115
1116 EDA_ANGLE m_orient; // Orientation
1117 VECTOR2I m_pos; // Position of footprint on the board in internal units.
1118 LIB_ID m_fpid; // The #LIB_ID of the FOOTPRINT.
1119 int m_attributes; // Flag bits (see FOOTPRINT_ATTR_T)
1120 int m_fpStatus; // For autoplace: flags (LOCKED, FIELDS_AUTOPLACED)
1122
1123 // Bounding box caching strategy:
1124 // While we attempt to notice the low-hanging fruit operations and update the bounding boxes
1125 // accordingly, we rely mostly on a "if anything changed then the caches are stale" approach.
1126 // We implement this by having PCB_BASE_FRAME's OnModify() method increment an operation
1127 // counter, and storing that as a timestamp for the various caches.
1128 // This means caches will get regenerated often -- but still far less often than if we had no
1129 // caches at all. The principal opitmization would be to change to dirty flag and make sure
1130 // that any edit that could affect the bounding boxes (including edits to the footprint
1131 // children) marked the bounding boxes dirty. It would definitely be faster -- but also more
1132 // fragile.
1139
1140 // A list of pad groups, each of which is allowed to short nets within their group.
1141 // A pad group is a comma-separated list of pad numbers.
1142 std::vector<wxString> m_netTiePadGroups;
1143
1144 // A list of 1:N footprint item to allowed net numbers
1145 std::map<const BOARD_ITEM*, std::set<int>> m_netTieCache;
1146
1149 std::vector<std::set<wxString>> m_jumperPadGroups;
1150
1154
1157
1158 // Optional overrides
1160 std::optional<int> m_clearance;
1161 std::optional<int> m_solderMaskMargin; // Solder mask margin
1162 std::optional<int> m_solderPasteMargin; // Solder paste margin absolute value
1163 std::optional<double> m_solderPasteMarginRatio; // Solder mask margin ratio of pad size
1164 // The final margin is the sum of these 2 values
1165
1166 LSET m_stackupLayers; // Layers in the stackup
1167 FOOTPRINT_STACKUP m_stackupMode; // Stackup mode for this footprint
1168 LSET m_privateLayers; // Layers visible only in the footprint editor
1169
1170 wxString m_libDescription; // File name and path for documentation file.
1171 wxString m_keywords; // Search keywords to find footprint in library.
1172 KIID_PATH m_path; // Path to associated symbol ([sheetUUID, .., symbolUUID]).
1173 wxString m_sheetname; // Name of the sheet containing the symbol for this footprint
1174 wxString m_sheetfile; // File of the sheet containing the symbol for this footprint
1175 wxString m_filters; // Footprint filters from symbol
1177 int m_arflag; // Use to trace ratsnest and auto routing.
1178 KIID m_link; // Temporary logical link used during editing
1179
1180 std::vector<FP_3DMODEL> m_3D_Drawings; // 3D models.
1181 wxArrayString* m_initial_comments; // s-expression comments in the footprint,
1182 // lazily allocated only if needed for speed
1183
1184 SHAPE_POLY_SET m_courtyard_cache_front; // Note that a footprint can have both front and back
1185 SHAPE_POLY_SET m_courtyard_cache_back; // courtyards populated.
1188 mutable std::mutex m_courtyard_cache_mutex;
1189
1190 std::unordered_set<wxString> m_transientComponentClassNames;
1191 std::unique_ptr<COMPONENT_CLASS_CACHE_PROXY> m_componentClassCacheProxy;
1192
1193 // Optional unit mapping information for multi-unit symbols
1194 std::vector<FP_UNIT_INFO> m_unitInfo;
1195};
1196
1197#endif // FOOTPRINT_H
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
BITMAPS
A list of all bitmap identifiers.
BOX2< VECTOR2I > BOX2I
Definition box2.h:922
BOARD_ITEM_CONTAINER(BOARD_ITEM *aParent, KICAD_T aType)
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition board_item.h:79
BOARD_ITEM(BOARD_ITEM *aParent, KICAD_T idtype, PCB_LAYER_ID aLayer=F_Cu)
Definition board_item.h:81
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.
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
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
Definition eda_item.cpp:39
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition eda_text.h:98
virtual void SetText(const wxString &aText)
Definition eda_text.cpp:281
EMBEDDED_FILES()=default
bool FixUuids()
Old footprints do not always have a valid UUID (some can be set to null uuid) However null UUIDs,...
bool GetDuplicatePadNumbersAreJumpers() const
Definition footprint.h:860
std::optional< int > GetClearanceOverrides(wxString *aSource) const
Return any local clearance overrides set in the "classic" (ie: pre-rule) system.
Definition footprint.h:365
void EmbedFonts() override
bool AllowSolderMaskBridges() const
Definition footprint.h:333
void SetPosition(const VECTOR2I &aPos) override
void SetFPID(const LIB_ID &aFPID)
Definition footprint.h:270
LIB_ID m_fpid
Definition footprint.h:1118
wxString GetLibDescription() const
Definition footprint.h:278
ZONE_CONNECTION GetLocalZoneConnection() const
Definition footprint.h:309
void SetLink(const KIID &aLink)
Definition footprint.h:887
KIID_PATH m_path
Definition footprint.h:1172
std::deque< BOARD_ITEM * > m_drawings
Definition footprint.h:1110
void SetStackupLayers(LSET aLayers)
If the footprint has a non-default stackup, set the layers that should be used for the stackup.
bool IsBoardOnly() const
Definition footprint.h:762
BOX2I m_cachedTextExcludedBBox
Definition footprint.h:1135
void InvalidateComponentClassCache() const
Forces deferred (on next access) recalculation of the component class for this footprint.
const std::deque< PAD * > & Pads() const
Definition footprint.h:225
bool IsDNP() const
Definition footprint.h:789
void SetLocked(bool isLocked) override
Set the #MODULE_is_LOCKED bit in the m_ModuleStatus.
Definition footprint.h:464
VECTOR2I GetCenter() const override
This defaults to the center of the bounding box if not overridden.
Definition footprint.h:222
HASH_128 m_courtyard_cache_back_hash
Definition footprint.h:1187
std::vector< PAD * > GetNetTiePads(PAD *aPad) const
bool ResolveTextVar(wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the component.
EDA_ANGLE GetOrientation() const
Definition footprint.h:248
ZONES & Zones()
Definition footprint.h:230
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
std::deque< PCB_POINT * > m_points
Definition footprint.h:1114
void CheckClippedSilk(const std::function< void(BOARD_ITEM *aItemA, BOARD_ITEM *aItemB, const VECTOR2I &aPt)> &aErrorHandler)
void Remove(BOARD_ITEM *aItem, REMOVE_MODE aMode=REMOVE_MODE::NORMAL) override
Removes an item from the container.
void SetIsPlaced(bool isPlaced)
Definition footprint.h:478
ZONE_CONNECTION m_zoneConnection
Definition footprint.h:1159
BOX2I m_cachedBoundingBox
Definition footprint.h:1133
int GetNextFieldOrdinal() const
Return the next ordinal for a user field for this footprint.
PCB_POINTS & Points()
Definition footprint.h:236
static double GetCoverageArea(const BOARD_ITEM *aItem, const GENERAL_COLLECTOR &aCollector)
bool IsExcludedFromBOM() const
Definition footprint.h:780
void SetOrientation(const EDA_ANGLE &aNewAngle)
void SetFlag(int aFlag)
Definition footprint.h:336
std::optional< double > m_solderPasteMarginRatio
Definition footprint.h:1163
void SetDNP(bool aDNP=true)
Definition footprint.h:790
void SetAllowSolderMaskBridges(bool aAllow)
Definition footprint.h:334
void RecomputeComponentClass() const
Forces immediate recalculation of the component class for this footprint.
std::vector< ZONE * > m_zones
Definition footprint.h:1112
static bool IsLibNameValid(const wxString &aName)
Test for validity of a name of a footprint to be used in a footprint library ( no spaces,...
void SetStackupMode(FOOTPRINT_STACKUP aMode)
Set the stackup mode for this footprint.
unsigned GetPadCount(INCLUDE_NPTH_T aIncludeNPTH=INCLUDE_NPTH_T(INCLUDE_NPTH)) const
Return the number of pads.
void SetLocalSolderPasteMarginRatio(std::optional< double > aRatio)
Definition footprint.h:306
void IncrementFlag()
Definition footprint.h:337
double ViewGetLOD(int aLayer, const KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
std::optional< int > m_clearance
Definition footprint.h:1160
bool m_duplicatePadNumbersAreJumpers
Flag that this footprint should automatically treat sets of two or more pads with the same number as ...
Definition footprint.h:1153
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.
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.
void SetExcludedFromBOM(bool aExclude=true)
Definition footprint.h:781
wxString GetSheetname() const
Definition footprint.h:287
int m_fpStatus
Definition footprint.h:1120
void SetPath(const KIID_PATH &aPath)
Definition footprint.h:285
SHAPE_POLY_SET m_cachedHull
Definition footprint.h:1137
std::set< wxString > GetUniquePadNumbers(INCLUDE_NPTH_T aIncludeNPTH=INCLUDE_NPTH_T(INCLUDE_NPTH)) const
Return the names of the unique, non-blank pads.
void SetFilters(const wxString &aFilters)
Definition footprint.h:294
void SetKeywords(const wxString &aKeywords)
Definition footprint.h:282
void SetStaticComponentClass(const COMPONENT_CLASS *aClass) const
Sets the component class object pointer for this footprint.
const DRAWINGS & GraphicalItems() const
Definition footprint.h:228
void SetInitialComments(wxArrayString *aInitialComments)
Take ownership of caller's heap allocated aInitialComments block.
Definition footprint.h:969
int m_attributes
Definition footprint.h:1119
PCB_LAYER_ID GetSide() const
Use instead of IsFlipped() when you also need to account for unsided footprints (those purely on user...
const BOX2I GetLayerBoundingBox(const LSET &aLayers) const
Return the bounding box of the footprint on a given set of layers.
std::vector< FP_3DMODEL > m_3D_Drawings
Definition footprint.h:1180
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...
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction, RECURSE_MODE aMode) const override
Invoke a function on all children.
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:1155
const std::vector< FP_UNIT_INFO > & GetUnitInfo() const
Definition footprint.h:760
std::unordered_set< wxString > m_transientComponentClassNames
Definition footprint.h:1190
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.
void SetAttributes(int aAttributes)
Definition footprint.h:328
void SetSheetfile(const wxString &aSheetfile)
Definition footprint.h:291
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
std::optional< int > GetLocalSolderPasteMargin() const
Definition footprint.h:302
std::unique_ptr< COMPONENT_CLASS_CACHE_PROXY > m_componentClassCacheProxy
Definition footprint.h:1191
wxArrayString * m_initial_comments
Definition footprint.h:1181
EDA_ITEM * Clone() const override
Invoke a function on all children.
BOX2I GetFpPadsLocalBbox() const
Return the bounding box containing pads when the footprint is on the front side, orientation 0,...
std::deque< PCB_FIELD * > m_fields
Definition footprint.h:1109
PCB_FIELD & Value()
read/write accessors:
Definition footprint.h:697
const EMBEDDED_FILES * GetEmbeddedFiles() const
Definition footprint.h:1019
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
std::optional< int > m_solderPasteMargin
Definition footprint.h:1162
const std::vector< std::set< wxString > > & JumperPadGroups() const
Definition footprint.h:868
void SetFileFormatVersionAtLoad(int aVersion)
Definition footprint.h:798
std::mutex m_courtyard_cache_mutex
Definition footprint.h:1188
void SetExcludedFromPosFiles(bool aExclude=true)
Definition footprint.h:772
void SetOrientationDegrees(double aOrientation)
Definition footprint.h:260
std::optional< const std::set< wxString > > GetJumperPadGroup(const wxString &aPadNumber) const
Retrieves the jumper group containing the specified pad number, if one exists.
void ApplyDefaultSettings(const BOARD &board, bool aStyleFields, bool aStyleText, bool aStyleShapes)
Apply default board settings to the footprint field text properties.
std::map< wxString, int > MapPadNumbersToNetTieGroups() const
std::optional< int > GetLocalClearance() const
Definition footprint.h:296
double Similarity(const BOARD_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
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:606
void MoveAnchorPosition(const VECTOR2I &aMoveVector)
Move the reference point of the footprint.
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:867
void SetDuplicatePadNumbersAreJumpers(bool aEnabled)
Definition footprint.h:861
bool m_allowSolderMaskBridges
Definition footprint.h:1156
FOOTPRINT & operator=(const FOOTPRINT &aOther)
bool HasField(const wxString &aFieldName) const
PCB_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this footprint.
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.
double GetOrientationDegrees() const
Definition footprint.h:264
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...
std::deque< PAD * > & Pads()
Definition footprint.h:224
void ResolveComponentClassNames(BOARD *aBoard, const std::unordered_set< wxString > &aComponentClassNames)
Resolves a set of component class names to this footprint's actual component class.
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
int GetAttributes() const
Definition footprint.h:327
bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const override
Compare the item against the search criteria in aSearchData.
std::optional< int > GetLocalClearance(wxString *aSource) const
Definition footprint.h:351
const COMPONENT_CLASS * GetComponentClass() const
Returns the component class for this footprint.
void SetLocalZoneConnection(ZONE_CONNECTION aType)
Definition footprint.h:308
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.
FOOTPRINT(BOARD *parent)
Definition footprint.cpp:75
void ClearNetTiePadGroups()
Definition footprint.h:384
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition footprint.h:257
LSET GetPrivateLayers() const
Definition footprint.h:164
wxString GetFPIDAsString() const
Definition footprint.h:275
wxString GetValueAsString() const
Definition footprint.h:691
bool AllowMissingCourtyard() const
Definition footprint.h:330
const ZONES & Zones() const
Definition footprint.h:231
wxString GetComponentClassAsString() const
Used for display in the properties panel.
bool IsFlipped() const
Definition footprint.h:434
wxString GetSheetfile() const
Definition footprint.h:290
SHAPE_POLY_SET GetBoundingHull() const
Return a bounding polygon for the shapes and pads in the footprint.
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...
wxString GetTypeName() const
Get the type of footprint.
bool NeedsPlaced() const
Definition footprint.h:486
SHAPE_POLY_SET m_courtyard_cache_back
Definition footprint.h:1185
int m_textExcludedBBoxCacheTimeStamp
Definition footprint.h:1136
const std::vector< wxString > & GetNetTiePadGroups() const
Definition footprint.h:382
const LIB_ID & GetFPID() const
Definition footprint.h:269
const std::unordered_set< wxString > & GetTransientComponentClassNames()
Gets the transient component class names.
Definition footprint.h:1063
void SetReference(const wxString &aReference)
Definition footprint.h:667
bool IsLocked() const override
Definition footprint.h:454
std::vector< FP_UNIT_INFO > m_unitInfo
Definition footprint.h:1194
const GROUPS & Groups() const
Definition footprint.h:234
bool IsExcludedFromPosFiles() const
Definition footprint.h:771
void SetLayerAndFlip(PCB_LAYER_ID aLayer)
Used as Layer property setter – performs a flip if necessary to set the footprint layer.
int m_hullCacheTimeStamp
Definition footprint.h:1138
unsigned GetUniquePadCount(INCLUDE_NPTH_T aIncludeNPTH=INCLUDE_NPTH_T(INCLUDE_NPTH)) const
Return the number of unique non-blank pads.
void AddNetTiePadGroup(const wxString &aGroup)
Definition footprint.h:389
bool LegacyPadsLocked() const
Definition footprint.h:495
virtual const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
LSET m_privateLayers
Definition footprint.h:1168
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:556
const LSET & GetStackupLayers() const
Definition footprint.h:325
const std::deque< PCB_FIELD * > & GetFields() const
Return a reference to the deque holding the footprint's fields.
Definition footprint.h:735
int GetLikelyAttribute() const
Returns the most likely attribute based on pads Either FP_THROUGH_HOLE/FP_SMD/OTHER(0)
std::deque< PCB_GROUP * > m_groups
Definition footprint.h:1113
void Move(const VECTOR2I &aMoveVector) override
Move this object.
static bool ClassOf(const EDA_ITEM *aItem)
Definition footprint.h:156
wxString m_libDescription
Definition footprint.h:1170
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.
VECTOR2I m_pos
Definition footprint.h:1117
void ClearTransientComponentClassNames()
Remove the transient component class names.
Definition footprint.h:1069
ZONE_CONNECTION GetZoneConnectionOverrides(wxString *aSource) const
Definition footprint.h:370
std::vector< wxString > m_netTiePadGroups
Definition footprint.h:1142
void InvalidateGeometryCaches()
Resets the caches for this footprint, for example if it was modified via the API.
virtual std::vector< int > ViewGetLayers() const override
Return the all the layers within the VIEW the object is painted on.
std::set< KIFONT::OUTLINE_FONT * > GetFonts() const override
Get a list of outline fonts referenced in the footprint.
void Add3DModel(FP_3DMODEL *a3DModel)
Add a3DModel definition to the end of the 3D model list.
void SetValue(const wxString &aValue)
Definition footprint.h:688
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.
FOOTPRINT_STACKUP m_stackupMode
Definition footprint.h:1167
PCB_FIELD & Reference()
Definition footprint.h:698
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:1149
const PCB_FIELD & Value() const
The const versions to keep the compiler happy.
Definition footprint.h:701
wxString GetReferenceAsString() const
Definition footprint.h:670
wxString m_sheetfile
Definition footprint.h:1174
void GetContextualTextVars(wxArrayString *aVars) const
Return the list of system text vars for this footprint.
std::optional< int > m_solderMaskMargin
Definition footprint.h:1161
SHAPE_POLY_SET m_courtyard_cache_front
Definition footprint.h:1184
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
void SetUnitInfo(const std::vector< FP_UNIT_INFO > &aUnits)
Definition footprint.h:759
std::vector< const PAD * > GetPads(const wxString &aPadNumber, const PAD *aIgnore=nullptr) const
void AutoPositionFields()
Position Reference and Value fields at the top and bottom of footprint's bounding box.
void addMandatoryFields()
wxString m_keywords
Definition footprint.h:1171
const PCB_FIELD & Reference() const
Definition footprint.h:702
void SetTransientComponentClassNames(const std::unordered_set< wxString > &classNames)
Sets the transient component class names.
Definition footprint.h:1057
void ClearAllNets()
Clear (i.e.
std::deque< PAD * > m_pads
Definition footprint.h:1111
bool HasThroughHolePads() const
const PCB_POINTS & Points() const
Definition footprint.h:237
void BuildCourtyardCaches(OUTLINE_ERROR_HANDLER *aErrorHandler=nullptr)
Build complex polygons of the courtyard areas from graphic items on the courtyard layers.
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
EDA_ANGLE m_orient
Definition footprint.h:1116
bool HitTestAccurate(const VECTOR2I &aPosition, int aAccuracy=0) const
Test if a point is inside the bounding polygon of the footprint.
bool IsNetTie() const
Definition footprint.h:340
wxString GetClass() const override
Return the class name.
Definition footprint.h:909
void IncrementReference(int aDelta)
Bump the current reference by aDelta.
int GetFileFormatVersionAtLoad() const
Definition footprint.h:799
std::optional< double > GetLocalSolderPasteMarginRatio() const
Definition footprint.h:305
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
KIID m_link
Definition footprint.h:1178
GROUPS & Groups()
Definition footprint.h:233
wxString GetFilters() const
Definition footprint.h:293
void SetSheetname(const wxString &aSheetname)
Definition footprint.h:288
const wxArrayString * GetInitialComments() const
Return the initial comments block or NULL if none, without transfer of ownership.
Definition footprint.h:986
KIID GetLink() const
Definition footprint.h:886
void SetAllowMissingCourtyard(bool aAllow)
Definition footprint.h:331
void BuildNetTieCache()
Cache the pads that are allowed to connect to each other in the footprint.
bool IsConflicting() const
std::vector< FP_3DMODEL > & Models()
Definition footprint.h:241
BOARD_ITEM * Duplicate(bool addToParentGroup, BOARD_COMMIT *aCommit=nullptr) const override
Create a copy of this BOARD_ITEM.
const SHAPE_POLY_SET & GetCachedCourtyard(PCB_LAYER_ID aLayer) const
Return the cached courtyard area.
std::deque< PCB_FIELD * > & GetFields()
Definition footprint.h:736
static const wxChar * StringLibNameInvalidChars(bool aUserReadable)
Test for validity of the name in a library of the footprint ( no spaces, dir separators ....
void SetLibDescription(const wxString &aDesc)
Definition footprint.h:279
bool TextOnly() const
const wxString & GetValue() const
Definition footprint.h:683
const COMPONENT_CLASS * GetStaticComponentClass() const
Returns the component class for this footprint.
void CheckShortingPads(const std::function< void(const PAD *, const PAD *, int aErrorCode, const VECTOR2I &)> &aErrorHandler)
Check for overlapping, different-numbered, non-net-tie pads.
double GetArea(int aPadding=0) const
void SetNeedsPlaced(bool needsPlaced)
Definition footprint.h:487
wxString m_filters
Definition footprint.h:1175
const wxString & GetReference() const
Definition footprint.h:661
void CopyFrom(const BOARD_ITEM *aOther) override
void CheckNetTiePadGroups(const std::function< void(const wxString &)> &aErrorHandler)
Sanity check net-tie pad groups.
void SetFPIDAsString(const wxString &aFPID)
Definition footprint.h:276
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
void SetBoardOnly(bool aIsBoardOnly=true)
Definition footprint.h:763
const std::vector< FP_3DMODEL > & Models() const
Definition footprint.h:242
void SetLocalSolderMaskMargin(std::optional< int > aMargin)
Definition footprint.h:300
timestamp_t m_lastEditTime
Definition footprint.h:1176
PAD * GetPad(const VECTOR2I &aPosition, const LSET &aLayerMask=LSET::AllLayersMask())
Get a pad at aPosition on aLayerMask in the footprint.
const SHAPE_POLY_SET & GetCourtyard(PCB_LAYER_ID aLayer) const
Used in DRC to test the courtyard area (a complex polygon).
int GetFlag() const
Definition footprint.h:338
std::map< const BOARD_ITEM *, std::set< int > > m_netTieCache
Definition footprint.h:1145
wxString m_sheetname
Definition footprint.h:1173
LSET m_stackupLayers
Definition footprint.h:1166
int m_fileFormatVersionAtLoad
Definition footprint.h:1121
void SetLocalClearance(std::optional< int > aClearance)
Definition footprint.h:297
void SetPrivateLayers(const LSET &aLayers)
Adds an item to the container.
Definition footprint.h:165
const KIID_PATH & GetPath() const
Definition footprint.h:284
std::optional< int > GetLocalSolderMaskMargin() const
Definition footprint.h:299
void SetLocalSolderPasteMargin(std::optional< int > aMargin)
Definition footprint.h:303
wxString GetKeywords() const
Definition footprint.h:281
bool operator==(const BOARD_ITEM &aOther) const override
EMBEDDED_FILES * GetEmbeddedFiles() override
Definition footprint.h:1014
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...
FOOTPRINT_STACKUP GetStackupMode() const
Definition footprint.h:318
virtual void swapData(BOARD_ITEM *aImage) override
wxString GetNextPadNumber(const wxString &aLastPadName) const
Return the next available pad number in the footprint.
bool IsPlaced() const
Definition footprint.h:477
int m_boundingBoxCacheTimeStamp
Definition footprint.h:1134
VECTOR2I GetPosition() const override
Definition footprint.h:245
DRAWINGS & GraphicalItems()
Definition footprint.h:227
HASH_128 m_courtyard_cache_front_hash
Definition footprint.h:1186
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
PAD * FindPadByNumber(const wxString &aPadNumber, PAD *aSearchAfterMe=nullptr) const
Return a PAD with a matching number.
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
bool operator==(const FP_3DMODEL &aOther) const
Definition footprint.h:124
VECTOR3D m_Offset
3D model offset (mm)
Definition footprint.h:119
double m_Opacity
Definition footprint.h:120
VECTOR3D m_Rotation
3D model rotation (degrees)
Definition footprint.h:118
VECTOR3D m_Scale
3D model scaling factor (dimensionless)
Definition footprint.h:117
wxString m_Filename
The 3D shape filename in 3D library.
Definition footprint.h:121
bool m_Show
Include model in rendering.
Definition footprint.h:122
Used when the right click button is pressed, or when the select tool is in effect.
Definition collectors.h:207
Class OUTLINE_FONT implements outline font drawing.
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
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 PCB_POINT is a 0-dimensional point that is used to mark a position on a PCB, or more usually a foot...
Definition pcb_point.h:43
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:69
@ INCLUDE_NPTH
Definition footprint.h:71
@ DO_NOT_INCLUDE_NPTH
Definition footprint.h:70
FOOTPRINT_ATTR_T
The set of attributes allowed within a FOOTPRINT, using FOOTPRINT::SetAttributes() and FOOTPRINT::Get...
Definition footprint.h:80
@ FP_SMD
Definition footprint.h:82
@ FP_DNP
Definition footprint.h:87
@ FP_EXCLUDE_FROM_POS_FILES
Definition footprint.h:83
@ FP_BOARD_ONLY
Definition footprint.h:85
@ FP_EXCLUDE_FROM_BOM
Definition footprint.h:84
@ FP_JUST_ADDED
Definition footprint.h:86
@ FP_THROUGH_HOLE
Definition footprint.h:81
#define FP_is_PLACED
In autoplace: footprint automatically placed.
Definition footprint.h:449
#define FP_is_LOCKED
footprint LOCKED: no autoplace allowed
Definition footprint.h:448
#define FP_PADS_are_LOCKED
Definition footprint.h:451
FOOTPRINT_STACKUP
Definition footprint.h:91
@ EXPAND_INNER_LAYERS
The 'normal' stackup handling, where there is a single inner layer (In1) and rule areas using it expa...
Definition footprint.h:96
@ CUSTOM_LAYERS
Stackup handling where the footprint can have any number of copper layers, and objects on those layer...
Definition footprint.h:101
#define FP_to_PLACE
In autoplace: footprint waiting for autoplace.
Definition footprint.h:450
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
@ DEFAULT
Flashing follows connectivity.
Definition layer_ids.h:185
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
std::vector< wxString > m_pins
Definition footprint.h:756
bool operator()(const BOARD_ITEM *itemA, const BOARD_ITEM *itemB) const
bool operator()(const PAD *aFirst, const PAD *aSecond) const
bool operator()(const ZONE *aFirst, const ZONE *aSecond) const
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...
@ REFERENCE
Field Reference of part, i.e. "IC21".
@ VALUE
Field Value of part, i.e. "3.3K".
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
Definition typeinfo.h:86
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:695
VECTOR3< double > VECTOR3D
Definition vector3.h:230
ZONE_CONNECTION
How pads are covered by copper in zone.
Definition zones.h:47