KiCad PCB EDA Suite
footprint.h
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 1992-2021 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 <board_item_container.h>
31 #include <board_item.h>
32 #include <collectors.h>
33 #include <convert_to_biu.h>
34 #include <layers_id_colors_and_visibility.h> // ALL_LAYERS definition.
35 #include <lib_id.h>
36 #include <list>
37 
38 #include <zones.h>
40 #include <pcb_item_containers.h>
41 #include <fp_text.h>
42 #include <functional>
43 
44 class LINE_READER;
45 class EDA_3D_CANVAS;
46 class PAD;
47 class BOARD;
48 class MSG_PANEL_ITEM;
49 class SHAPE;
50 
51 namespace KIGFX {
52 class VIEW;
53 }
54 
56 {
58  INCLUDE_NPTH = true
59 };
60 
67 {
68  FP_THROUGH_HOLE = 0x0001,
69  FP_SMD = 0x0002,
72  FP_BOARD_ONLY = 0x0010 // Footprint has no corresponding symbol
73 };
74 
76 {
77 public:
79  // Initialize with sensible values
80  m_Scale { 1, 1, 1 },
81  m_Rotation { 0, 0, 0 },
82  m_Offset { 0, 0, 0 },
83  m_Opacity( 1.0 ),
84  m_Show( true )
85  {
86  }
87 
88  struct VECTOR3D
89  {
90  double x, y, z;
91  };
92 
96  double m_Opacity;
97  wxString m_Filename;
98  bool m_Show;
99 };
100 
101 
103 {
104 public:
105  FOOTPRINT( BOARD* parent );
106 
107  FOOTPRINT( const FOOTPRINT& aFootprint );
108 
109  // Move constructor and operator needed due to std containers inside the footprint
110  FOOTPRINT( FOOTPRINT&& aFootprint );
111 
112  ~FOOTPRINT();
113 
114  FOOTPRINT& operator=( const FOOTPRINT& aOther );
115  FOOTPRINT& operator=( FOOTPRINT&& aOther );
116 
117  static inline bool ClassOf( const EDA_ITEM* aItem )
118  {
119  return aItem && aItem->Type() == PCB_FOOTPRINT_T;
120  }
121 
123  void Add( BOARD_ITEM* aItem, ADD_MODE aMode = ADD_MODE::INSERT ) override;
124 
126  void Remove( BOARD_ITEM* aItem, REMOVE_MODE aMode = REMOVE_MODE::NORMAL ) override;
127 
135  void ClearAllNets();
136 
147 
154 
155  // Virtual function
156  const EDA_RECT GetBoundingBox() const override;
157  const EDA_RECT GetBoundingBox( bool aIncludeText, bool aIncludeInvisibleText ) const;
158 
159  PADS& Pads() { return m_pads; }
160  const PADS& Pads() const { return m_pads; }
161 
162  DRAWINGS& GraphicalItems() { return m_drawings; }
163  const DRAWINGS& GraphicalItems() const { return m_drawings; }
164 
165  FP_ZONES& Zones() { return m_fp_zones; }
166  const FP_ZONES& Zones() const { return m_fp_zones; }
167 
168  FP_GROUPS& Groups() { return m_fp_groups; }
169  const FP_GROUPS& Groups() const { return m_fp_groups; }
170 
171  bool HasThroughHolePads() const;
172 
173  std::list<FP_3DMODEL>& Models() { return m_3D_Drawings; }
174  const std::list<FP_3DMODEL>& Models() const { return m_3D_Drawings; }
175 
176  void SetPosition( const wxPoint& aPos ) override;
177  wxPoint GetPosition() const override { return m_pos; }
178 
179  void SetOrientation( double aNewAngle );
180  void SetOrientationDegrees( double aOrientation ) { SetOrientation( aOrientation * 10.0 ); }
181  double GetOrientation() const { return m_orient; }
182  double GetOrientationDegrees() const { return m_orient / 10.0; }
183  double GetOrientationRadians() const { return m_orient * M_PI / 1800; }
184 
185  const LIB_ID& GetFPID() const { return m_fpid; }
186  void SetFPID( const LIB_ID& aFPID ) { m_fpid = aFPID; }
187 
188  const wxString& GetDescription() const { return m_doc; }
189  void SetDescription( const wxString& aDoc ) { m_doc = aDoc; }
190 
191  const wxString& GetKeywords() const { return m_keywords; }
192  void SetKeywords( const wxString& aKeywords ) { m_keywords = aKeywords; }
193 
194  const KIID_PATH& GetPath() const { return m_path; }
195  void SetPath( const KIID_PATH& aPath ) { m_path = aPath; }
196 
198  void SetLocalSolderMaskMargin( int aMargin ) { m_localSolderMaskMargin = aMargin; }
199 
200  int GetLocalClearance() const { return m_localClearance; }
201  void SetLocalClearance( int aClearance ) { m_localClearance = aClearance; }
202 
203  int GetLocalClearance( wxString* aSource ) const
204  {
205  if( aSource )
206  *aSource = wxString::Format( _( "footprint %s" ), GetReference() );
207 
208  return m_localClearance;
209  }
210 
212  void SetLocalSolderPasteMargin( int aMargin ) { m_localSolderPasteMargin = aMargin; }
213 
216 
219 
220  void SetThermalWidth( int aWidth ) { m_thermalWidth = aWidth; }
221  int GetThermalWidth() const { return m_thermalWidth; }
222 
223  void SetThermalGap( int aGap ) { m_thermalGap = aGap; }
224  int GetThermalGap() const { return m_thermalGap; }
225 
226  int GetAttributes() const { return m_attributes; }
227  void SetAttributes( int aAttributes ) { m_attributes = aAttributes; }
228 
229  void SetFlag( int aFlag ) { m_arflag = aFlag; }
230  void IncrementFlag() { m_arflag += 1; }
231  int GetFlag() const { return m_arflag; }
232 
233  // A bit of a hack until net ties are supported as first class citizens
234  bool IsNetTie() const
235  {
236  return GetKeywords().StartsWith( wxT( "net tie" ) );
237  }
238 
239  void Move( const wxPoint& aMoveVector ) override;
240 
241  void Rotate( const wxPoint& aRotCentre, double aAngle ) override;
242 
243  void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override;
244 
256  void MoveAnchorPosition( const wxPoint& aMoveVector );
257 
261  bool IsFlipped() const { return GetLayer() == B_Cu; }
262 
268  bool IsOnLayer( PCB_LAYER_ID aLayer ) const override;
269 
270 // m_footprintStatus bits:
271 #define FP_is_LOCKED 0x01
272 #define FP_is_PLACED 0x02
273 #define FP_to_PLACE 0x04
274 #define FP_PADS_are_LOCKED 0x08
275 
276 
277  bool IsLocked() const override
278  {
279  return ( m_fpStatus & FP_is_LOCKED ) != 0;
280  }
281 
287  void SetLocked( bool isLocked ) override
288  {
289  if( isLocked )
291  else
293  }
294 
295  bool IsPlaced() const { return m_fpStatus & FP_is_PLACED; }
296  void SetIsPlaced( bool isPlaced )
297  {
298  if( isPlaced )
300  else
302  }
303 
304  bool NeedsPlaced() const { return m_fpStatus & FP_to_PLACE; }
305  void SetNeedsPlaced( bool needsPlaced )
306  {
307  if( needsPlaced )
309  else
311  }
312 
313  bool LegacyPadsLocked() const { return m_fpStatus & FP_PADS_are_LOCKED; }
314 
315  /*
316  void SetPadsLocked( bool aPadsLocked )
317  {
318  if( aPadsLocked )
319  m_fpStatus |= FP_PADS_are_LOCKED;
320  else
321  m_fpStatus &= ~FP_PADS_are_LOCKED;
322  }
323  */
324 
325  void SetLastEditTime( timestamp_t aTime ) { m_lastEditTime = aTime; }
326  void SetLastEditTime() { m_lastEditTime = time( nullptr ); }
328 
350  PCB_LAYER_ID aLayer, int aClearance,
351  int aMaxError, ERROR_LOC aErrorLoc,
352  bool aSkipNPTHPadsWihNoCopper = false,
353  bool aSkipPlatedPads = false,
354  bool aSkipNonPlatedPads = false ) const;
355 
371  PCB_LAYER_ID aLayer, int aClearance,
372  int aError, ERROR_LOC aErrorLoc,
373  bool aIncludeText = true,
374  bool aIncludeShapes = true ) const;
375 
381  PCB_LAYER_ID aLayer, int aClearance,
382  int aError, ERROR_LOC aErrorLoc ) const
383  {
384  TransformFPShapesWithClearanceToPolygon( aCornerBuffer, aLayer, aClearance, aError,
385  aErrorLoc, true, false );
386  }
387 
391  void GetContextualTextVars( wxArrayString* aVars ) const;
392 
398  bool ResolveTextVar( wxString* token, int aDepth = 0 ) const;
399 
401  void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
402 
403  bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
404 
414  bool HitTestAccurate( const wxPoint& aPosition, int aAccuracy = 0 ) const;
415 
416  bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
417 
421  const wxString& GetReference() const
422  {
423  return m_reference->GetText();
424  }
425 
430  void SetReference( const wxString& aReference )
431  {
432  m_reference->SetText( aReference );
433  }
434 
438  void IncrementReference( int aDelta );
439 
443  const wxString& GetValue() const
444  {
445  return m_value->GetText();
446  }
447 
451  void SetValue( const wxString& aValue )
452  {
453  m_value->SetText( aValue );
454  }
455 
457  FP_TEXT& Value() { return *m_value; }
458  FP_TEXT& Reference() { return *m_reference; }
459 
461  FP_TEXT& Value() const { return *m_value; }
462  FP_TEXT& Reference() const { return *m_reference; }
463 
464  const std::map<wxString, wxString>& GetProperties() const { return m_properties; }
465  void SetProperties( const std::map<wxString, wxString>& aProps ) { m_properties = aProps; }
466  const wxString& GetProperty( const wxString& aKey) { return m_properties[ aKey ]; }
467  bool HasProperty( const wxString& aKey)
468  {
469  return m_properties.find( aKey ) != m_properties.end();
470  }
471  void SetProperty( const wxString& aKey, const wxString& aVal ) { m_properties[ aKey ] = aVal; }
472 
481  PAD* FindPadByName( const wxString& aPadName ) const;
482 
490  PAD* GetPad( const wxPoint& aPosition, LSET aLayerMask = LSET::AllLayersMask() );
491 
492  PAD* GetTopLeftPad();
493 
501  unsigned GetPadCount( INCLUDE_NPTH_T aIncludeNPTH = INCLUDE_NPTH_T(INCLUDE_NPTH) ) const;
502 
513  unsigned GetUniquePadCount( INCLUDE_NPTH_T aIncludeNPTH = INCLUDE_NPTH_T(INCLUDE_NPTH) ) const;
514 
522  wxString GetNextPadName( const wxString& aLastPadName ) const;
523 
524  double GetArea( int aPadding = 0 ) const;
525 
526  KIID GetLink() const { return m_link; }
527  void SetLink( const KIID& aLink ) { m_link = aLink; }
528 
529  int GetPlacementCost180() const { return m_rot180Cost; }
530  void SetPlacementCost180( int aCost ) { m_rot180Cost = aCost; }
531 
532  int GetPlacementCost90() const { return m_rot90Cost; }
533  void SetPlacementCost90( int aCost ) { m_rot90Cost = aCost; }
534 
535  BOARD_ITEM* Duplicate() const override;
536 
542  BOARD_ITEM* DuplicateItem( const BOARD_ITEM* aItem, bool aAddToFootprint = false );
543 
549  void Add3DModel( FP_3DMODEL* a3DModel );
550 
551  SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override;
552 
553  wxString GetClass() const override
554  {
555  return wxT( "FOOTPRINT" );
556  }
557 
558  wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
559 
560  BITMAPS GetMenuImage() const override;
561 
562  EDA_ITEM* Clone() const override;
563 
571  void RunOnChildren( const std::function<void (BOARD_ITEM*)>& aFunction ) const;
572 
580  void GetAllDrawingLayers( int aLayers[], int& aCount, bool aIncludePads = true ) const;
581 
582  virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
583 
584  double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
585 
586  virtual const BOX2I ViewBBox() const override;
587 
595  static bool IsLibNameValid( const wxString& aName );
596 
606  static const wxChar* StringLibNameInvalidChars( bool aUserReadable );
607 
622  void SetInitialComments( wxArrayString* aInitialComments )
623  {
624  delete m_initial_comments;
625  m_initial_comments = aInitialComments;
626  }
627 
634  double CoverageRatio( const GENERAL_COLLECTOR& aCollector ) const;
635 
636  static double GetCoverageArea( const BOARD_ITEM* aItem, const GENERAL_COLLECTOR& aCollector );
637 
639  const wxArrayString* GetInitialComments() const { return m_initial_comments; }
640 
648 
655  void BuildPolyCourtyards( OUTLINE_ERROR_HANDLER* aErrorHandler = nullptr );
656 
657  virtual std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER ) const override;
658 
659  virtual void SwapData( BOARD_ITEM* aImage ) override;
660 
662  {
663  bool operator()( const BOARD_ITEM* aFirst, const BOARD_ITEM* aSecond ) const;
664  };
665 
666  struct cmp_pads
667  {
668  bool operator()( const PAD* aFirst, const PAD* aSecond ) const;
669  };
670 
671 
672 #if defined(DEBUG)
673  virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
674 #endif
675 
676 private:
677  DRAWINGS m_drawings; // BOARD_ITEMs for drawings on the board, owned by pointer.
678  PADS m_pads; // PAD items, owned by pointer
679  FP_ZONES m_fp_zones; // FP_ZONE items, owned by pointer
680  FP_GROUPS m_fp_groups; // PCB_GROUP items, owned by pointer
681 
682  double m_orient; // Orientation in tenths of a degree, 900=90.0 degrees.
683  wxPoint m_pos; // Position of footprint on the board in internal units.
684  FP_TEXT* m_reference; // Component reference designator value (U34, R18..)
685  FP_TEXT* m_value; // Component value (74LS00, 22K..)
686  LIB_ID m_fpid; // The #LIB_ID of the FOOTPRINT.
687  int m_attributes; // Flag bits ( see FOOTPRINT_ATTR_T )
688  int m_fpStatus; // For autoplace: flags (LOCKED, FIELDS_AUTOPLACED)
689 
690  // Bounding box caching strategy:
691  // While we attempt to notice the low-hanging fruit operations and update the bounding boxes
692  // accordingly, we rely mostly on a "if anything changed then the caches are stale" approach.
693  // We implement this by having PCB_BASE_FRAME's OnModify() method increment an operation
694  // counter, and storing that as a timestamp for the various caches.
695  // This means caches will get regenerated often -- but still far less often than if we had no
696  // caches at all. The principal opitmization would be to change to dirty flag and make sure
697  // that any edit that could affect the bounding boxes (including edits to the footprint
698  // children) marked the bounding boxes dirty. It would definitely be faster -- but also more
699  // fragile.
707  mutable int m_hullCacheTimeStamp;
708 
713  int m_localSolderMaskMargin; // Solder mask margin
714  int m_localSolderPasteMargin; // Solder paste margin absolute value
715  double m_localSolderPasteMarginRatio; // Solder mask margin ratio value of pad size
716 
717  wxString m_doc; // File name and path for documentation file.
718  wxString m_keywords; // Search keywords to find footprint in library.
719  KIID_PATH m_path; // Path to associated symbol ([sheetUUID, .., symbolUUID]).
721  int m_arflag; // Use to trace ratsnest and auto routing.
722  KIID m_link; // Temporary logical link used during editing
723  int m_rot90Cost; // Horizontal automatic placement cost ( 0..10 ).
724  int m_rot180Cost; // Vertical automatic placement cost ( 0..10 ).
725 
726  std::list<FP_3DMODEL> m_3D_Drawings; // Linked list of 3D models.
727  std::map<wxString, wxString> m_properties;
728  wxArrayString* m_initial_comments; // s-expression comments in the footprint,
729  // lazily allocated only if needed for speed
730 
731  SHAPE_POLY_SET m_poly_courtyard_front; // Note that a footprint can have both front and back
732  SHAPE_POLY_SET m_poly_courtyard_back; // courtyards populated.
733 };
734 
735 #endif // FOOTPRINT_H
void SetReference(const wxString &aReference)
Definition: footprint.h:430
void BuildPolyCourtyards(OUTLINE_ERROR_HANDLER *aErrorHandler=nullptr)
Build complex polygons of the courtyard areas from graphic items on the courtyard layers.
Definition: footprint.cpp:1945
int m_localSolderPasteMargin
Definition: footprint.h:714
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:1629
static double GetCoverageArea(const BOARD_ITEM *aItem, const GENERAL_COLLECTOR &aCollector)
Return the initial comments block or NULL if none, without transfer of ownership.
Definition: footprint.cpp:1763
ZONE_CONNECTION
How pads are covered by copper in zone.
Definition: zones.h:41
bool IsLocked() const override
Definition: footprint.h:277
bool NeedsPlaced() const
Definition: footprint.h:304
double GetArea(int aPadding=0) const
Definition: footprint.cpp:602
void ClearAllNets()
Clear (i.e.
Definition: footprint.cpp:463
double ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
Definition: footprint.cpp:1288
const wxString & GetDescription() const
Definition: footprint.h:188
void SetInitialComments(wxArrayString *aInitialComments)
Take ownership of caller's heap allocated aInitialComments block.
Definition: footprint.h:622
An abstract class from which implementation specific LINE_READERs may be derived to read single lines...
Definition: richio.h:80
EDA_RECT m_cachedVisibleBBox
Definition: footprint.h:702
const SHAPE_POLY_SET & GetPolyCourtyardFront() const
Used in DRC to test the courtyard area (a complex polygon).
Definition: footprint.h:646
SHAPE_POLY_SET GetBoundingHull() const
Return a bounding polygon for the shapes and pads in the footprint.
Definition: footprint.cpp:746
double GetOrientationRadians() const
Definition: footprint.h:183
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
Definition: footprint.cpp:1166
std::list< FP_3DMODEL > & Models()
Definition: footprint.h:173
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:823
void SetNeedsPlaced(bool needsPlaced)
Definition: footprint.h:305
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
A special IsOnLayer for footprints: return true if the footprint contains only items on the given lay...
Definition: footprint.cpp:889
const wxString & GetValue() const
Definition: footprint.h:443
FP_TEXT & Value() const
The const versions to keep the compiler happy.
Definition: footprint.h:461
The Cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:191
void SetZoneConnection(ZONE_CONNECTION aType)
Definition: footprint.h:217
unsigned GetPadCount(INCLUDE_NPTH_T aIncludeNPTH=INCLUDE_NPTH_T(INCLUDE_NPTH)) const
Return the number of pads.
Definition: footprint.cpp:1018
const KIID_PATH & GetPath() const
Definition: footprint.h:194
ZONE_CONNECTION m_zoneConnection
Definition: footprint.h:709
double m_localSolderPasteMarginRatio
Definition: footprint.h:715
SHAPE_POLY_SET m_poly_courtyard_back
Definition: footprint.h:732
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:80
int GetPlacementCost180() const
Definition: footprint.h:529
void SetPath(const KIID_PATH &aPath)
Definition: footprint.h:195
#define FP_PADS_are_LOCKED
Definition: footprint.h:274
void SetIsPlaced(bool isPlaced)
Definition: footprint.h:296
double m_orient
Definition: footprint.h:682
bool ResolveTextVar(wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the component.
Definition: footprint.cpp:436
timestamp_t m_lastEditTime
Definition: footprint.h:720
void IncrementFlag()
Definition: footprint.h:230
void Remove(BOARD_ITEM *aItem, REMOVE_MODE aMode=REMOVE_MODE::NORMAL) override
Removes an item from the container.
Definition: footprint.cpp:525
double GetOrientation() const
Definition: footprint.h:181
void TransformFPTextWithClearanceToPolygonSet(SHAPE_POLY_SET &aCornerBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc) const
This function is the same as TransformGraphicShapesWithClearanceToPolygonSet but only generate text.
Definition: footprint.h:380
FP_3DMODEL()
Definition: footprint.h:78
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:1845
bool LegacyPadsLocked() const
Definition: footprint.h:313
Implement a canvas based on a wxGLCanvas.
Definition: eda_3d_canvas.h:48
void SetLocalSolderPasteMarginRatio(double aRatio)
Definition: footprint.h:215
functions to convert a shape built with DRAWSEGMENTS to a polygon.
void SetOrientationDegrees(double aOrientation)
Definition: footprint.h:180
FP_TEXT * m_reference
Definition: footprint.h:684
int m_visibleBBoxCacheTimeStamp
Definition: footprint.h:703
INCLUDE_NPTH_T
Definition: footprint.h:55
void SetThermalGap(int aGap)
Definition: footprint.h:223
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
The base class for create windows for drawing purpose.
VECTOR3D m_Offset
3D model offset (mm)
Definition: footprint.h:95
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: footprint.cpp:1177
FOOTPRINT_ATTR_T
The set of attributes allowed within a FOOTPRINT, using FOOTPRINT::SetAttributes() and FOOTPRINT::Get...
Definition: footprint.h:66
const INSPECTOR_FUNC & INSPECTOR
Definition: eda_item.h:94
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
timestamp_t GetLastEditTime() const
Definition: footprint.h:327
bool operator()(const PAD *aFirst, const PAD *aSecond) const
Definition: footprint.cpp:2045
void SetAttributes(int aAttributes)
Definition: footprint.h:227
int m_rot90Cost
Definition: footprint.h:723
PADS & Pads()
Definition: footprint.h:159
void SetPlacementCost180(int aCost)
Definition: footprint.h:530
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
virtual void SwapData(BOARD_ITEM *aImage) override
Swap data between aItem and aImage.
Definition: footprint.cpp:2000
void Add3DModel(FP_3DMODEL *a3DModel)
Add a3DModel definition to the end of the 3D model list.
Definition: footprint.cpp:1070
FP_TEXT & Value()
read/write accessors:
Definition: footprint.h:457
FP_TEXT * m_value
Definition: footprint.h:685
PAD * GetTopLeftPad()
Definition: footprint.cpp:999
void SetThermalWidth(int aWidth)
Definition: footprint.h:220
void SetDescription(const wxString &aDoc)
Definition: footprint.h:189
int m_arflag
Definition: footprint.h:721
KIID m_link
Definition: footprint.h:722
FP_TEXT & Reference()
Definition: footprint.h:458
const FP_ZONES & Zones() const
Definition: footprint.h:166
int m_localSolderMaskMargin
Definition: footprint.h:713
EDA_RECT m_cachedBoundingBox
Definition: footprint.h:700
FP_ZONES & Zones()
Definition: footprint.h:165
Definition: kiid.h:44
bool m_Show
Include model in rendering.
Definition: footprint.h:98
int m_fpStatus
Definition: footprint.h:688
int GetFlag() const
Definition: footprint.h:231
PCB_LAYER_ID
A quick note on layer IDs:
virtual const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
Definition: footprint.cpp:1305
LSET is a set of PCB_LAYER_IDs.
FP_ZONES m_fp_zones
Definition: footprint.h:679
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:114
virtual void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
Definition: footprint.cpp:1242
SHAPE_POLY_SET m_poly_courtyard_front
Definition: footprint.h:731
void IncrementReference(int aDelta)
Bump the current reference by aDelta.
Definition: footprint.cpp:1734
Represent a set of closed polygons.
SHAPE_POLY_SET m_cachedHull
Definition: footprint.h:706
PAD * GetPad(const wxPoint &aPosition, LSET aLayerMask=LSET::AllLayersMask())
Get a pad at aPosition on aLayerMask in the footprint.
Definition: footprint.cpp:983
void Move(const wxPoint &aMoveVector) override
Move this object.
Definition: footprint.cpp:1349
void SetOrientation(double aNewAngle)
Definition: footprint.cpp:1571
const DRAWINGS & GraphicalItems() const
Definition: footprint.h:163
void Flip(const wxPoint &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: footprint.cpp:1381
VECTOR3D m_Scale
3D model scaling factor (dimensionless)
Definition: footprint.h:93
SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[]) override
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: footprint.cpp:1081
int m_thermalGap
Definition: footprint.h:711
void SetLocalClearance(int aClearance)
Definition: footprint.h:201
int GetLocalClearance() const
Definition: footprint.h:200
bool IsNetTie() const
Definition: footprint.h:234
const SHAPE_POLY_SET & GetPolyCourtyardBack() const
Definition: footprint.h:647
const PADS & Pads() const
Definition: footprint.h:160
const wxString & GetReference() const
Definition: footprint.h:421
#define _(s)
double m_Opacity
Definition: footprint.h:96
BOARD_ITEM * Duplicate() const override
Create a copy of this BOARD_ITEM.
Definition: footprint.cpp:1615
DRAWINGS & GraphicalItems()
Definition: footprint.h:162
void MoveAnchorPosition(const wxPoint &aMoveVector)
Move the reference point of the footprint.
Definition: footprint.cpp:1498
static LSET AllLayersMask()
Definition: lset.cpp:787
bool IsPlaced() const
Definition: footprint.h:295
const LIB_ID & GetFPID() const
Definition: footprint.h:185
const FP_GROUPS & Groups() const
Definition: footprint.h:169
An abstract shape on 2D plane.
Definition: shape.h:116
FP_TEXT & Reference() const
Definition: footprint.h:462
wxPoint m_pos
Definition: footprint.h:683
PAD * FindPadByName(const wxString &aPadName) const
Return a PAD with a matching name.
Definition: footprint.cpp:971
void SetValue(const wxString &aValue)
Definition: footprint.h:451
void SetFlag(int aFlag)
Definition: footprint.h:229
void Rotate(const wxPoint &aRotCentre, double aAngle) override
Rotate this object.
Definition: footprint.cpp:1356
const wxString & GetKeywords() const
Definition: footprint.h:191
void TransformPadsWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, PCB_LAYER_ID aLayer, int aClearance, int aMaxError, ERROR_LOC aErrorLoc, bool aSkipNPTHPadsWihNoCopper=false, bool aSkipPlatedPads=false, bool aSkipNonPlatedPads=false) const
Generate pads shapes on layer aLayer as polygons and adds these polygons to aCornerBuffer.
int GetThermalWidth() const
Definition: footprint.h:221
int m_boundingBoxCacheTimeStamp
Definition: footprint.h:701
#define FP_to_PLACE
In autoplace: footprint waiting for autoplace.
Definition: footprint.h:273
KIID GetLink() const
Definition: footprint.h:526
#define FP_is_LOCKED
footprint LOCKED: no autoplace allowed
Definition: footprint.h:271
class FOOTPRINT, a footprint
Definition: typeinfo.h:88
KIID_PATH m_path
Definition: footprint.h:719
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
wxString m_Filename
The 3D shape filename in 3D library.
Definition: footprint.h:97
const wxArrayString * GetInitialComments() const
Definition: footprint.h:639
EDA_UNITS
Definition: eda_units.h:38
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:32
int GetLocalClearance(wxString *aSource) const
Definition: footprint.h:203
bool operator()(const BOARD_ITEM *aFirst, const BOARD_ITEM *aSecond) const
Definition: footprint.cpp:2020
void GetContextualTextVars(wxArrayString *aVars) const
Return the list of system text vars for this footprint.
Definition: footprint.cpp:428
bool IsFlipped() const
Definition: footprint.h:261
FP_GROUPS & Groups()
Definition: footprint.h:168
void SetFPID(const LIB_ID &aFPID)
Definition: footprint.h:186
void SetLink(const KIID &aLink)
Definition: footprint.h:527
double GetOrientationDegrees() const
Definition: footprint.h:182
int m_thermalWidth
Definition: footprint.h:710
wxString m_keywords
Definition: footprint.h:718
int GetLocalSolderMaskMargin() const
Definition: footprint.h:197
FOOTPRINT(BOARD *parent)
Definition: footprint.cpp:51
int m_localClearance
Definition: footprint.h:712
void SetProperty(const wxString &aKey, const wxString &aVal)
Definition: footprint.h:471
VECTOR3D m_Rotation
3D model rotation (degrees)
Definition: footprint.h:94
Board layer functions and definitions.
int GetAttributes() const
Definition: footprint.h:226
int m_rot180Cost
Definition: footprint.h:724
BITMAPS
A list of all bitmap identifiers.
Definition: bitmaps_list.h:32
int m_textExcludedBBoxCacheTimeStamp
Definition: footprint.h:705
wxString GetClass() const override
Return the class name.
Definition: footprint.h:553
void TransformFPShapesWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc, bool aIncludeText=true, bool aIncludeShapes=true) const
Generate shapes of graphic items (outlines) on layer aLayer as polygons and adds these polygons to aC...
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
const std::list< FP_3DMODEL > & Models() const
Definition: footprint.h:174
LIB_ID m_fpid
Definition: footprint.h:686
void SetLastEditTime(timestamp_t aTime)
Definition: footprint.h:325
wxString GetNextPadName(const wxString &aLastPadName) const
Return the next available pad name in the footprint.
Definition: footprint.cpp:1714
Used when the right click button is pressed, or when the select tool is in effect.
Definition: collectors.h:240
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: footprint.cpp:635
void SetKeywords(const wxString &aKeywords)
Definition: footprint.h:192
Handle the component boundary box.
Definition: eda_rect.h:42
void SetLocked(bool isLocked) override
Set the #MODULE_is_LOCKED bit in the m_ModuleStatus.
Definition: footprint.h:287
FOOTPRINT & operator=(const FOOTPRINT &aOther)
Definition: footprint.cpp:324
unsigned GetUniquePadCount(INCLUDE_NPTH_T aIncludeNPTH=INCLUDE_NPTH_T(INCLUDE_NPTH)) const
Return the number of unique non-blank pads.
Definition: footprint.cpp:1037
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:100
EDA_RECT m_cachedTextExcludedBBox
Definition: footprint.h:704
const std::function< void(const wxString &msg, BOARD_ITEM *itemA, BOARD_ITEM *itemB, const wxPoint &pt)> OUTLINE_ERROR_HANDLER
wxPoint GetPosition() const override
Definition: footprint.h:177
double GetLocalSolderPasteMarginRatio() const
Definition: footprint.h:214
DRAWINGS m_drawings
Definition: footprint.h:677
const std::map< wxString, wxString > & GetProperties() const
Definition: footprint.h:464
void GetAllDrawingLayers(int aLayers[], int &aCount, bool aIncludePads=true) const
Return a set of all layers that this footprint has drawings on similar to ViewGetLayers().
Definition: footprint.cpp:1215
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction) const
Invoke a function on all BOARD_ITEMs that belong to the footprint (pads, drawings,...
Definition: footprint.cpp:1189
ZONE_CONNECTION GetZoneConnection() const
Definition: footprint.h:218
int GetPlacementCost90() const
Definition: footprint.h:532
void SetLastEditTime()
Definition: footprint.h:326
std::map< wxString, wxString > m_properties
Definition: footprint.h:727
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:1323
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Test if aPosition is contained within or on the bounding box of an item.
Definition: footprint.cpp:912
static bool ClassOf(const EDA_ITEM *aItem)
Adds an item to the container.
Definition: footprint.h:117
Abstract interface for BOARD_ITEMs capable of storing other items inside.
int GetLocalSolderPasteMargin() const
Definition: footprint.h:211
EDA_MSG_PANEL items for displaying messages.
Definition: msgpanel.h:53
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:67
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
Removes an item from the container.
Definition: footprint.cpp:472
void SetProperties(const std::map< wxString, wxString > &aProps)
Definition: footprint.h:465
wxArrayString * m_initial_comments
Definition: footprint.h:728
#define FP_is_PLACED
In autoplace: footprint automatically placed.
Definition: footprint.h:272
const wxString & GetProperty(const wxString &aKey)
Definition: footprint.h:466
Definition: pad.h:57
void SetPosition(const wxPoint &aPos) override
Definition: footprint.cpp:1452
SEARCH_RESULT
Definition: eda_item.h:41
FP_GROUPS m_fp_groups
Definition: footprint.h:680
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: footprint.cpp:1183
bool HasProperty(const wxString &aKey)
Definition: footprint.h:467
bool HasThroughHolePads() const
Definition: footprint.cpp:2008
wxString m_doc
Definition: footprint.h:717
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:171
bool HitTestAccurate(const wxPoint &aPosition, int aAccuracy=0) const
Test if a point is inside the bounding polygon of the footprint.
Definition: footprint.cpp:919
int GetThermalGap() const
Definition: footprint.h:224
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:133
std::list< FP_3DMODEL > m_3D_Drawings
Definition: footprint.h:726
PADS m_pads
Definition: footprint.h:678
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:1334
int m_hullCacheTimeStamp
Definition: footprint.h:707
void SetPlacementCost90(int aCost)
Definition: footprint.h:533
int m_attributes
Definition: footprint.h:687
void SetLocalSolderMaskMargin(int aMargin)
Definition: footprint.h:198
EDA_RECT GetFpPadsLocalBbox() const
Return the bounding box containing pads when the footprint is on the front side, orientation 0,...
Definition: footprint.cpp:612
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113
virtual std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER) const override
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
Definition: footprint.cpp:1921
void SetLocalSolderPasteMargin(int aMargin)
Definition: footprint.h:212