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 <layer_ids.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 
144  bool FixUuids();
145 
156 
163 
164  // Virtual function
165  const EDA_RECT GetBoundingBox() const override;
166  const EDA_RECT GetBoundingBox( bool aIncludeText, bool aIncludeInvisibleText ) const;
167 
168  PADS& Pads() { return m_pads; }
169  const PADS& Pads() const { return m_pads; }
170 
171  DRAWINGS& GraphicalItems() { return m_drawings; }
172  const DRAWINGS& GraphicalItems() const { return m_drawings; }
173 
174  FP_ZONES& Zones() { return m_fp_zones; }
175  const FP_ZONES& Zones() const { return m_fp_zones; }
176 
177  FP_GROUPS& Groups() { return m_fp_groups; }
178  const FP_GROUPS& Groups() const { return m_fp_groups; }
179 
180  bool HasThroughHolePads() const;
181 
182  std::list<FP_3DMODEL>& Models() { return m_3D_Drawings; }
183  const std::list<FP_3DMODEL>& Models() const { return m_3D_Drawings; }
184 
185  void SetPosition( const wxPoint& aPos ) override;
186  wxPoint GetPosition() const override { return m_pos; }
187 
188  void SetOrientation( double aNewAngle );
189  void SetOrientationDegrees( double aOrientation ) { SetOrientation( aOrientation * 10.0 ); }
190  double GetOrientation() const { return m_orient; }
191  double GetOrientationDegrees() const { return m_orient / 10.0; }
192  double GetOrientationRadians() const { return m_orient * M_PI / 1800; }
193 
194  const LIB_ID& GetFPID() const { return m_fpid; }
195  void SetFPID( const LIB_ID& aFPID ) { m_fpid = aFPID; }
196 
197  const wxString& GetDescription() const { return m_doc; }
198  void SetDescription( const wxString& aDoc ) { m_doc = aDoc; }
199 
200  const wxString& GetKeywords() const { return m_keywords; }
201  void SetKeywords( const wxString& aKeywords ) { m_keywords = aKeywords; }
202 
203  const KIID_PATH& GetPath() const { return m_path; }
204  void SetPath( const KIID_PATH& aPath ) { m_path = aPath; }
205 
207  void SetLocalSolderMaskMargin( int aMargin ) { m_localSolderMaskMargin = aMargin; }
208 
209  int GetLocalClearance() const { return m_localClearance; }
210  void SetLocalClearance( int aClearance ) { m_localClearance = aClearance; }
211 
212  int GetLocalClearance( wxString* aSource ) const
213  {
214  if( aSource )
215  *aSource = wxString::Format( _( "footprint %s" ), GetReference() );
216 
217  return m_localClearance;
218  }
219 
221  void SetLocalSolderPasteMargin( int aMargin ) { m_localSolderPasteMargin = aMargin; }
222 
225 
228 
229  void SetThermalWidth( int aWidth ) { m_thermalWidth = aWidth; }
230  int GetThermalWidth() const { return m_thermalWidth; }
231 
232  void SetThermalGap( int aGap ) { m_thermalGap = aGap; }
233  int GetThermalGap() const { return m_thermalGap; }
234 
235  int GetAttributes() const { return m_attributes; }
236  void SetAttributes( int aAttributes ) { m_attributes = aAttributes; }
237 
238  void SetFlag( int aFlag ) { m_arflag = aFlag; }
239  void IncrementFlag() { m_arflag += 1; }
240  int GetFlag() const { return m_arflag; }
241 
242  // A bit of a hack until net ties are supported as first class citizens
243  bool IsNetTie() const
244  {
245  return GetKeywords().StartsWith( wxT( "net tie" ) );
246  }
247 
253  int GetLikelyAttribute() const;
254 
255  void Move( const wxPoint& aMoveVector ) override;
256 
257  void Rotate( const wxPoint& aRotCentre, double aAngle ) override;
258 
259  void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override;
260 
272  void MoveAnchorPosition( const wxPoint& aMoveVector );
273 
277  bool IsFlipped() const { return GetLayer() == B_Cu; }
278 
284  bool IsOnLayer( PCB_LAYER_ID aLayer ) const override;
285 
286 // m_footprintStatus bits:
287 #define FP_is_LOCKED 0x01
288 #define FP_is_PLACED 0x02
289 #define FP_to_PLACE 0x04
290 #define FP_PADS_are_LOCKED 0x08
291 
292 
293  bool IsLocked() const override
294  {
295  return ( m_fpStatus & FP_is_LOCKED ) != 0;
296  }
297 
303  void SetLocked( bool isLocked ) override
304  {
305  if( isLocked )
307  else
309  }
310 
311  bool IsPlaced() const { return m_fpStatus & FP_is_PLACED; }
312  void SetIsPlaced( bool isPlaced )
313  {
314  if( isPlaced )
316  else
318  }
319 
320  bool NeedsPlaced() const { return m_fpStatus & FP_to_PLACE; }
321  void SetNeedsPlaced( bool needsPlaced )
322  {
323  if( needsPlaced )
325  else
327  }
328 
329  bool LegacyPadsLocked() const { return m_fpStatus & FP_PADS_are_LOCKED; }
330 
331  /*
332  void SetPadsLocked( bool aPadsLocked )
333  {
334  if( aPadsLocked )
335  m_fpStatus |= FP_PADS_are_LOCKED;
336  else
337  m_fpStatus &= ~FP_PADS_are_LOCKED;
338  }
339  */
340 
341  void SetLastEditTime( timestamp_t aTime ) { m_lastEditTime = aTime; }
342  void SetLastEditTime() { m_lastEditTime = time( nullptr ); }
344 
355  void CheckFootprintAttributes( const std::function<void( const wxString& msg )>* aErrorHandler );
356 
378  PCB_LAYER_ID aLayer, int aClearance,
379  int aMaxError, ERROR_LOC aErrorLoc,
380  bool aSkipNPTHPadsWihNoCopper = false,
381  bool aSkipPlatedPads = false,
382  bool aSkipNonPlatedPads = false ) const;
383 
399  PCB_LAYER_ID aLayer, int aClearance,
400  int aError, ERROR_LOC aErrorLoc,
401  bool aIncludeText = true,
402  bool aIncludeShapes = true ) const;
403 
409  PCB_LAYER_ID aLayer, int aClearance,
410  int aError, ERROR_LOC aErrorLoc ) const
411  {
412  TransformFPShapesWithClearanceToPolygon( aCornerBuffer, aLayer, aClearance, aError,
413  aErrorLoc, true, false );
414  }
415 
419  void GetContextualTextVars( wxArrayString* aVars ) const;
420 
426  bool ResolveTextVar( wxString* token, int aDepth = 0 ) const;
427 
429  void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
430 
431  bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
432 
442  bool HitTestAccurate( const wxPoint& aPosition, int aAccuracy = 0 ) const;
443 
444  bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
445 
449  const wxString& GetReference() const
450  {
451  return m_reference->GetText();
452  }
453 
458  void SetReference( const wxString& aReference )
459  {
460  m_reference->SetText( aReference );
461  }
462 
466  void IncrementReference( int aDelta );
467 
471  const wxString& GetValue() const
472  {
473  return m_value->GetText();
474  }
475 
479  void SetValue( const wxString& aValue )
480  {
481  m_value->SetText( aValue );
482  }
483 
485  FP_TEXT& Value() { return *m_value; }
486  FP_TEXT& Reference() { return *m_reference; }
487 
489  FP_TEXT& Value() const { return *m_value; }
490  FP_TEXT& Reference() const { return *m_reference; }
491 
492  const std::map<wxString, wxString>& GetProperties() const { return m_properties; }
493  void SetProperties( const std::map<wxString, wxString>& aProps ) { m_properties = aProps; }
494  const wxString& GetProperty( const wxString& aKey) { return m_properties[ aKey ]; }
495  bool HasProperty( const wxString& aKey)
496  {
497  return m_properties.find( aKey ) != m_properties.end();
498  }
499  void SetProperty( const wxString& aKey, const wxString& aVal ) { m_properties[ aKey ] = aVal; }
500 
510  PAD* FindPadByNumber( const wxString& aPadNumber, PAD* aSearchAfterMe = nullptr ) const;
511 
519  PAD* GetPad( const wxPoint& aPosition, LSET aLayerMask = LSET::AllLayersMask() );
520 
521  PAD* GetTopLeftPad();
522 
530  unsigned GetPadCount( INCLUDE_NPTH_T aIncludeNPTH = INCLUDE_NPTH_T(INCLUDE_NPTH) ) const;
531 
542  unsigned GetUniquePadCount( INCLUDE_NPTH_T aIncludeNPTH = INCLUDE_NPTH_T(INCLUDE_NPTH) ) const;
543 
551  wxString GetNextPadNumber( const wxString& aLastPadName ) const;
552 
557  wxString GetTypeName() const;
558 
559  double GetArea( int aPadding = 0 ) const;
560 
561  KIID GetLink() const { return m_link; }
562  void SetLink( const KIID& aLink ) { m_link = aLink; }
563 
564  int GetPlacementCost180() const { return m_rot180Cost; }
565  void SetPlacementCost180( int aCost ) { m_rot180Cost = aCost; }
566 
567  int GetPlacementCost90() const { return m_rot90Cost; }
568  void SetPlacementCost90( int aCost ) { m_rot90Cost = aCost; }
569 
570  BOARD_ITEM* Duplicate() const override;
571 
577  BOARD_ITEM* DuplicateItem( const BOARD_ITEM* aItem, bool aAddToFootprint = false );
578 
584  void Add3DModel( FP_3DMODEL* a3DModel );
585 
586  SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override;
587 
588  wxString GetClass() const override
589  {
590  return wxT( "FOOTPRINT" );
591  }
592 
593  wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
594 
595  BITMAPS GetMenuImage() const override;
596 
597  EDA_ITEM* Clone() const override;
598 
606  void RunOnChildren( const std::function<void (BOARD_ITEM*)>& aFunction ) const;
607 
615  void GetAllDrawingLayers( int aLayers[], int& aCount, bool aIncludePads = true ) const;
616 
617  virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
618 
619  double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
620 
621  virtual const BOX2I ViewBBox() const override;
622 
630  static bool IsLibNameValid( const wxString& aName );
631 
641  static const wxChar* StringLibNameInvalidChars( bool aUserReadable );
642 
657  void SetInitialComments( wxArrayString* aInitialComments )
658  {
659  delete m_initial_comments;
660  m_initial_comments = aInitialComments;
661  }
662 
669  double CoverageRatio( const GENERAL_COLLECTOR& aCollector ) const;
670 
671  static double GetCoverageArea( const BOARD_ITEM* aItem, const GENERAL_COLLECTOR& aCollector );
672 
674  const wxArrayString* GetInitialComments() const { return m_initial_comments; }
675 
682  {
683  if( IsBackLayer( aLayer ) )
684  return m_poly_courtyard_back;
685  else
686  return m_poly_courtyard_front;
687  }
688 
695  void BuildPolyCourtyards( OUTLINE_ERROR_HANDLER* aErrorHandler = nullptr );
696 
697  virtual std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER ) const override;
698 
699  virtual void SwapData( BOARD_ITEM* aImage ) override;
700 
702  {
703  bool operator()( const BOARD_ITEM* aFirst, const BOARD_ITEM* aSecond ) const;
704  };
705 
706  struct cmp_pads
707  {
708  bool operator()( const PAD* aFirst, const PAD* aSecond ) const;
709  };
710 
711 
712 #if defined(DEBUG)
713  virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
714 #endif
715 
716 private:
717  DRAWINGS m_drawings; // BOARD_ITEMs for drawings on the board, owned by pointer.
718  PADS m_pads; // PAD items, owned by pointer
719  FP_ZONES m_fp_zones; // FP_ZONE items, owned by pointer
720  FP_GROUPS m_fp_groups; // PCB_GROUP items, owned by pointer
721 
722  double m_orient; // Orientation in tenths of a degree, 900=90.0 degrees.
723  wxPoint m_pos; // Position of footprint on the board in internal units.
724  FP_TEXT* m_reference; // Component reference designator value (U34, R18..)
725  FP_TEXT* m_value; // Component value (74LS00, 22K..)
726  LIB_ID m_fpid; // The #LIB_ID of the FOOTPRINT.
727  int m_attributes; // Flag bits ( see FOOTPRINT_ATTR_T )
728  int m_fpStatus; // For autoplace: flags (LOCKED, FIELDS_AUTOPLACED)
729 
730  // Bounding box caching strategy:
731  // While we attempt to notice the low-hanging fruit operations and update the bounding boxes
732  // accordingly, we rely mostly on a "if anything changed then the caches are stale" approach.
733  // We implement this by having PCB_BASE_FRAME's OnModify() method increment an operation
734  // counter, and storing that as a timestamp for the various caches.
735  // This means caches will get regenerated often -- but still far less often than if we had no
736  // caches at all. The principal opitmization would be to change to dirty flag and make sure
737  // that any edit that could affect the bounding boxes (including edits to the footprint
738  // children) marked the bounding boxes dirty. It would definitely be faster -- but also more
739  // fragile.
747  mutable int m_hullCacheTimeStamp;
748 
753  int m_localSolderMaskMargin; // Solder mask margin
754  int m_localSolderPasteMargin; // Solder paste margin absolute value
755  double m_localSolderPasteMarginRatio; // Solder mask margin ratio value of pad size
756 
757  wxString m_doc; // File name and path for documentation file.
758  wxString m_keywords; // Search keywords to find footprint in library.
759  KIID_PATH m_path; // Path to associated symbol ([sheetUUID, .., symbolUUID]).
761  int m_arflag; // Use to trace ratsnest and auto routing.
762  KIID m_link; // Temporary logical link used during editing
763  int m_rot90Cost; // Horizontal automatic placement cost ( 0..10 ).
764  int m_rot180Cost; // Vertical automatic placement cost ( 0..10 ).
765 
766  std::list<FP_3DMODEL> m_3D_Drawings; // Linked list of 3D models.
767  std::map<wxString, wxString> m_properties;
768  wxArrayString* m_initial_comments; // s-expression comments in the footprint,
769  // lazily allocated only if needed for speed
770 
771  SHAPE_POLY_SET m_poly_courtyard_front; // Note that a footprint can have both front and back
772  SHAPE_POLY_SET m_poly_courtyard_back; // courtyards populated.
773 };
774 
775 #endif // FOOTPRINT_H
void SetReference(const wxString &aReference)
Definition: footprint.h:458
void BuildPolyCourtyards(OUTLINE_ERROR_HANDLER *aErrorHandler=nullptr)
Build complex polygons of the courtyard areas from graphic items on the courtyard layers.
Definition: footprint.cpp:2022
int m_localSolderPasteMargin
Definition: footprint.h:754
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:1720
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:1852
ZONE_CONNECTION
How pads are covered by copper in zone.
Definition: zones.h:41
bool IsLocked() const override
Definition: footprint.h:293
bool NeedsPlaced() const
Definition: footprint.h:320
double GetArea(int aPadding=0) const
Definition: footprint.cpp:643
void ClearAllNets()
Clear (i.e.
Definition: footprint.cpp:504
double ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
Definition: footprint.cpp:1379
const wxString & GetDescription() const
Definition: footprint.h:197
void SetInitialComments(wxArrayString *aInitialComments)
Take ownership of caller's heap allocated aInitialComments block.
Definition: footprint.h:657
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:742
SHAPE_POLY_SET GetBoundingHull() const
Return a bounding polygon for the shapes and pads in the footprint.
Definition: footprint.cpp:829
double GetOrientationRadians() const
Definition: footprint.h:192
bool FixUuids()
Old footprints do not alway have a valid UUID (some can be set to null uuid) However null UUIDs,...
Definition: footprint.cpp:227
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:1257
std::list< FP_3DMODEL > & Models()
Definition: footprint.h:182
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:908
void SetNeedsPlaced(bool needsPlaced)
Definition: footprint.h:321
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:974
const wxString & GetValue() const
Definition: footprint.h:471
FP_TEXT & Value() const
The const versions to keep the compiler happy.
Definition: footprint.h:489
The Cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:236
void SetZoneConnection(ZONE_CONNECTION aType)
Definition: footprint.h:226
unsigned GetPadCount(INCLUDE_NPTH_T aIncludeNPTH=INCLUDE_NPTH_T(INCLUDE_NPTH)) const
Return the number of pads.
Definition: footprint.cpp:1111
const KIID_PATH & GetPath() const
Definition: footprint.h:203
ZONE_CONNECTION m_zoneConnection
Definition: footprint.h:749
double m_localSolderPasteMarginRatio
Definition: footprint.h:755
SHAPE_POLY_SET m_poly_courtyard_back
Definition: footprint.h:772
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:49
int GetPlacementCost180() const
Definition: footprint.h:564
void SetPath(const KIID_PATH &aPath)
Definition: footprint.h:204
#define FP_PADS_are_LOCKED
Definition: footprint.h:290
void SetIsPlaced(bool isPlaced)
Definition: footprint.h:312
double m_orient
Definition: footprint.h:722
bool ResolveTextVar(wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the component.
Definition: footprint.cpp:477
void CheckFootprintAttributes(const std::function< void(const wxString &msg)> *aErrorHandler)
Test if footprint attributes for type (SMD/Through hole/Other) match the expected type based on the p...
Definition: footprint.cpp:2077
timestamp_t m_lastEditTime
Definition: footprint.h:760
void IncrementFlag()
Definition: footprint.h:239
void Remove(BOARD_ITEM *aItem, REMOVE_MODE aMode=REMOVE_MODE::NORMAL) override
Removes an item from the container.
Definition: footprint.cpp:566
double GetOrientation() const
Definition: footprint.h:190
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:408
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:1932
bool LegacyPadsLocked() const
Definition: footprint.h:329
Implement a canvas based on a wxGLCanvas.
Definition: eda_3d_canvas.h:48
void SetLocalSolderPasteMarginRatio(double aRatio)
Definition: footprint.h:224
void SetOrientationDegrees(double aOrientation)
Definition: footprint.h:189
FP_TEXT * m_reference
Definition: footprint.h:724
int m_visibleBBoxCacheTimeStamp
Definition: footprint.h:743
INCLUDE_NPTH_T
Definition: footprint.h:55
void SetThermalGap(int aGap)
Definition: footprint.h:232
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:1268
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:343
bool operator()(const PAD *aFirst, const PAD *aSecond) const
Definition: footprint.cpp:2154
void SetAttributes(int aAttributes)
Definition: footprint.h:236
int m_rot90Cost
Definition: footprint.h:763
PADS & Pads()
Definition: footprint.h:168
void SetPlacementCost180(int aCost)
Definition: footprint.h:565
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:2109
void Add3DModel(FP_3DMODEL *a3DModel)
Add a3DModel definition to the end of the 3D model list.
Definition: footprint.cpp:1161
FP_TEXT & Value()
read/write accessors:
Definition: footprint.h:485
FP_TEXT * m_value
Definition: footprint.h:725
PAD * GetTopLeftPad()
Definition: footprint.cpp:1092
void SetThermalWidth(int aWidth)
Definition: footprint.h:229
void SetDescription(const wxString &aDoc)
Definition: footprint.h:198
int m_arflag
Definition: footprint.h:761
KIID m_link
Definition: footprint.h:762
FP_TEXT & Reference()
Definition: footprint.h:486
const FP_ZONES & Zones() const
Definition: footprint.h:175
int m_localSolderMaskMargin
Definition: footprint.h:753
EDA_RECT m_cachedBoundingBox
Definition: footprint.h:740
int GetLikelyAttribute() const
Returns the most likely attribute based on pads Either FP_THROUGH_HOLE/FP_SMD/OTHER(0)
Definition: footprint.cpp:653
FP_ZONES & Zones()
Definition: footprint.h:174
Definition: kiid.h:44
bool m_Show
Include model in rendering.
Definition: footprint.h:98
int m_fpStatus
Definition: footprint.h:728
int GetFlag() const
Definition: footprint.h:240
virtual const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
Definition: footprint.cpp:1396
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:504
FP_ZONES m_fp_zones
Definition: footprint.h:719
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:114
bool IsBackLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a back layer.
Definition: layer_ids.h:895
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:1333
SHAPE_POLY_SET m_poly_courtyard_front
Definition: footprint.h:771
void IncrementReference(int aDelta)
Bump the current reference by aDelta.
Definition: footprint.cpp:1825
Represent a set of closed polygons.
SHAPE_POLY_SET m_cachedHull
Definition: footprint.h:746
PAD * GetPad(const wxPoint &aPosition, LSET aLayerMask=LSET::AllLayersMask())
Get a pad at aPosition on aLayerMask in the footprint.
Definition: footprint.cpp:1076
void Move(const wxPoint &aMoveVector) override
Move this object.
Definition: footprint.cpp:1440
void SetOrientation(double aNewAngle)
Definition: footprint.cpp:1662
const DRAWINGS & GraphicalItems() const
Definition: footprint.h:172
void Flip(const wxPoint &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: footprint.cpp:1472
VECTOR3D m_Scale
3D model scaling factor (dimensionless)
Definition: footprint.h:93
PAD * FindPadByNumber(const wxString &aPadNumber, PAD *aSearchAfterMe=nullptr) const
Return a PAD with a matching number.
Definition: footprint.cpp:1056
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:1172
int m_thermalGap
Definition: footprint.h:751
void SetLocalClearance(int aClearance)
Definition: footprint.h:210
int GetLocalClearance() const
Definition: footprint.h:209
bool IsNetTie() const
Definition: footprint.h:243
const PADS & Pads() const
Definition: footprint.h:169
const wxString & GetReference() const
Definition: footprint.h:449
#define _(s)
double m_Opacity
Definition: footprint.h:96
BOARD_ITEM * Duplicate() const override
Create a copy of this BOARD_ITEM.
Definition: footprint.cpp:1706
DRAWINGS & GraphicalItems()
Definition: footprint.h:171
const SHAPE_POLY_SET & GetPolyCourtyard(PCB_LAYER_ID aLayer) const
Used in DRC to test the courtyard area (a complex polygon).
Definition: footprint.h:681
void MoveAnchorPosition(const wxPoint &aMoveVector)
Move the reference point of the footprint.
Definition: footprint.cpp:1589
static LSET AllLayersMask()
Definition: lset.cpp:787
bool IsPlaced() const
Definition: footprint.h:311
const LIB_ID & GetFPID() const
Definition: footprint.h:194
const FP_GROUPS & Groups() const
Definition: footprint.h:178
An abstract shape on 2D plane.
Definition: shape.h:116
wxString GetNextPadNumber(const wxString &aLastPadName) const
Return the next available pad number in the footprint.
Definition: footprint.cpp:1805
FP_TEXT & Reference() const
Definition: footprint.h:490
wxPoint m_pos
Definition: footprint.h:723
void SetValue(const wxString &aValue)
Definition: footprint.h:479
void SetFlag(int aFlag)
Definition: footprint.h:238
void Rotate(const wxPoint &aRotCentre, double aAngle) override
Rotate this object.
Definition: footprint.cpp:1447
const wxString & GetKeywords() const
Definition: footprint.h:200
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:230
int m_boundingBoxCacheTimeStamp
Definition: footprint.h:741
#define FP_to_PLACE
In autoplace: footprint waiting for autoplace.
Definition: footprint.h:289
KIID GetLink() const
Definition: footprint.h:561
#define FP_is_LOCKED
footprint LOCKED: no autoplace allowed
Definition: footprint.h:287
class FOOTPRINT, a footprint
Definition: typeinfo.h:88
KIID_PATH m_path
Definition: footprint.h:759
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:674
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:212
bool operator()(const BOARD_ITEM *aFirst, const BOARD_ITEM *aSecond) const
Definition: footprint.cpp:2129
void GetContextualTextVars(wxArrayString *aVars) const
Return the list of system text vars for this footprint.
Definition: footprint.cpp:469
bool IsFlipped() const
Definition: footprint.h:277
FP_GROUPS & Groups()
Definition: footprint.h:177
void SetFPID(const LIB_ID &aFPID)
Definition: footprint.h:195
void SetLink(const KIID &aLink)
Definition: footprint.h:562
double GetOrientationDegrees() const
Definition: footprint.h:191
int m_thermalWidth
Definition: footprint.h:750
wxString m_keywords
Definition: footprint.h:758
int GetLocalSolderMaskMargin() const
Definition: footprint.h:206
FOOTPRINT(BOARD *parent)
Definition: footprint.cpp:51
int m_localClearance
Definition: footprint.h:752
void SetProperty(const wxString &aKey, const wxString &aVal)
Definition: footprint.h:499
VECTOR3D m_Rotation
3D model rotation (degrees)
Definition: footprint.h:94
int GetAttributes() const
Definition: footprint.h:235
int m_rot180Cost
Definition: footprint.h:764
BITMAPS
A list of all bitmap identifiers.
Definition: bitmaps_list.h:32
int m_textExcludedBBoxCacheTimeStamp
Definition: footprint.h:745
wxString GetClass() const override
Return the class name.
Definition: footprint.h:588
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:183
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:65
LIB_ID m_fpid
Definition: footprint.h:726
void SetLastEditTime(timestamp_t aTime)
Definition: footprint.h:341
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:718
void SetKeywords(const wxString &aKeywords)
Definition: footprint.h:201
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:303
FOOTPRINT & operator=(const FOOTPRINT &aOther)
Definition: footprint.cpp:365
unsigned GetUniquePadCount(INCLUDE_NPTH_T aIncludeNPTH=INCLUDE_NPTH_T(INCLUDE_NPTH)) const
Return the number of unique non-blank pads.
Definition: footprint.cpp:1130
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:744
wxString GetTypeName() const
Get the type of footprint.
Definition: footprint.cpp:683
wxPoint GetPosition() const override
Definition: footprint.h:186
double GetLocalSolderPasteMarginRatio() const
Definition: footprint.h:223
DRAWINGS m_drawings
Definition: footprint.h:717
const std::map< wxString, wxString > & GetProperties() const
Definition: footprint.h:492
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:1306
const std::function< void(const wxString &msg, BOARD_ITEM *itemA, BOARD_ITEM *itemB, const wxPoint &pt)> OUTLINE_ERROR_HANDLER
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:1280
ZONE_CONNECTION GetZoneConnection() const
Definition: footprint.h:227
int GetPlacementCost90() const
Definition: footprint.h:567
void SetLastEditTime()
Definition: footprint.h:342
std::map< wxString, wxString > m_properties
Definition: footprint.h:767
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:1414
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:997
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:220
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:68
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
Removes an item from the container.
Definition: footprint.cpp:513
void SetProperties(const std::map< wxString, wxString > &aProps)
Definition: footprint.h:493
wxArrayString * m_initial_comments
Definition: footprint.h:768
#define FP_is_PLACED
In autoplace: footprint automatically placed.
Definition: footprint.h:288
const wxString & GetProperty(const wxString &aKey)
Definition: footprint.h:494
Definition: pad.h:57
void SetPosition(const wxPoint &aPos) override
Definition: footprint.cpp:1543
SEARCH_RESULT
Definition: eda_item.h:41
FP_GROUPS m_fp_groups
Definition: footprint.h:720
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: footprint.cpp:1274
bool HasProperty(const wxString &aKey)
Definition: footprint.h:495
bool HasThroughHolePads() const
Definition: footprint.cpp:2117
wxString m_doc
Definition: footprint.h:757
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:140
bool HitTestAccurate(const wxPoint &aPosition, int aAccuracy=0) const
Test if a point is inside the bounding polygon of the footprint.
Definition: footprint.cpp:1004
int GetThermalGap() const
Definition: footprint.h:233
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:766
PADS m_pads
Definition: footprint.h:718
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:1425
int m_hullCacheTimeStamp
Definition: footprint.h:747
void SetPlacementCost90(int aCost)
Definition: footprint.h:568
int m_attributes
Definition: footprint.h:727
void SetLocalSolderMaskMargin(int aMargin)
Definition: footprint.h:207
EDA_RECT GetFpPadsLocalBbox() const
Return the bounding box containing pads when the footprint is on the front side, orientation 0,...
Definition: footprint.cpp:695
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:1998
void SetLocalSolderPasteMargin(int aMargin)
Definition: footprint.h:221