2012-01-14 19:50:32 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2015-02-18 09:13:17 +00:00
|
|
|
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2023-03-30 11:49:23 +00:00
|
|
|
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
2012-01-14 19:50:32 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2020-11-13 00:43:45 +00:00
|
|
|
#ifndef FOOTPRINT_H
|
|
|
|
#define FOOTPRINT_H
|
2011-08-01 15:29:27 +00:00
|
|
|
|
2019-06-01 23:23:36 +00:00
|
|
|
#include <deque>
|
2011-08-01 15:29:27 +00:00
|
|
|
|
2023-05-24 12:39:25 +00:00
|
|
|
#include <template_fieldnames.h>
|
|
|
|
|
2016-05-13 15:31:54 +00:00
|
|
|
#include <board_item_container.h>
|
2020-11-14 18:11:28 +00:00
|
|
|
#include <board_item.h>
|
2018-02-22 10:10:48 +00:00
|
|
|
#include <collectors.h>
|
2021-07-29 09:47:43 +00:00
|
|
|
#include <layer_ids.h> // ALL_LAYERS definition.
|
2016-11-20 23:35:08 +00:00
|
|
|
#include <lib_id.h>
|
2019-05-14 12:39:34 +00:00
|
|
|
#include <list>
|
2011-01-14 17:43:30 +00:00
|
|
|
|
2020-11-21 20:42:27 +00:00
|
|
|
#include <zones.h>
|
2021-07-14 20:03:32 +00:00
|
|
|
#include <convert_shape_list_to_polygon.h>
|
2021-06-03 18:05:43 +00:00
|
|
|
#include <pcb_item_containers.h>
|
2023-03-30 11:49:23 +00:00
|
|
|
#include <pcb_text.h>
|
2023-05-24 12:39:25 +00:00
|
|
|
#include <pcb_field.h>
|
2016-06-29 10:23:11 +00:00
|
|
|
#include <functional>
|
2022-10-08 22:00:05 +00:00
|
|
|
#include <math/vector3.h>
|
2013-09-08 18:31:21 +00:00
|
|
|
|
2011-09-23 13:57:12 +00:00
|
|
|
class LINE_READER;
|
2011-09-17 15:31:21 +00:00
|
|
|
class EDA_3D_CANVAS;
|
2020-11-12 22:30:02 +00:00
|
|
|
class PAD;
|
2011-09-23 13:57:12 +00:00
|
|
|
class BOARD;
|
2013-01-12 17:32:24 +00:00
|
|
|
class MSG_PANEL_ITEM;
|
2020-08-26 22:04:16 +00:00
|
|
|
class SHAPE;
|
2023-03-06 23:05:44 +00:00
|
|
|
class REPORTER;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2017-04-25 09:06:24 +00:00
|
|
|
namespace KIGFX {
|
|
|
|
class VIEW;
|
2017-11-02 20:41:29 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2015-01-04 07:19:04 +00:00
|
|
|
enum INCLUDE_NPTH_T
|
|
|
|
{
|
|
|
|
DO_NOT_INCLUDE_NPTH = false,
|
|
|
|
INCLUDE_NPTH = true
|
|
|
|
};
|
|
|
|
|
2011-12-12 08:37:05 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* The set of attributes allowed within a FOOTPRINT, using FOOTPRINT::SetAttributes()
|
2020-11-13 02:09:34 +00:00
|
|
|
* and FOOTPRINT::GetAttributes(). These are to be ORed together when calling
|
|
|
|
* FOOTPRINT::SetAttributes()
|
2011-12-12 08:37:05 +00:00
|
|
|
*/
|
2020-11-13 02:09:34 +00:00
|
|
|
enum FOOTPRINT_ATTR_T
|
2007-06-15 16:08:55 +00:00
|
|
|
{
|
2021-12-07 19:24:26 +00:00
|
|
|
FP_THROUGH_HOLE = 0x0001,
|
|
|
|
FP_SMD = 0x0002,
|
|
|
|
FP_EXCLUDE_FROM_POS_FILES = 0x0004,
|
|
|
|
FP_EXCLUDE_FROM_BOM = 0x0008,
|
|
|
|
FP_BOARD_ONLY = 0x0010, // Footprint has no corresponding symbol
|
|
|
|
FP_JUST_ADDED = 0x0020, // Footprint just added by netlist update
|
|
|
|
FP_ALLOW_SOLDERMASK_BRIDGES = 0x0040,
|
2023-04-10 17:10:42 +00:00
|
|
|
FP_ALLOW_MISSING_COURTYARD = 0x0080,
|
|
|
|
FP_DNP = 0x0100
|
2007-06-15 16:08:55 +00:00
|
|
|
};
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2020-11-13 00:43:45 +00:00
|
|
|
class FP_3DMODEL
|
2017-10-27 14:25:20 +00:00
|
|
|
{
|
2020-08-26 21:43:38 +00:00
|
|
|
public:
|
2020-11-13 00:43:45 +00:00
|
|
|
FP_3DMODEL() :
|
2020-08-26 21:43:38 +00:00
|
|
|
// Initialize with sensible values
|
|
|
|
m_Scale { 1, 1, 1 },
|
|
|
|
m_Rotation { 0, 0, 0 },
|
|
|
|
m_Offset { 0, 0, 0 },
|
|
|
|
m_Opacity( 1.0 ),
|
|
|
|
m_Show( true )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
VECTOR3D m_Scale; ///< 3D model scaling factor (dimensionless)
|
|
|
|
VECTOR3D m_Rotation; ///< 3D model rotation (degrees)
|
|
|
|
VECTOR3D m_Offset; ///< 3D model offset (mm)
|
|
|
|
double m_Opacity;
|
|
|
|
wxString m_Filename; ///< The 3D shape filename in 3D library
|
2020-11-13 02:57:11 +00:00
|
|
|
bool m_Show; ///< Include model in rendering
|
2017-10-27 14:25:20 +00:00
|
|
|
};
|
2007-08-07 06:21:19 +00:00
|
|
|
|
2019-06-01 23:23:36 +00:00
|
|
|
|
2020-11-13 15:15:52 +00:00
|
|
|
class FOOTPRINT : public BOARD_ITEM_CONTAINER
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
|
|
|
public:
|
2020-11-13 15:15:52 +00:00
|
|
|
FOOTPRINT( BOARD* parent );
|
2012-01-14 19:50:32 +00:00
|
|
|
|
2022-07-31 21:14:24 +00:00
|
|
|
FOOTPRINT( const FOOTPRINT& aFootprint );
|
2012-01-14 19:50:32 +00:00
|
|
|
|
2020-11-13 02:57:11 +00:00
|
|
|
// Move constructor and operator needed due to std containers inside the footprint
|
2020-11-13 15:15:52 +00:00
|
|
|
FOOTPRINT( FOOTPRINT&& aFootprint );
|
2020-07-16 01:11:51 +00:00
|
|
|
|
2020-11-13 15:15:52 +00:00
|
|
|
~FOOTPRINT();
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2020-11-13 15:15:52 +00:00
|
|
|
FOOTPRINT& operator=( const FOOTPRINT& aOther );
|
|
|
|
FOOTPRINT& operator=( FOOTPRINT&& aOther );
|
2016-05-31 08:27:52 +00:00
|
|
|
|
2014-06-06 09:44:21 +00:00
|
|
|
static inline bool ClassOf( const EDA_ITEM* aItem )
|
|
|
|
{
|
2020-11-13 12:21:02 +00:00
|
|
|
return aItem && aItem->Type() == PCB_FOOTPRINT_T;
|
2014-06-06 09:44:21 +00:00
|
|
|
}
|
|
|
|
|
2021-12-05 21:56:55 +00:00
|
|
|
LSET GetPrivateLayers() const { return m_privateLayers; }
|
|
|
|
void SetPrivateLayers( LSET aLayers ) { m_privateLayers = aLayers; }
|
|
|
|
|
2021-01-27 22:15:38 +00:00
|
|
|
///< @copydoc BOARD_ITEM_CONTAINER::Add()
|
2022-02-18 12:23:50 +00:00
|
|
|
void Add( BOARD_ITEM* aItem, ADD_MODE aMode = ADD_MODE::INSERT,
|
|
|
|
bool aSkipConnectivity = false ) override;
|
2014-07-09 12:22:29 +00:00
|
|
|
|
2021-01-27 22:15:38 +00:00
|
|
|
///< @copydoc BOARD_ITEM_CONTAINER::Remove()
|
2020-12-07 23:29:30 +00:00
|
|
|
void Remove( BOARD_ITEM* aItem, REMOVE_MODE aMode = REMOVE_MODE::NORMAL ) override;
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2015-02-18 09:13:17 +00:00
|
|
|
/**
|
|
|
|
* Clear (i.e. force the ORPHANED dummy net info) the net info which
|
|
|
|
* depends on a given board for all pads of the footprint.
|
2021-01-27 22:15:38 +00:00
|
|
|
*
|
2015-02-18 09:13:17 +00:00
|
|
|
* This is needed when a footprint is copied between the fp editor and
|
|
|
|
* the board editor for instance, because net info become fully broken
|
|
|
|
*/
|
|
|
|
void ClearAllNets();
|
|
|
|
|
2021-08-04 10:37:52 +00:00
|
|
|
/**
|
Fix typos in pcbnew sub-directory
Found via `codespell -q 3 -S *.po,./thirdparty,./Documentation/changelogs -L aactual,acount,aline,alocation,alog,anormal,anumber,aother,apoints,aparent,aray,ba,busses,dout,einstance,leaded,modul,ontext,ot,overide,serie,te,,tesselate,tesselator,tht`
2022-06-29 20:21:10 +00:00
|
|
|
* Old footprints do not always have a valid UUID (some can be set to null uuid)
|
2021-08-04 10:37:52 +00:00
|
|
|
* However null UUIDs, having a special meaning in editor, create issues when
|
|
|
|
* editing a footprint
|
|
|
|
* So all null uuids a re replaced by a valid uuid
|
|
|
|
* @return true if at least one uuid is changed, false if no change
|
|
|
|
*/
|
|
|
|
bool FixUuids();
|
|
|
|
|
2019-11-01 12:35:42 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Return the bounding box containing pads when the footprint is on the front side,
|
|
|
|
* orientation 0, position 0,0.
|
|
|
|
*
|
|
|
|
* Mainly used in Gerber place file to draw a footprint outline when the courtyard
|
|
|
|
* is missing or broken.
|
|
|
|
*
|
|
|
|
* @return The rectangle containing the pads for the normalized footprint.
|
2019-11-01 12:35:42 +00:00
|
|
|
*/
|
2022-08-30 23:28:18 +00:00
|
|
|
BOX2I GetFpPadsLocalBbox() const;
|
2019-11-01 12:35:42 +00:00
|
|
|
|
2018-02-19 00:00:29 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Return a bounding polygon for the shapes and pads in the footprint.
|
|
|
|
*
|
|
|
|
* This operation is slower but more accurate than calculating a bounding box.
|
2018-02-19 00:00:29 +00:00
|
|
|
*/
|
2020-11-29 14:00:39 +00:00
|
|
|
SHAPE_POLY_SET GetBoundingHull() const;
|
2018-02-19 00:00:29 +00:00
|
|
|
|
2013-11-24 17:48:14 +00:00
|
|
|
// Virtual function
|
2022-08-31 09:15:42 +00:00
|
|
|
const BOX2I GetBoundingBox() const override;
|
2022-08-31 16:17:14 +00:00
|
|
|
const BOX2I GetBoundingBox( bool aIncludeText, bool aIncludeInvisibleText ) const;
|
2019-08-20 11:58:14 +00:00
|
|
|
|
2023-08-03 16:59:24 +00:00
|
|
|
/**
|
|
|
|
* Return the bounding box of the footprint on a given set of layers
|
|
|
|
*/
|
|
|
|
const BOX2I GetLayerBoundingBox( LSET aLayers ) const;
|
|
|
|
|
2023-07-16 17:01:32 +00:00
|
|
|
VECTOR2I GetCenter() const override
|
|
|
|
{
|
|
|
|
return GetBoundingBox( false, false ).GetCenter();
|
|
|
|
}
|
|
|
|
|
2023-05-24 12:39:25 +00:00
|
|
|
PCB_FIELDS& Fields() { return m_fields; }
|
|
|
|
const PCB_FIELDS& Fields() const { return m_fields; }
|
|
|
|
|
2023-03-30 11:49:23 +00:00
|
|
|
PADS& Pads() { return m_pads; }
|
|
|
|
const PADS& Pads() const { return m_pads; }
|
2019-06-01 23:23:36 +00:00
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
DRAWINGS& GraphicalItems() { return m_drawings; }
|
2020-10-03 11:16:29 +00:00
|
|
|
const DRAWINGS& GraphicalItems() const { return m_drawings; }
|
2013-03-18 19:36:07 +00:00
|
|
|
|
2023-03-30 11:49:23 +00:00
|
|
|
ZONES& Zones() { return m_zones; }
|
|
|
|
const ZONES& Zones() const { return m_zones; }
|
2019-06-02 03:55:32 +00:00
|
|
|
|
2023-03-30 11:49:23 +00:00
|
|
|
GROUPS& Groups() { return m_groups; }
|
|
|
|
const GROUPS& Groups() const { return m_groups; }
|
2017-03-22 13:11:08 +00:00
|
|
|
|
2020-08-26 21:43:38 +00:00
|
|
|
bool HasThroughHolePads() const;
|
2019-09-15 09:10:53 +00:00
|
|
|
|
2021-07-11 11:49:36 +00:00
|
|
|
std::vector<FP_3DMODEL>& Models() { return m_3D_Drawings; }
|
|
|
|
const std::vector<FP_3DMODEL>& Models() const { return m_3D_Drawings; }
|
2013-03-18 19:36:07 +00:00
|
|
|
|
2022-01-01 06:04:08 +00:00
|
|
|
void SetPosition( const VECTOR2I& aPos ) override;
|
|
|
|
VECTOR2I GetPosition() const override { return m_pos; }
|
2007-12-01 03:42:52 +00:00
|
|
|
|
2022-01-13 17:27:36 +00:00
|
|
|
void SetOrientation( const EDA_ANGLE& aNewAngle );
|
|
|
|
EDA_ANGLE GetOrientation() const { return m_orient; }
|
|
|
|
|
2022-11-25 03:11:26 +00:00
|
|
|
/**
|
|
|
|
* Used as Layer property setter -- performs a flip if necessary to set the footprint layer
|
|
|
|
* @param aLayer is the target layer (F_Cu or B_Cu)
|
|
|
|
*/
|
|
|
|
void SetLayerAndFlip( PCB_LAYER_ID aLayer );
|
|
|
|
|
|
|
|
// to make property magic work
|
|
|
|
PCB_LAYER_ID GetLayer() const override { return BOARD_ITEM::GetLayer(); }
|
|
|
|
|
2022-01-13 17:27:36 +00:00
|
|
|
// For property system:
|
|
|
|
void SetOrientationDegrees( double aOrientation )
|
|
|
|
{
|
|
|
|
SetOrientation( EDA_ANGLE( aOrientation, DEGREES_T ) );
|
|
|
|
}
|
|
|
|
double GetOrientationDegrees() const
|
|
|
|
{
|
|
|
|
return m_orient.AsDegrees();
|
|
|
|
}
|
2011-11-29 17:25:30 +00:00
|
|
|
|
2016-11-20 23:35:08 +00:00
|
|
|
const LIB_ID& GetFPID() const { return m_fpid; }
|
|
|
|
void SetFPID( const LIB_ID& aFPID ) { m_fpid = aFPID; }
|
2011-12-12 08:37:05 +00:00
|
|
|
|
2022-10-15 18:36:08 +00:00
|
|
|
wxString GetFPIDAsString() const { return m_fpid.Format(); }
|
2022-06-01 11:47:03 +00:00
|
|
|
void SetFPIDAsString( const wxString& aFPID ) { m_fpid.Parse( aFPID ); }
|
|
|
|
|
2023-06-19 17:08:18 +00:00
|
|
|
wxString GetLibDescription() const { return m_libDescription; }
|
|
|
|
void SetLibDescription( const wxString& aDesc ) { m_libDescription = aDesc; }
|
2011-12-12 08:37:05 +00:00
|
|
|
|
2022-10-15 18:36:08 +00:00
|
|
|
wxString GetKeywords() const { return m_keywords; }
|
2020-11-13 02:57:11 +00:00
|
|
|
void SetKeywords( const wxString& aKeywords ) { m_keywords = aKeywords; }
|
2011-12-12 08:37:05 +00:00
|
|
|
|
2020-11-13 02:57:11 +00:00
|
|
|
const KIID_PATH& GetPath() const { return m_path; }
|
|
|
|
void SetPath( const KIID_PATH& aPath ) { m_path = aPath; }
|
2011-12-12 08:37:05 +00:00
|
|
|
|
2023-06-19 13:26:33 +00:00
|
|
|
wxString GetSheetname() const { return m_sheetname; }
|
|
|
|
void SetSheetname( const wxString& aSheetname ) { m_sheetname = aSheetname; }
|
|
|
|
|
|
|
|
wxString GetSheetfile() const { return m_sheetfile; }
|
|
|
|
void SetSheetfile( const wxString& aSheetfile ) { m_sheetfile = aSheetfile; }
|
|
|
|
|
2023-09-29 16:02:57 +00:00
|
|
|
wxString GetFilters() const { return m_filters; }
|
|
|
|
void SetFilters( const wxString& aFilters ) { m_filters = aFilters; }
|
|
|
|
|
2020-11-13 02:57:11 +00:00
|
|
|
int GetLocalSolderMaskMargin() const { return m_localSolderMaskMargin; }
|
|
|
|
void SetLocalSolderMaskMargin( int aMargin ) { m_localSolderMaskMargin = aMargin; }
|
2011-12-12 08:37:05 +00:00
|
|
|
|
2020-11-13 02:57:11 +00:00
|
|
|
int GetLocalClearance() const { return m_localClearance; }
|
|
|
|
void SetLocalClearance( int aClearance ) { m_localClearance = aClearance; }
|
2020-07-19 21:22:49 +00:00
|
|
|
|
|
|
|
int GetLocalClearance( wxString* aSource ) const
|
2020-05-29 12:36:45 +00:00
|
|
|
{
|
|
|
|
if( aSource )
|
|
|
|
*aSource = wxString::Format( _( "footprint %s" ), GetReference() );
|
|
|
|
|
2020-11-13 02:57:11 +00:00
|
|
|
return m_localClearance;
|
2020-05-29 12:36:45 +00:00
|
|
|
}
|
|
|
|
|
2020-11-13 02:57:11 +00:00
|
|
|
int GetLocalSolderPasteMargin() const { return m_localSolderPasteMargin; }
|
|
|
|
void SetLocalSolderPasteMargin( int aMargin ) { m_localSolderPasteMargin = aMargin; }
|
2011-12-12 08:37:05 +00:00
|
|
|
|
2020-11-13 02:57:11 +00:00
|
|
|
double GetLocalSolderPasteMarginRatio() const { return m_localSolderPasteMarginRatio; }
|
|
|
|
void SetLocalSolderPasteMarginRatio( double aRatio ) { m_localSolderPasteMarginRatio = aRatio; }
|
2011-12-12 08:37:05 +00:00
|
|
|
|
2020-11-13 02:57:11 +00:00
|
|
|
void SetZoneConnection( ZONE_CONNECTION aType ) { m_zoneConnection = aType; }
|
|
|
|
ZONE_CONNECTION GetZoneConnection() const { return m_zoneConnection; }
|
2012-02-24 23:23:46 +00:00
|
|
|
|
2020-11-13 02:57:11 +00:00
|
|
|
int GetAttributes() const { return m_attributes; }
|
|
|
|
void SetAttributes( int aAttributes ) { m_attributes = aAttributes; }
|
2011-12-12 08:37:05 +00:00
|
|
|
|
2015-03-23 08:28:12 +00:00
|
|
|
void SetFlag( int aFlag ) { m_arflag = aFlag; }
|
|
|
|
void IncrementFlag() { m_arflag += 1; }
|
|
|
|
int GetFlag() const { return m_arflag; }
|
2013-03-13 18:53:58 +00:00
|
|
|
|
2021-04-09 12:48:59 +00:00
|
|
|
bool IsNetTie() const
|
|
|
|
{
|
2022-08-19 17:34:53 +00:00
|
|
|
for( const wxString& group : m_netTiePadGroups )
|
|
|
|
{
|
|
|
|
if( !group.IsEmpty() )
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2022-09-25 16:23:14 +00:00
|
|
|
* @return a list of pad groups, each of which is allowed to short nets within their group.
|
|
|
|
* A pad group is a comma-separated list of pad numbers.
|
2022-08-19 17:34:53 +00:00
|
|
|
*/
|
|
|
|
const std::vector<wxString>& GetNetTiePadGroups() const { return m_netTiePadGroups; }
|
|
|
|
|
|
|
|
void ClearNetTiePadGroups()
|
|
|
|
{
|
|
|
|
m_netTiePadGroups.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
void AddNetTiePadGroup( const wxString& aGroup )
|
|
|
|
{
|
|
|
|
m_netTiePadGroups.emplace_back( aGroup );
|
2021-04-09 12:48:59 +00:00
|
|
|
}
|
|
|
|
|
2022-09-25 16:23:14 +00:00
|
|
|
/**
|
2023-01-18 01:36:05 +00:00
|
|
|
* @return a map from pad numbers to net-tie group indices. If a pad is not a member of
|
2022-09-25 16:23:14 +00:00
|
|
|
* a net-tie group its index will be -1.
|
|
|
|
*/
|
|
|
|
std::map<wxString, int> MapPadNumbersToNetTieGroups() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return a list of pads that appear in \a aPad's net-tie pad group.
|
|
|
|
*/
|
|
|
|
std::vector<PAD*> GetNetTiePads( PAD* aPad ) const;
|
|
|
|
|
2021-09-24 16:15:54 +00:00
|
|
|
/**
|
|
|
|
* Returns the most likely attribute based on pads
|
|
|
|
* Either FP_THROUGH_HOLE/FP_SMD/OTHER(0)
|
|
|
|
* @return 0/FP_SMD/FP_THROUGH_HOLE
|
|
|
|
*/
|
|
|
|
int GetLikelyAttribute() const;
|
|
|
|
|
2022-01-01 06:04:08 +00:00
|
|
|
void Move( const VECTOR2I& aMoveVector ) override;
|
2007-06-15 16:08:55 +00:00
|
|
|
|
2022-01-13 19:32:00 +00:00
|
|
|
void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override;
|
2009-08-01 19:26:05 +00:00
|
|
|
|
2022-01-01 06:04:08 +00:00
|
|
|
void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) override;
|
2007-06-15 16:08:55 +00:00
|
|
|
|
2013-03-23 13:30:00 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Move the reference point of the footprint.
|
|
|
|
*
|
2013-03-23 13:30:00 +00:00
|
|
|
* It looks like a move footprint:
|
|
|
|
* the footprints elements (pads, outlines, edges .. ) are moved
|
|
|
|
* However:
|
|
|
|
* - the footprint position is not modified.
|
|
|
|
* - the relative (local) coordinates of these items are modified
|
|
|
|
* (a move footprint does not change these local coordinates,
|
|
|
|
* but changes the footprint position)
|
|
|
|
*/
|
2022-01-01 06:04:08 +00:00
|
|
|
void MoveAnchorPosition( const VECTOR2I& aMoveVector );
|
2013-03-23 13:30:00 +00:00
|
|
|
|
2012-09-11 07:33:17 +00:00
|
|
|
/**
|
2020-11-13 02:57:11 +00:00
|
|
|
* @return true if the footprint is flipped, i.e. on the back side of the board
|
2012-09-11 07:33:17 +00:00
|
|
|
*/
|
2017-04-25 09:06:24 +00:00
|
|
|
bool IsFlipped() const { return GetLayer() == B_Cu; }
|
2012-09-11 07:33:17 +00:00
|
|
|
|
2020-11-26 19:45:22 +00:00
|
|
|
/**
|
2023-08-01 17:37:19 +00:00
|
|
|
* @copydoc BOARD_ITEM::IsOnLayer
|
2020-11-26 19:45:22 +00:00
|
|
|
*/
|
2023-08-01 17:37:19 +00:00
|
|
|
bool IsOnLayer( PCB_LAYER_ID aLayer ) const override;
|
2020-11-26 19:45:22 +00:00
|
|
|
|
2020-11-13 02:57:11 +00:00
|
|
|
// m_footprintStatus bits:
|
|
|
|
#define FP_is_LOCKED 0x01 ///< footprint LOCKED: no autoplace allowed
|
|
|
|
#define FP_is_PLACED 0x02 ///< In autoplace: footprint automatically placed
|
|
|
|
#define FP_to_PLACE 0x04 ///< In autoplace: footprint waiting for autoplace
|
|
|
|
#define FP_PADS_are_LOCKED 0x08
|
2013-03-18 19:36:07 +00:00
|
|
|
|
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
bool IsLocked() const override
|
2007-06-15 16:08:55 +00:00
|
|
|
{
|
2020-11-13 11:17:15 +00:00
|
|
|
return ( m_fpStatus & FP_is_LOCKED ) != 0;
|
2007-06-15 16:08:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Set the #MODULE_is_LOCKED bit in the m_ModuleStatus.
|
|
|
|
*
|
|
|
|
* @param isLocked true means turn on locked status, else unlock
|
2007-06-15 16:08:55 +00:00
|
|
|
*/
|
2016-09-24 18:53:15 +00:00
|
|
|
void SetLocked( bool isLocked ) override
|
2007-06-15 16:08:55 +00:00
|
|
|
{
|
2011-12-12 08:37:05 +00:00
|
|
|
if( isLocked )
|
2020-11-13 11:17:15 +00:00
|
|
|
m_fpStatus |= FP_is_LOCKED;
|
2007-06-15 16:08:55 +00:00
|
|
|
else
|
2020-11-13 11:17:15 +00:00
|
|
|
m_fpStatus &= ~FP_is_LOCKED;
|
2007-06-15 16:08:55 +00:00
|
|
|
}
|
|
|
|
|
2022-05-20 09:08:33 +00:00
|
|
|
/**
|
|
|
|
* @return true if the footprint is flagged with conflicting with some item
|
|
|
|
*/
|
|
|
|
bool IsConflicting() const;
|
|
|
|
|
2020-11-13 11:17:15 +00:00
|
|
|
bool IsPlaced() const { return m_fpStatus & FP_is_PLACED; }
|
2011-12-01 06:04:23 +00:00
|
|
|
void SetIsPlaced( bool isPlaced )
|
|
|
|
{
|
|
|
|
if( isPlaced )
|
2020-11-13 11:17:15 +00:00
|
|
|
m_fpStatus |= FP_is_PLACED;
|
2011-12-01 06:04:23 +00:00
|
|
|
else
|
2020-11-13 11:17:15 +00:00
|
|
|
m_fpStatus &= ~FP_is_PLACED;
|
2011-12-01 06:04:23 +00:00
|
|
|
}
|
|
|
|
|
2020-11-13 11:17:15 +00:00
|
|
|
bool NeedsPlaced() const { return m_fpStatus & FP_to_PLACE; }
|
2013-03-13 18:53:58 +00:00
|
|
|
void SetNeedsPlaced( bool needsPlaced )
|
|
|
|
{
|
|
|
|
if( needsPlaced )
|
2020-11-13 11:17:15 +00:00
|
|
|
m_fpStatus |= FP_to_PLACE;
|
2013-03-13 18:53:58 +00:00
|
|
|
else
|
2020-11-13 11:17:15 +00:00
|
|
|
m_fpStatus &= ~FP_to_PLACE;
|
2013-03-13 18:53:58 +00:00
|
|
|
}
|
|
|
|
|
2021-01-08 16:32:28 +00:00
|
|
|
bool LegacyPadsLocked() const { return m_fpStatus & FP_PADS_are_LOCKED; }
|
2015-02-18 16:53:46 +00:00
|
|
|
|
2021-09-25 15:55:33 +00:00
|
|
|
/**
|
|
|
|
* Test if footprint attributes for type (SMD/Through hole/Other) match the expected
|
|
|
|
* type based on the pads in the footprint.
|
2022-03-18 19:35:40 +00:00
|
|
|
* Footprints with plated through-hole pads should usually be marked through hole even if they
|
|
|
|
* also have SMD because they might not be auto-placed. Exceptions to this might be shielded
|
|
|
|
* connectors. Otherwise, footprints with SMD pads should be marked SMD.
|
2021-09-25 15:55:33 +00:00
|
|
|
* Footprints with no connecting pads should be marked "Other"
|
|
|
|
*
|
|
|
|
* @param aErrorHandler callback to handle the error messages generated
|
|
|
|
*/
|
2022-03-18 19:35:40 +00:00
|
|
|
void CheckFootprintAttributes( const std::function<void( const wxString& )>& aErrorHandler );
|
2021-09-25 15:55:33 +00:00
|
|
|
|
2021-10-19 11:24:30 +00:00
|
|
|
/**
|
2022-03-19 00:17:07 +00:00
|
|
|
* Run non-board-specific DRC checks on footprint's pads. These are the checks supported by
|
|
|
|
* both the PCB DRC and the Footprint Editor Footprint Checker.
|
2021-10-19 11:24:30 +00:00
|
|
|
*
|
|
|
|
* @param aErrorHandler callback to handle the error messages generated
|
|
|
|
*/
|
2022-03-18 19:35:40 +00:00
|
|
|
void CheckPads( const std::function<void( const PAD*, int, const wxString& )>& aErrorHandler );
|
|
|
|
|
2022-03-19 00:17:07 +00:00
|
|
|
/**
|
2022-09-25 16:23:14 +00:00
|
|
|
* Check for overlapping, different-numbered, non-net-tie pads.
|
2022-03-19 00:17:07 +00:00
|
|
|
*
|
|
|
|
* @param aErrorHandler callback to handle the error messages generated
|
|
|
|
*/
|
2022-09-25 16:23:14 +00:00
|
|
|
void CheckShortingPads( const std::function<void( const PAD*,
|
|
|
|
const PAD*,
|
|
|
|
const VECTOR2I& )>& aErrorHandler );
|
2021-10-19 11:24:30 +00:00
|
|
|
|
2022-08-19 17:34:53 +00:00
|
|
|
/**
|
|
|
|
* Check for un-allowed shorting of pads in net-tie footprints. If two pads are shorted,
|
|
|
|
* they must both appear in one of the allowed-shorting lists.
|
|
|
|
*
|
|
|
|
* @param aErrorHandler callback to handle the error messages generated
|
|
|
|
*/
|
|
|
|
void CheckNetTies( const std::function<void( const BOARD_ITEM* aItem,
|
|
|
|
const BOARD_ITEM* bItem,
|
|
|
|
const BOARD_ITEM* cItem,
|
|
|
|
const VECTOR2I& )>& aErrorHandler );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sanity check net-tie pad groups. Pads cannot be listed more than once, and pad numbers
|
|
|
|
* must correspond to a pad.
|
|
|
|
*
|
|
|
|
* @param aErrorHandler callback to handle the error messages generated
|
|
|
|
*/
|
|
|
|
void CheckNetTiePadGroups( const std::function<void( const wxString& )>& aErrorHandler );
|
|
|
|
|
2013-05-01 19:01:14 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Generate pads shapes on layer \a aLayer as polygons and adds these polygons to
|
2022-10-21 12:48:45 +00:00
|
|
|
* \a aBuffer.
|
2021-01-27 22:15:38 +00:00
|
|
|
*
|
2020-05-03 10:27:33 +00:00
|
|
|
* Useful to generate a polygonal representation of a footprint in 3D view and plot functions,
|
2021-01-27 22:15:38 +00:00
|
|
|
* when a full polygonal approach is needed.
|
|
|
|
*
|
|
|
|
* @param aLayer is the layer to consider, or #UNDEFINED_LAYER to consider all layers.
|
2022-10-21 12:48:45 +00:00
|
|
|
* @param aBuffer i the buffer to store polygons.
|
2021-01-27 22:15:38 +00:00
|
|
|
* @param aClearance is an additional size to add to pad shapes.
|
|
|
|
* @param aMaxError is the maximum deviation from true for arcs.
|
|
|
|
* @param aSkipNPTHPadsWihNoCopper if true, do not add a NPTH pad shape, if the shape has
|
2020-05-03 10:27:33 +00:00
|
|
|
* same size and position as the hole. Usually, these pads are not drawn on copper
|
|
|
|
* layers, because there is actually no copper
|
|
|
|
* Due to diff between layers and holes, these pads must be skipped to be sure
|
|
|
|
* there is no copper left on the board (for instance when creating Gerber Files or
|
|
|
|
* 3D shapes). Defaults to false.
|
2021-01-27 22:15:38 +00:00
|
|
|
* @param aSkipPlatedPads is used on 3D-Viewer to extract plated and non-plated pads.
|
|
|
|
* @param aSkipNonPlatedPads is used on 3D-Viewer to extract plated and plated pads.
|
2013-05-01 19:01:14 +00:00
|
|
|
*/
|
2022-10-21 12:48:45 +00:00
|
|
|
void TransformPadsToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
|
|
|
|
int aMaxError, ERROR_LOC aErrorLoc,
|
|
|
|
bool aSkipNPTHPadsWihNoCopper = false,
|
|
|
|
bool aSkipPlatedPads = false,
|
|
|
|
bool aSkipNonPlatedPads = false ) const;
|
2013-05-01 19:01:14 +00:00
|
|
|
|
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Generate shapes of graphic items (outlines) on layer \a aLayer as polygons and adds these
|
2022-10-21 12:48:45 +00:00
|
|
|
* polygons to \a aBuffer.
|
2021-01-27 22:15:38 +00:00
|
|
|
*
|
2020-05-03 10:27:33 +00:00
|
|
|
* Useful to generate a polygonal representation of a footprint in 3D view and plot functions,
|
2021-01-27 22:15:38 +00:00
|
|
|
* when a full polygonal approach is needed.
|
|
|
|
*
|
|
|
|
* @param aLayer is the layer to consider, or #UNDEFINED_LAYER to consider all.
|
2022-10-21 12:48:45 +00:00
|
|
|
* @param aBuffer is the buffer to store polygons.
|
2021-01-27 22:15:38 +00:00
|
|
|
* @param aClearance is a value to inflate shapes.
|
|
|
|
* @param aError is the maximum error between true arc and polygon approximation.
|
|
|
|
* @param aIncludeText set to true to transform text shapes.
|
|
|
|
* @param aIncludeShapes set to true to transform footprint shapes.
|
2013-05-01 19:01:14 +00:00
|
|
|
*/
|
2022-10-21 12:48:45 +00:00
|
|
|
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;
|
2016-07-19 17:35:25 +00:00
|
|
|
|
|
|
|
/**
|
2022-10-21 12:48:45 +00:00
|
|
|
* This function is the same as TransformFPShapesToPolySet but only generates text.
|
2016-07-19 17:35:25 +00:00
|
|
|
*/
|
2022-10-21 12:48:45 +00:00
|
|
|
void TransformFPTextToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
|
|
|
|
int aError, ERROR_LOC aErrorLoc ) const
|
2020-04-13 19:55:27 +00:00
|
|
|
{
|
2022-10-21 12:48:45 +00:00
|
|
|
TransformFPShapesToPolySet( aBuffer, aLayer, aClearance, aError, aErrorLoc, true, false );
|
2020-04-13 19:55:27 +00:00
|
|
|
}
|
2013-05-01 19:01:14 +00:00
|
|
|
|
2020-05-27 22:28:36 +00:00
|
|
|
/**
|
|
|
|
* Return the list of system text vars for this footprint.
|
|
|
|
*/
|
|
|
|
void GetContextualTextVars( wxArrayString* aVars ) const;
|
|
|
|
|
2020-04-06 13:06:57 +00:00
|
|
|
/**
|
|
|
|
* Resolve any references to system tokens supported by the component.
|
2021-01-27 22:15:38 +00:00
|
|
|
*
|
2020-04-06 13:06:57 +00:00
|
|
|
* @param aDepth a counter to limit recursion and circular references.
|
|
|
|
*/
|
|
|
|
bool ResolveTextVar( wxString* token, int aDepth = 0 ) const;
|
|
|
|
|
2023-03-24 13:02:13 +00:00
|
|
|
/// @copydoc EDA_ITEM::GetMsgPanelInfo
|
2020-04-24 13:36:10 +00:00
|
|
|
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2022-01-01 06:04:08 +00:00
|
|
|
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
|
2007-08-08 03:50:44 +00:00
|
|
|
|
2018-02-19 00:00:29 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Test if a point is inside the bounding polygon of the footprint.
|
2018-02-19 00:00:29 +00:00
|
|
|
*
|
2021-01-27 22:15:38 +00:00
|
|
|
* The other hit test methods are just checking the bounding box, which can be quite
|
|
|
|
* inaccurate for rotated or oddly-shaped footprints.
|
2018-02-19 00:00:29 +00:00
|
|
|
*
|
|
|
|
* @param aPosition is the point to test
|
|
|
|
* @return true if aPosition is inside the bounding polygon
|
|
|
|
*/
|
2022-01-01 06:04:08 +00:00
|
|
|
bool HitTestAccurate( const VECTOR2I& aPosition, int aAccuracy = 0 ) const;
|
2018-02-19 00:00:29 +00:00
|
|
|
|
2022-08-31 09:33:46 +00:00
|
|
|
bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
2008-01-06 12:43:57 +00:00
|
|
|
|
2023-08-01 17:37:19 +00:00
|
|
|
/**
|
|
|
|
* Test if the point hits one or more of the footprint elements on a given layer.
|
|
|
|
*
|
|
|
|
* @param aPosition is the point to test
|
|
|
|
* @param aAccuracy is the hit test accuracy
|
|
|
|
* @param aLayer is the layer to test
|
|
|
|
* @return true if aPosition hits a footprint element on aLayer
|
|
|
|
*/
|
|
|
|
bool HitTestOnLayer( const VECTOR2I& aPosition, PCB_LAYER_ID aLayer, int aAccuracy = 0 ) const;
|
|
|
|
|
|
|
|
bool HitTestOnLayer( const BOX2I& aRect, bool aContained, PCB_LAYER_ID aLayer, int aAccuracy = 0 ) const;
|
|
|
|
|
2008-01-20 19:55:22 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* @return reference designator text.
|
2007-08-24 03:40:04 +00:00
|
|
|
*/
|
2023-05-24 12:39:25 +00:00
|
|
|
const wxString& GetReference() const { return Reference().GetText(); }
|
2008-01-20 19:55:22 +00:00
|
|
|
|
2012-02-17 19:43:43 +00:00
|
|
|
/**
|
2012-03-17 14:39:27 +00:00
|
|
|
* @param aReference A reference to a wxString object containing the reference designator
|
|
|
|
* text.
|
2012-02-17 19:43:43 +00:00
|
|
|
*/
|
2023-05-24 12:39:25 +00:00
|
|
|
void SetReference( const wxString& aReference ) { Reference().SetText( aReference ); }
|
2009-11-04 19:08:08 +00:00
|
|
|
|
2022-10-15 18:36:08 +00:00
|
|
|
// Property system doesn't like const references
|
|
|
|
wxString GetReferenceAsString() const
|
|
|
|
{
|
|
|
|
return GetReference();
|
|
|
|
}
|
|
|
|
|
2018-07-24 18:41:08 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Bump the current reference by \a aDelta.
|
2018-07-24 18:41:08 +00:00
|
|
|
*/
|
|
|
|
void IncrementReference( int aDelta );
|
|
|
|
|
2008-01-29 22:09:09 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* @return the value text.
|
2008-01-29 22:09:09 +00:00
|
|
|
*/
|
2023-05-24 12:39:25 +00:00
|
|
|
const wxString& GetValue() const { return Value().GetText(); }
|
2008-01-20 19:55:22 +00:00
|
|
|
|
2012-02-17 19:43:43 +00:00
|
|
|
/**
|
2012-03-17 14:39:27 +00:00
|
|
|
* @param aValue A reference to a wxString object containing the value text.
|
2012-02-17 19:43:43 +00:00
|
|
|
*/
|
2023-05-24 12:39:25 +00:00
|
|
|
void SetValue( const wxString& aValue ) { Value().SetText( aValue ); }
|
2008-03-04 04:22:27 +00:00
|
|
|
|
2022-10-15 18:36:08 +00:00
|
|
|
// Property system doesn't like const references
|
|
|
|
wxString GetValueAsString() const
|
|
|
|
{
|
|
|
|
return GetValue();
|
|
|
|
}
|
|
|
|
|
2012-05-22 17:51:18 +00:00
|
|
|
/// read/write accessors:
|
2023-05-24 12:39:25 +00:00
|
|
|
PCB_FIELD& Value() { return *GetField( VALUE_FIELD ); }
|
|
|
|
PCB_FIELD& Reference() { return *GetField( REFERENCE_FIELD ); }
|
2023-10-02 14:25:54 +00:00
|
|
|
PCB_FIELD& Footprint() { return *GetField( FOOTPRINT_FIELD ); }
|
2012-05-22 17:51:18 +00:00
|
|
|
|
2013-03-13 18:53:58 +00:00
|
|
|
/// The const versions to keep the compiler happy.
|
2023-05-24 12:39:25 +00:00
|
|
|
const PCB_FIELD& Value() const { return *GetField( VALUE_FIELD ); }
|
|
|
|
const PCB_FIELD& Reference() const { return *GetField( REFERENCE_FIELD ); }
|
2023-10-02 14:25:54 +00:00
|
|
|
const PCB_FIELD& Footprint() const { return *GetField( FOOTPRINT_FIELD ); }
|
2013-03-13 18:53:58 +00:00
|
|
|
|
2023-05-24 12:39:25 +00:00
|
|
|
//-----<Fields>-----------------------------------------------------------
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return a mandatory field in this symbol.
|
|
|
|
*
|
|
|
|
* @note If you need to fetch a user field, use GetFieldById.
|
|
|
|
*
|
|
|
|
* @param aFieldType is one of the mandatory field types (REFERENCE_FIELD, VALUE_FIELD, etc.).
|
|
|
|
* @return is the field at \a aFieldType or NULL if the field does not exist.
|
|
|
|
*/
|
|
|
|
PCB_FIELD* GetField( MANDATORY_FIELD_T aFieldType );
|
|
|
|
const PCB_FIELD* GetField( MANDATORY_FIELD_T aFieldNdx ) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return a field in this symbol.
|
|
|
|
*
|
|
|
|
* @param aFieldId is the id of the field requested. Note that this id ONLY SOMETIMES equates
|
|
|
|
* to the field's position in the vector.
|
|
|
|
* @return is the field at \a aFieldType or NULL if the field does not exist.
|
|
|
|
*/
|
|
|
|
PCB_FIELD* GetFieldById( int aFieldId );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return a field in this symbol.
|
|
|
|
*
|
|
|
|
* @param aFieldName is the name of the field
|
|
|
|
*
|
|
|
|
* @return is the field with \a aFieldName or NULL if the field does not exist.
|
|
|
|
*/
|
|
|
|
PCB_FIELD* GetFieldByName( const wxString& aFieldName );
|
|
|
|
|
|
|
|
bool HasFieldByName( const wxString& aFieldName ) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Search for a field named \a aFieldName and returns text associated with this field.
|
|
|
|
*
|
|
|
|
* @param aFieldName is the name of the field
|
|
|
|
*/
|
|
|
|
wxString GetFieldText( const wxString& aFieldName ) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Populate a std::vector with PCB_TEXTs.
|
|
|
|
*
|
|
|
|
* @param aVector is the vector to populate.
|
|
|
|
* @param aVisibleOnly is used to add only the fields that are visible and contain text.
|
|
|
|
*/
|
|
|
|
void GetFields( std::vector<PCB_FIELD*>& aVector, bool aVisibleOnly );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return a vector of fields from the symbol
|
|
|
|
*/
|
|
|
|
PCB_FIELDS GetFields() { return m_fields; }
|
|
|
|
const PCB_FIELDS& GetFields() const { return m_fields; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a field to the symbol.
|
|
|
|
*
|
|
|
|
* @param aField is the field to add to this symbol.
|
|
|
|
*
|
|
|
|
* @return the newly inserted field.
|
|
|
|
*/
|
2023-06-20 14:31:13 +00:00
|
|
|
PCB_FIELD* AddField( const PCB_FIELD& aField );
|
2023-05-24 12:39:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove a user field from the footprint.
|
|
|
|
* @param aFieldName is the user fieldName to remove. Attempts to remove a mandatory
|
|
|
|
* field or a non-existant field are silently ignored.
|
|
|
|
*/
|
|
|
|
void RemoveField( const wxString& aFieldName );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the number of fields in this symbol.
|
|
|
|
*/
|
|
|
|
int GetFieldCount() const { return (int) m_fields.size(); }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Apply default board settings to the footprint field text properties.
|
|
|
|
*
|
|
|
|
* This is needed because the board settings are not available when the footprint is
|
|
|
|
* being created in the footprint library cache, and we want these fields to have
|
|
|
|
* the correct default text properties.
|
|
|
|
*/
|
2023-10-02 21:10:13 +00:00
|
|
|
void ApplyDefaultSettings( const BOARD& board, bool aStyleFields, bool aStyleText,
|
|
|
|
bool aStyleShapes );
|
2020-08-08 21:47:57 +00:00
|
|
|
|
2022-11-25 16:49:21 +00:00
|
|
|
bool IsBoardOnly() const { return m_attributes & FP_BOARD_ONLY; }
|
|
|
|
void SetBoardOnly( bool aIsBoardOnly = true )
|
|
|
|
{
|
|
|
|
if( aIsBoardOnly )
|
|
|
|
m_attributes |= FP_BOARD_ONLY;
|
|
|
|
else
|
|
|
|
m_attributes &= ~FP_BOARD_ONLY;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IsExcludedFromPosFiles() const { return m_attributes & FP_EXCLUDE_FROM_POS_FILES; }
|
|
|
|
void SetExcludedFromPosFiles( bool aExclude = true )
|
|
|
|
{
|
|
|
|
if( aExclude )
|
|
|
|
m_attributes |= FP_EXCLUDE_FROM_POS_FILES;
|
|
|
|
else
|
|
|
|
m_attributes &= ~FP_EXCLUDE_FROM_POS_FILES;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IsExcludedFromBOM() const { return m_attributes & FP_EXCLUDE_FROM_BOM; }
|
|
|
|
void SetExcludedFromBOM( bool aExclude = true )
|
|
|
|
{
|
|
|
|
if( aExclude )
|
|
|
|
m_attributes |= FP_EXCLUDE_FROM_BOM;
|
|
|
|
else
|
|
|
|
m_attributes &= ~FP_EXCLUDE_FROM_BOM;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool AllowMissingCourtyard() const { return m_attributes & FP_ALLOW_MISSING_COURTYARD; }
|
|
|
|
void SetAllowMissingCourtyard( bool aAllow = true )
|
|
|
|
{
|
|
|
|
if( aAllow )
|
|
|
|
m_attributes |= FP_ALLOW_MISSING_COURTYARD;
|
|
|
|
else
|
|
|
|
m_attributes &= ~FP_ALLOW_MISSING_COURTYARD;
|
|
|
|
}
|
|
|
|
|
2023-04-10 17:10:42 +00:00
|
|
|
bool IsDNP() const { return m_attributes & FP_DNP; }
|
|
|
|
void SetDNP( bool aDNP = true )
|
|
|
|
{
|
|
|
|
if( aDNP )
|
|
|
|
m_attributes |= FP_DNP;
|
|
|
|
else
|
|
|
|
m_attributes &= ~FP_DNP;
|
|
|
|
}
|
|
|
|
|
2022-11-28 02:27:34 +00:00
|
|
|
void SetFileFormatVersionAtLoad( int aVersion ) { m_fileFormatVersionAtLoad = aVersion; }
|
|
|
|
int GetFileFormatVersionAtLoad() const { return m_fileFormatVersionAtLoad; }
|
|
|
|
|
2008-03-04 04:22:27 +00:00
|
|
|
/**
|
2021-08-23 23:10:21 +00:00
|
|
|
* Return a #PAD with a matching number.
|
2021-01-27 22:15:38 +00:00
|
|
|
*
|
2021-08-23 23:10:21 +00:00
|
|
|
* @note Numbers may not be unique depending on how the footprint was created.
|
2021-01-27 22:15:38 +00:00
|
|
|
*
|
2021-08-23 23:10:21 +00:00
|
|
|
* @param aPadNumber the pad number to find.
|
2021-08-16 18:52:49 +00:00
|
|
|
* @param aSearchAfterMe = not nullptr to find a pad living after aAfterMe
|
2021-08-23 23:10:21 +00:00
|
|
|
* @return the first matching numbered #PAD is returned or NULL if not found.
|
2008-03-04 04:22:27 +00:00
|
|
|
*/
|
2021-08-23 23:10:21 +00:00
|
|
|
PAD* FindPadByNumber( const wxString& aPadNumber, PAD* aSearchAfterMe = nullptr ) const;
|
2008-03-04 04:22:27 +00:00
|
|
|
|
2011-09-15 17:58:35 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Get a pad at \a aPosition on \a aLayerMask in the footprint.
|
2011-09-15 17:58:35 +00:00
|
|
|
*
|
2022-01-11 00:49:49 +00:00
|
|
|
* @param aPosition A VECTOR2I object containing the position to hit test.
|
2011-09-15 17:58:35 +00:00
|
|
|
* @param aLayerMask A layer or layers to mask the hit test.
|
2021-01-27 22:15:38 +00:00
|
|
|
* @return A pointer to a #PAD object if found otherwise NULL.
|
2011-09-15 17:58:35 +00:00
|
|
|
*/
|
2022-01-01 06:04:08 +00:00
|
|
|
PAD* GetPad( const VECTOR2I& aPosition, LSET aLayerMask = LSET::AllLayersMask() );
|
2008-03-04 04:22:27 +00:00
|
|
|
|
2012-04-16 03:18:41 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Return the number of pads.
|
2013-06-07 13:17:52 +00:00
|
|
|
*
|
|
|
|
* @param aIncludeNPTH includes non-plated through holes when true. Does not include
|
|
|
|
* non-plated through holes when false.
|
|
|
|
* @return the number of pads according to \a aIncludeNPTH.
|
2012-04-16 03:18:41 +00:00
|
|
|
*/
|
2017-04-25 09:06:24 +00:00
|
|
|
unsigned GetPadCount( INCLUDE_NPTH_T aIncludeNPTH = INCLUDE_NPTH_T(INCLUDE_NPTH) ) const;
|
2015-11-11 18:35:26 +00:00
|
|
|
|
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Return the number of unique non-blank pads.
|
2015-11-13 11:32:42 +00:00
|
|
|
*
|
2021-01-27 22:15:38 +00:00
|
|
|
* A complex pad can be built with many pads having the same pad name to create a complex
|
|
|
|
* shape or fragmented solder paste areas.
|
2015-11-11 18:35:26 +00:00
|
|
|
*
|
|
|
|
* @param aIncludeNPTH includes non-plated through holes when true. Does not include
|
|
|
|
* non-plated through holes when false.
|
|
|
|
* @return the number of unique pads according to \a aIncludeNPTH.
|
|
|
|
*/
|
2017-04-25 09:06:24 +00:00
|
|
|
unsigned GetUniquePadCount( INCLUDE_NPTH_T aIncludeNPTH = INCLUDE_NPTH_T(INCLUDE_NPTH) ) const;
|
2012-04-16 03:18:41 +00:00
|
|
|
|
2015-02-12 03:22:24 +00:00
|
|
|
/**
|
2021-08-23 23:10:21 +00:00
|
|
|
* Return the next available pad number in the footprint.
|
2015-02-12 03:22:24 +00:00
|
|
|
*
|
2019-05-31 12:15:25 +00:00
|
|
|
* @param aFillSequenceGaps true if the numbering should "fill in" gaps in the sequence,
|
|
|
|
* else return the highest value + 1
|
2021-08-23 23:10:21 +00:00
|
|
|
* @return the next available pad number
|
2015-02-12 03:22:24 +00:00
|
|
|
*/
|
2021-08-23 23:10:21 +00:00
|
|
|
wxString GetNextPadNumber( const wxString& aLastPadName ) const;
|
2015-02-12 03:22:24 +00:00
|
|
|
|
2023-07-29 05:18:13 +00:00
|
|
|
/**
|
|
|
|
* Position Reference and Value fields at the top and bottom of footprint's bounding box.
|
|
|
|
*/
|
|
|
|
void AutoPositionFields();
|
|
|
|
|
2021-09-24 16:15:54 +00:00
|
|
|
/**
|
|
|
|
* Get the type of footprint
|
|
|
|
* @return "SMD"/"Through hole"/"Other" based on attributes
|
|
|
|
*/
|
|
|
|
wxString GetTypeName() const;
|
|
|
|
|
2018-09-13 21:29:52 +00:00
|
|
|
double GetArea( int aPadding = 0 ) const;
|
2013-03-13 18:53:58 +00:00
|
|
|
|
2020-11-13 02:57:11 +00:00
|
|
|
KIID GetLink() const { return m_link; }
|
|
|
|
void SetLink( const KIID& aLink ) { m_link = aLink; }
|
2013-03-13 18:53:58 +00:00
|
|
|
|
2020-08-10 13:22:02 +00:00
|
|
|
BOARD_ITEM* Duplicate() const override;
|
|
|
|
|
2015-02-12 03:22:24 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Duplicate a given item within the footprint, optionally adding it to the board.
|
|
|
|
*
|
|
|
|
* @return the new item, or NULL if the item could not be duplicated.
|
2015-02-12 03:22:24 +00:00
|
|
|
*/
|
2020-11-13 02:57:11 +00:00
|
|
|
BOARD_ITEM* DuplicateItem( const BOARD_ITEM* aItem, bool aAddToFootprint = false );
|
2015-02-12 03:22:24 +00:00
|
|
|
|
2012-06-09 17:00:13 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Add \a a3DModel definition to the end of the 3D model list.
|
2012-06-09 17:00:13 +00:00
|
|
|
*
|
2020-11-13 00:43:45 +00:00
|
|
|
* @param a3DModel A pointer to a #FP_3DMODEL to add to the list.
|
2012-06-09 17:00:13 +00:00
|
|
|
*/
|
2020-11-13 00:43:45 +00:00
|
|
|
void Add3DModel( FP_3DMODEL* a3DModel );
|
2012-06-09 17:00:13 +00:00
|
|
|
|
2022-08-20 09:27:35 +00:00
|
|
|
INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
|
2022-08-21 19:54:07 +00:00
|
|
|
const std::vector<KICAD_T>& aScanTypes ) override;
|
2008-01-20 19:55:22 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
wxString GetClass() const override
|
2007-08-07 06:21:19 +00:00
|
|
|
{
|
2020-11-13 21:07:01 +00:00
|
|
|
return wxT( "FOOTPRINT" );
|
2007-08-07 06:21:19 +00:00
|
|
|
}
|
|
|
|
|
2023-01-12 03:27:44 +00:00
|
|
|
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
|
2008-01-20 19:55:22 +00:00
|
|
|
|
2021-03-08 02:59:07 +00:00
|
|
|
BITMAPS GetMenuImage() const override;
|
2011-08-01 15:29:27 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
EDA_ITEM* Clone() const override;
|
2012-03-17 14:39:27 +00:00
|
|
|
|
2013-12-18 12:39:11 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Invoke a function on all BOARD_ITEMs that belong to the footprint (pads, drawings, texts).
|
|
|
|
*
|
|
|
|
* @note This function should not add or remove items to the footprint.
|
2013-12-18 12:39:11 +00:00
|
|
|
*
|
|
|
|
* @param aFunction is the function to be invoked.
|
|
|
|
*/
|
2020-10-27 11:03:35 +00:00
|
|
|
void RunOnChildren( const std::function<void (BOARD_ITEM*)>& aFunction ) const;
|
2013-12-18 12:39:11 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
2014-07-09 13:02:56 +00:00
|
|
|
|
2020-09-21 15:03:08 +00:00
|
|
|
double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
|
2014-07-09 13:02:56 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
virtual const BOX2I ViewBBox() const override;
|
2014-11-13 16:32:59 +00:00
|
|
|
|
2012-12-10 11:18:42 +00:00
|
|
|
/**
|
|
|
|
* Test for validity of a name of a footprint to be used in a footprint library
|
2021-01-27 22:15:38 +00:00
|
|
|
* ( no spaces, dir separators ... ).
|
|
|
|
*
|
|
|
|
* @param aName is the name in library to validate.
|
2012-12-10 11:18:42 +00:00
|
|
|
* @return true if the given name is valid
|
|
|
|
*/
|
2017-04-25 09:06:24 +00:00
|
|
|
static bool IsLibNameValid( const wxString& aName );
|
2012-12-10 11:18:42 +00:00
|
|
|
|
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Test for validity of the name in a library of the footprint ( no spaces, dir
|
|
|
|
* separators ... ).
|
|
|
|
*
|
|
|
|
* @param aUserReadable set to false to get the list of invalid characters or true to get
|
|
|
|
* a readable form (i.e ' ' = 'space' '\\t'= 'tab').
|
|
|
|
*
|
|
|
|
* @return the list of invalid chars in the library name.
|
2012-12-10 11:18:42 +00:00
|
|
|
*/
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
static const wxChar* StringLibNameInvalidChars( bool aUserReadable );
|
2012-12-10 11:18:42 +00:00
|
|
|
|
2021-07-11 11:49:36 +00:00
|
|
|
/**
|
|
|
|
* Return true if a board footprint differs from the library version.
|
|
|
|
*/
|
2023-10-02 21:10:13 +00:00
|
|
|
bool FootprintNeedsUpdate( const FOOTPRINT* aLibFP, REPORTER* aReporter = nullptr );
|
2021-07-11 11:49:36 +00:00
|
|
|
|
2013-06-23 19:18:33 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Take ownership of caller's heap allocated aInitialComments block.
|
|
|
|
*
|
|
|
|
* The comments are single line strings already containing the s-expression comments with
|
|
|
|
* optional leading whitespace and then a '#' character followed by optional single line
|
|
|
|
* text (text with no line endings, not even one). This block of single line comments
|
|
|
|
* will be output upfront of any generated s-expression text in the PCBIO::Format() function.
|
|
|
|
*
|
|
|
|
* @note A block of single line comments constitutes a multiline block of single line
|
|
|
|
* comments. That is, the block is made of consecutive single line comments.
|
|
|
|
*
|
2013-06-23 19:18:33 +00:00
|
|
|
* @param aInitialComments is a heap allocated wxArrayString or NULL, which the caller
|
2020-11-13 21:07:01 +00:00
|
|
|
* gives up ownership of over to this FOOTPRINT.
|
2013-06-23 19:18:33 +00:00
|
|
|
*/
|
|
|
|
void SetInitialComments( wxArrayString* aInitialComments )
|
|
|
|
{
|
|
|
|
delete m_initial_comments;
|
|
|
|
m_initial_comments = aInitialComments;
|
|
|
|
}
|
|
|
|
|
2015-02-18 16:53:46 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Calculate the ratio of total area of the footprint pads and graphical items to the
|
|
|
|
* area of the footprint. Used by selection tool heuristics.
|
|
|
|
*
|
|
|
|
* @return the ratio.
|
2015-02-17 23:58:14 +00:00
|
|
|
*/
|
2018-02-22 10:10:48 +00:00
|
|
|
double CoverageRatio( const GENERAL_COLLECTOR& aCollector ) const;
|
2015-02-17 23:58:14 +00:00
|
|
|
|
2020-11-27 18:04:30 +00:00
|
|
|
static double GetCoverageArea( const BOARD_ITEM* aItem, const GENERAL_COLLECTOR& aCollector );
|
|
|
|
|
2023-03-24 13:02:13 +00:00
|
|
|
/// Return the initial comments block or NULL if none, without transfer of ownership.
|
2013-06-25 15:56:12 +00:00
|
|
|
const wxArrayString* GetInitialComments() const { return m_initial_comments; }
|
2013-06-23 19:18:33 +00:00
|
|
|
|
2021-01-27 22:15:38 +00:00
|
|
|
/**
|
|
|
|
* Used in DRC to test the courtyard area (a complex polygon).
|
|
|
|
*
|
|
|
|
* @return the courtyard polygon.
|
2017-03-16 17:09:33 +00:00
|
|
|
*/
|
2022-07-31 21:14:24 +00:00
|
|
|
const SHAPE_POLY_SET& GetCourtyard( PCB_LAYER_ID aLayer ) const;
|
2017-03-16 17:09:33 +00:00
|
|
|
|
2020-05-03 10:27:33 +00:00
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* Build complex polygons of the courtyard areas from graphic items on the courtyard layers.
|
|
|
|
*
|
|
|
|
* @note Set the #MALFORMED_F_COURTYARD and #MALFORMED_B_COURTYARD status flags if the given
|
|
|
|
* courtyard layer does not contain a (single) closed shape.
|
2017-03-16 17:09:33 +00:00
|
|
|
*/
|
2022-07-31 21:14:24 +00:00
|
|
|
void BuildCourtyardCaches( OUTLINE_ERROR_HANDLER* aErrorHandler = nullptr );
|
2017-03-16 17:09:33 +00:00
|
|
|
|
2022-11-18 21:04:54 +00:00
|
|
|
// @copydoc BOARD_ITEM::GetEffectiveShape
|
|
|
|
std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
|
|
|
|
FLASHING aFlash = FLASHING::DEFAULT ) const override;
|
2020-08-26 22:04:16 +00:00
|
|
|
|
2022-11-11 17:09:25 +00:00
|
|
|
#if defined(DEBUG)
|
|
|
|
virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
|
|
|
|
#endif
|
2017-10-31 13:59:03 +00:00
|
|
|
|
2020-07-24 22:08:36 +00:00
|
|
|
struct cmp_drawings
|
|
|
|
{
|
2021-07-21 23:14:56 +00:00
|
|
|
bool operator()( const BOARD_ITEM* itemA, const BOARD_ITEM* itemB ) const;
|
2020-07-24 22:08:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct cmp_pads
|
|
|
|
{
|
2020-11-12 22:30:02 +00:00
|
|
|
bool operator()( const PAD* aFirst, const PAD* aSecond ) const;
|
2020-07-24 22:08:36 +00:00
|
|
|
};
|
|
|
|
|
2021-07-11 11:49:36 +00:00
|
|
|
struct cmp_zones
|
|
|
|
{
|
2023-03-30 11:49:23 +00:00
|
|
|
bool operator()( const ZONE* aFirst, const ZONE* aSecond ) const;
|
2021-07-11 11:49:36 +00:00
|
|
|
};
|
|
|
|
|
2022-11-11 17:09:25 +00:00
|
|
|
protected:
|
|
|
|
virtual void swapData( BOARD_ITEM* aImage ) override;
|
2011-08-01 15:29:27 +00:00
|
|
|
|
2012-04-17 01:35:43 +00:00
|
|
|
private:
|
2023-05-24 12:39:25 +00:00
|
|
|
PCB_FIELDS m_fields;
|
2020-11-13 02:57:11 +00:00
|
|
|
DRAWINGS m_drawings; // BOARD_ITEMs for drawings on the board, owned by pointer.
|
|
|
|
PADS m_pads; // PAD items, owned by pointer
|
2023-03-30 11:49:23 +00:00
|
|
|
ZONES m_zones; // PCB_ZONE items, owned by pointer
|
|
|
|
GROUPS m_groups; // PCB_GROUP items, owned by pointer
|
2020-11-13 02:57:11 +00:00
|
|
|
|
2022-01-13 17:27:36 +00:00
|
|
|
EDA_ANGLE m_orient; // Orientation
|
2022-01-01 06:04:08 +00:00
|
|
|
VECTOR2I m_pos; // Position of footprint on the board in internal units.
|
2020-11-13 21:07:01 +00:00
|
|
|
LIB_ID m_fpid; // The #LIB_ID of the FOOTPRINT.
|
2022-01-13 17:27:36 +00:00
|
|
|
int m_attributes; // Flag bits (see FOOTPRINT_ATTR_T)
|
2020-11-13 11:17:15 +00:00
|
|
|
int m_fpStatus; // For autoplace: flags (LOCKED, FIELDS_AUTOPLACED)
|
2022-11-28 02:27:34 +00:00
|
|
|
int m_fileFormatVersionAtLoad;
|
2021-01-31 14:32:14 +00:00
|
|
|
|
2021-02-26 18:03:51 +00:00
|
|
|
// Bounding box caching strategy:
|
|
|
|
// While we attempt to notice the low-hanging fruit operations and update the bounding boxes
|
|
|
|
// accordingly, we rely mostly on a "if anything changed then the caches are stale" approach.
|
|
|
|
// We implement this by having PCB_BASE_FRAME's OnModify() method increment an operation
|
|
|
|
// counter, and storing that as a timestamp for the various caches.
|
|
|
|
// This means caches will get regenerated often -- but still far less often than if we had no
|
|
|
|
// caches at all. The principal opitmization would be to change to dirty flag and make sure
|
|
|
|
// that any edit that could affect the bounding boxes (including edits to the footprint
|
|
|
|
// children) marked the bounding boxes dirty. It would definitely be faster -- but also more
|
|
|
|
// fragile.
|
2022-08-31 16:17:14 +00:00
|
|
|
mutable BOX2I m_cachedBoundingBox;
|
2021-02-26 13:49:40 +00:00
|
|
|
mutable int m_boundingBoxCacheTimeStamp;
|
2022-08-31 16:17:14 +00:00
|
|
|
mutable BOX2I m_cachedVisibleBBox;
|
2021-02-26 13:49:40 +00:00
|
|
|
mutable int m_visibleBBoxCacheTimeStamp;
|
2022-08-31 16:17:14 +00:00
|
|
|
mutable BOX2I m_cachedTextExcludedBBox;
|
2021-02-26 13:49:40 +00:00
|
|
|
mutable int m_textExcludedBBoxCacheTimeStamp;
|
|
|
|
mutable SHAPE_POLY_SET m_cachedHull;
|
|
|
|
mutable int m_hullCacheTimeStamp;
|
2021-01-31 14:32:14 +00:00
|
|
|
|
2022-08-19 17:34:53 +00:00
|
|
|
// A list of pad groups, each of which is allowed to short nets within their group.
|
|
|
|
// A pad group is a comma-separated list of pad numbers.
|
|
|
|
std::vector<wxString> m_netTiePadGroups;
|
|
|
|
|
2020-11-13 02:57:11 +00:00
|
|
|
ZONE_CONNECTION m_zoneConnection;
|
|
|
|
int m_localClearance;
|
|
|
|
int m_localSolderMaskMargin; // Solder mask margin
|
|
|
|
int m_localSolderPasteMargin; // Solder paste margin absolute value
|
|
|
|
double m_localSolderPasteMarginRatio; // Solder mask margin ratio value of pad size
|
|
|
|
|
2023-06-19 17:08:18 +00:00
|
|
|
wxString m_libDescription; // File name and path for documentation file.
|
2020-11-13 02:57:11 +00:00
|
|
|
wxString m_keywords; // Search keywords to find footprint in library.
|
|
|
|
KIID_PATH m_path; // Path to associated symbol ([sheetUUID, .., symbolUUID]).
|
2023-06-19 13:26:33 +00:00
|
|
|
wxString m_sheetname; // Name of the sheet containing the symbol for this footprint
|
|
|
|
wxString m_sheetfile; // File of the sheet containing the symbol for this footprint
|
2023-09-29 16:02:57 +00:00
|
|
|
wxString m_filters; // Footprint filters from symbol
|
2020-11-13 02:57:11 +00:00
|
|
|
timestamp_t m_lastEditTime;
|
|
|
|
int m_arflag; // Use to trace ratsnest and auto routing.
|
|
|
|
KIID m_link; // Temporary logical link used during editing
|
2021-12-05 21:56:55 +00:00
|
|
|
LSET m_privateLayers; // Layers visible only in the footprint editor
|
2013-06-23 19:18:33 +00:00
|
|
|
|
2021-07-11 11:49:36 +00:00
|
|
|
std::vector<FP_3DMODEL> m_3D_Drawings; // 3D models.
|
2020-11-13 02:57:11 +00:00
|
|
|
wxArrayString* m_initial_comments; // s-expression comments in the footprint,
|
2020-08-08 21:47:57 +00:00
|
|
|
// lazily allocated only if needed for speed
|
2017-03-16 17:09:33 +00:00
|
|
|
|
2022-07-31 21:14:24 +00:00
|
|
|
SHAPE_POLY_SET m_courtyard_cache_front; // Note that a footprint can have both front and back
|
|
|
|
SHAPE_POLY_SET m_courtyard_cache_back; // courtyards populated.
|
|
|
|
mutable int m_courtyard_cache_timestamp;
|
2012-04-17 01:35:43 +00:00
|
|
|
};
|
2011-08-01 15:29:27 +00:00
|
|
|
|
2020-11-13 00:43:45 +00:00
|
|
|
#endif // FOOTPRINT_H
|