63 void Serialize( google::protobuf::Any &aContainer )
const override;
64 bool Deserialize(
const google::protobuf::Any &aContainer )
override;
83 bool IsType(
const std::vector<KICAD_T>& aScanTypes )
const override
88 for(
KICAD_T scanType : aScanTypes )
247 ? PAD_SHAPE::RECTANGLE
385 const std::vector<std::shared_ptr<PCB_SHAPE>>& aPrimitivesList );
392 const std::vector<std::shared_ptr<PCB_SHAPE>>& aPrimitivesList );
507 bool ignoreLineWidth =
false )
const override;
535 virtual std::shared_ptr<SHAPE>
537 FLASHING flashPTHPads = FLASHING::DEFAULT )
const override;
778 bool FlashLayer(
int aLayer,
bool aOnlyCheckIfPermitted =
false )
const;
801 bool HitTest(
const VECTOR2I& aPosition,
int aAccuracy = 0 )
const override;
802 bool HitTest(
const BOX2I& aRect,
bool aContained,
int aAccuracy = 0 )
const override;
812 std::vector<PCB_SHAPE*>
Recombine(
bool aIsDryRun,
int aMaxError );
830 static int Compare(
const PAD* aPadRef,
const PAD* aPadCmp );
834 m_pos += aMoveVector;
886 const std::function<
void(
int aErrorCode,
887 const wxString& aMsg )>& aErrorHandler )
const;
895 virtual void Show(
int nestLevel, std::ostream& os )
const override { ShowDummy( os ); }
908 const std::function<
void(
int aErrorCode,
909 const wxString& aMsg )>& aErrorHandler )
const;
928 typedef std::map<PCB_LAYER_ID, std::array<std::shared_ptr<SHAPE_POLY_SET>, 2>>
LAYER_POLYGON_MAP;
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
BITMAPS
A list of all bitmap identifiers.
ZONE_LAYER_OVERRIDE
Conditionally flashed vias and pads that interact with zones of different priority can be very squirr...
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
FOOTPRINT * GetParentFootprint() const
Implement a canvas based on a wxGLCanvas.
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
KICAD_T Type() const
Returns the type of object.
virtual bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
An abstract class from which implementation specific LINE_READERs may be derived to read single lines...
LSET is a set of PCB_LAYER_IDs.
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
A PADSTACK defines the characteristics of a single or multi-layer pad, in the IPC sense of the word.
CUSTOM_SHAPE_ZONE_MODE CustomShapeInZoneMode() const
void SetCustomShapeInZoneMode(CUSTOM_SHAPE_ZONE_MODE aM)
std::optional< int > & Clearance(PCB_LAYER_ID aLayer=F_Cu)
std::optional< double > & SolderPasteMarginRatio(PCB_LAYER_ID aLayer=F_Cu)
void SetThermalSpokeAngle(EDA_ANGLE aAngle, PCB_LAYER_ID aLayer=F_Cu)
void SetUnconnectedLayerMode(UNCONNECTED_LAYER_MODE aMode)
std::optional< int > & ThermalSpokeWidth(PCB_LAYER_ID aLayer=F_Cu)
std::optional< int > & SolderPasteMargin(PCB_LAYER_ID aLayer=F_Cu)
std::optional< int > & SolderMaskMargin(PCB_LAYER_ID aLayer=F_Cu)
const LSET & LayerSet() const
void SetShape(PAD_SHAPE aShape, PCB_LAYER_ID aLayer)
VECTOR2I & TrapezoidDeltaSize(PCB_LAYER_ID aLayer)
VECTOR2I & Offset(PCB_LAYER_ID aLayer)
EDA_ANGLE ThermalSpokeAngle(PCB_LAYER_ID aLayer=F_Cu) const
void SetChamferPositions(int aPositions, PCB_LAYER_ID aLayer)
UNCONNECTED_LAYER_MODE UnconnectedLayerMode() const
std::optional< int > & ThermalGap(PCB_LAYER_ID aLayer=F_Cu)
PAD_SHAPE Shape(PCB_LAYER_ID aLayer) const
void SetAnchorShape(PAD_SHAPE aShape, PCB_LAYER_ID aLayer)
int & ChamferPositions(PCB_LAYER_ID aLayer)
const VECTOR2I & Size(PCB_LAYER_ID aLayer) const
double RoundRectRadiusRatio(PCB_LAYER_ID aLayer) const
UNCONNECTED_LAYER_MODE
! Whether or not to remove the copper shape for unconnected layers
@ REMOVE_EXCEPT_START_AND_END
PAD_SHAPE AnchorShape(PCB_LAYER_ID aLayer) const
void SetSize(const VECTOR2I &aSize, PCB_LAYER_ID aLayer)
double ChamferRatio(PCB_LAYER_ID aLayer) const
static constexpr PCB_LAYER_ID ALL_LAYERS
! Temporary layer identifier to identify code that is not padstack-aware
EDA_ANGLE GetOrientation() const
void SetLayerSet(const LSET &aSet)
std::optional< ZONE_CONNECTION > & ZoneConnection(PCB_LAYER_ID aLayer=F_Cu)
std::vector< std::shared_ptr< PCB_SHAPE > > & Primitives(PCB_LAYER_ID aLayer)
void SetAnchorPadShape(PCB_LAYER_ID aLayer, PAD_SHAPE aShape)
Set the shape of the anchor pad for custom shaped pads.
bool IsAperturePad() const
void SetAttribute(PAD_ATTRIB aAttribute)
int GetOwnClearance(PCB_LAYER_ID aLayer, wxString *aSource=nullptr) const override
Return the pad's "own" clearance in internal units.
virtual void swapData(BOARD_ITEM *aImage) override
PAD_PROP GetProperty() const
bool GetRemoveUnconnected() const
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
double GetFrontRoundRectRadiusRatio() const
std::optional< int > GetClearanceOverrides(wxString *aSource) const override
Return any clearance overrides set in the "classic" (ie: pre-rule) system.
void SetPinType(const wxString &aType)
Set the pad electrical type.
LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
const std::vector< std::shared_ptr< PCB_SHAPE > > & GetPrimitives(PCB_LAYER_ID aLayer) const
Accessor to the basic shape list for custom-shaped pads.
const ZONE_LAYER_OVERRIDE & GetZoneLayerOverride(PCB_LAYER_ID aLayer) const
void MergePrimitivesAsPolygon(PCB_LAYER_ID aLayer, SHAPE_POLY_SET *aMergedPolygon, ERROR_LOC aErrorLoc=ERROR_INSIDE) const
Merge all basic shapes to a SHAPE_POLY_SET.
int GetRoundRectCornerRadius(PCB_LAYER_ID aLayer) const
bool FlashLayer(int aLayer, bool aOnlyCheckIfPermitted=false) const
Check to see whether the pad should be flashed on the specific layer.
virtual std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer, FLASHING flashPTHPads=FLASHING::DEFAULT) const override
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
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.
const BOX2I GetBoundingBox() const override
The bounding box is cached, so this will be efficient most of the time.
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
int GetDrillSizeY() const
std::map< PCB_LAYER_ID, std::shared_ptr< SHAPE_COMPOUND > > LAYER_SHAPE_MAP
void AddPrimitivePoly(PCB_LAYER_ID aLayer, const SHAPE_POLY_SET &aPoly, int aThickness, bool aFilled)
Has meaning only for custom shape pads.
std::optional< double > GetLocalSolderPasteMarginRatio() const
void SetFrontShape(PAD_SHAPE aShape)
const wxString & GetPinType() const
void SetZoneLayerOverride(PCB_LAYER_ID aLayer, ZONE_LAYER_OVERRIDE aOverride)
const VECTOR2I & GetDrillSize() const
PAD_ATTRIB GetAttribute() const
static LSET PTHMask()
layer set for a through hole pad
static int Compare(const PAD *aPadRef, const PAD *aPadCmp)
Compare two pads and return 0 if they are equal.
void SetUnconnectedLayerMode(PADSTACK::UNCONNECTED_LAYER_MODE aMode)
void SetRemoveUnconnected(bool aSet)
const wxString & GetPinFunction() const
std::mutex m_shapesBuildingLock
void SetThermalGap(int aGap)
bool CanHaveNumber() const
Indicates whether or not the pad can have a number.
void SetThermalSpokeAngle(const EDA_ANGLE &aAngle)
The orientation of the thermal spokes.
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
const wxString & GetNumber() const
const VECTOR2I & GetDelta(PCB_LAYER_ID aLayer) const
void SetFrontRoundRectRadiusRatio(double aRadiusScale)
void BuildEffectiveShapes() const
Rebuild the effective shape cache (and bounding box and radius) for the pad and clears the dirty bit.
PAD_SHAPE GetFrontShape() const
static bool ClassOf(const EDA_ITEM *aItem)
void SetLocalSolderPasteMarginRatio(std::optional< double > aRatio)
PAD & operator=(const PAD &aOther)
void SetShape(PCB_LAYER_ID aLayer, PAD_SHAPE aShape)
Set the new shape of this pad.
std::shared_ptr< SHAPE_SEGMENT > m_effectiveHoleShape
bool IsLocked() const override
VECTOR2I GetCenter() const override
This defaults to the center of the bounding box if not overridden.
VECTOR2I GetPosition() const override
void SetProperty(PAD_PROP aProperty)
void SetThermalSpokeAngleDegrees(double aAngle)
EDA_ANGLE GetThermalSpokeAngle() const
std::map< PCB_LAYER_ID, ZONE_LAYER_OVERRIDE > m_zoneLayerOverrides
bool ConditionallyFlashed(PCB_LAYER_ID aLayer) const
void Flip(const VECTOR2I &VECTOR2I, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
void Move(const VECTOR2I &aMoveVector) override
Move this object.
std::vector< PCB_SHAPE * > Recombine(bool aIsDryRun, int aMaxError)
Recombines the pad with other graphical shapes in the footprint.
PCB_LAYER_ID GetPrincipalLayer() const
static LSET UnplatedHoleMask()
layer set for a mechanical unplated through hole pad
void SetDelta(PCB_LAYER_ID aLayer, const VECTOR2I &aSize)
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
std::map< PCB_LAYER_ID, std::array< std::shared_ptr< SHAPE_POLY_SET >, 2 > > LAYER_POLYGON_MAP
double GetOrientationDegrees() const
bool SameLogicalPadAs(const PAD *aOther) const
Before we had custom pad shapes it was common to have multiple overlapping pads to represent a more c...
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
void FlipPrimitives(FLIP_DIRECTION aFlipDirection)
Flip (mirror) the primitives left to right or top to bottom, around the anchor position in custom pad...
LAYER_SHAPE_MAP m_effectiveShapes
bool IsNoConnectPad() const
int GetDrillSizeX() const
double GetRoundRectRadiusRatio(PCB_LAYER_ID aLayer) const
void SetKeepTopBottom(bool aSet)
void DeletePrimitivesList(PCB_LAYER_ID aLayer=UNDEFINED_LAYER)
Clear the basic shapes list.
PAD_SHAPE GetShape(PCB_LAYER_ID aLayer) const
void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aMaxError, ERROR_LOC aErrorLoc=ERROR_INSIDE, bool ignoreLineWidth=false) const override
Convert the pad shape to a closed polygon.
void SetNumber(const wxString &aNumber)
Set the pad number (note that it can be alphanumeric, such as the array reference "AA12").
int GetLocalThermalGapOverride(wxString *aSource=nullptr) const
wxString ShowPadAttr() const
void AddPrimitive(PCB_LAYER_ID aLayer, PCB_SHAPE *aPrimitive)
Add item to the custom shape primitives list.
void SetDrillShape(PAD_DRILL_SHAPE aShape)
int m_effectiveBoundingRadius
void SetLocalSolderMaskMargin(std::optional< int > aMargin)
void SetOffset(PCB_LAYER_ID aLayer, const VECTOR2I &aOffset)
bool GetKeepTopBottom() const
void SetLocalZoneConnection(ZONE_CONNECTION aType)
void SetChamferRectRatio(PCB_LAYER_ID aLayer, double aChamferScale)
Has meaning only for chamfered rectangular pads.
int GetSolderMaskExpansion(PCB_LAYER_ID aLayer) const
std::optional< int > GetLocalClearance() const override
Return any local clearances set in the "classic" (ie: pre-rule) system.
void ImportSettingsFrom(const PAD &aMasterPad)
Import the pad settings from aMasterPad.
double Similarity(const BOARD_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
bool IsOnCopperLayer() const override
void SetDrillSizeX(const int aX)
void SetPadstack(const PADSTACK &aPadstack)
void SetPosition(const VECTOR2I &aPos) override
const SHAPE_COMPOUND & buildEffectiveShape(PCB_LAYER_ID aLayer) const
const PADSTACK & Padstack() const
const VECTOR2I & GetOffset(PCB_LAYER_ID aLayer) const
void BuildEffectivePolygon(ERROR_LOC aErrorLoc=ERROR_INSIDE) const
static LSET ConnSMDMask()
layer set for a SMD pad on Front layer used for edge board connectors
void SetDrillSize(const VECTOR2I &aSize)
wxString GetClass() const override
Return the class name.
bool CanFlashLayer(int aLayer)
EDA_ANGLE GetOrientation() const
Return the rotation angle of the pad.
void SetSize(PCB_LAYER_ID aLayer, const VECTOR2I &aSize)
PADSTACK::CUSTOM_SHAPE_ZONE_MODE GetCustomShapeInZoneOpt() const
PAD_DRILL_SHAPE GetDrillShape() const
void ReplacePrimitives(PCB_LAYER_ID aLayer, const std::vector< std::shared_ptr< PCB_SHAPE > > &aPrimitivesList)
Clear the current custom shape primitives list and import a new list.
int GetChamferPositions(PCB_LAYER_ID aLayer) const
static LSET ApertureMask()
layer set for an aperture pad
virtual const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
std::mutex m_polyBuildingLock
void SetRoundRectCornerRadius(PCB_LAYER_ID aLayer, double aRadius)
Has meaning only for rounded rectangle pads.
static LSET SMDMask()
layer set for a SMD pad on Front layer
std::optional< int > GetLocalSolderPasteMargin() const
void CheckPad(UNITS_PROVIDER *aUnitsProvider, const std::function< void(int aErrorCode, const wxString &aMsg)> &aErrorHandler) const
const std::shared_ptr< SHAPE_POLY_SET > & GetEffectivePolygon(PCB_LAYER_ID aLayer, ERROR_LOC aErrorLoc=ERROR_INSIDE) const
void SetChamferPositions(PCB_LAYER_ID aLayer, int aPositions)
Has meaning only for chamfered rectangular pads.
std::optional< int > GetLocalSolderMaskMargin() const
void SetLocalSolderPasteMargin(std::optional< int > aMargin)
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
void addPadPrimitivesToPolygon(PCB_LAYER_ID aLayer, SHAPE_POLY_SET *aMergedPolygon, int aError, ERROR_LOC aErrorLoc) const
void doCheckPad(PCB_LAYER_ID aLayer, UNITS_PROVIDER *aUnitsProvider, const std::function< void(int aErrorCode, const wxString &aMsg)> &aErrorHandler) const
int GetThermalSpokeWidth() const
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
void SetPinFunction(const wxString &aName)
Set the pad function (pin name in schematic)
EDA_ANGLE GetFPRelativeOrientation() const
double GetChamferRectRatio(PCB_LAYER_ID aLayer) const
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
void SetFPRelativeOrientation(const EDA_ANGLE &aAngle)
void SetCustomShapeInZoneOpt(PADSTACK::CUSTOM_SHAPE_ZONE_MODE aOption)
Set the option for the custom pad shape to use as clearance area in copper zones.
int GetBoundingRadius() const
Return the radius of a minimum sized circle which fully encloses this pad.
void ClearZoneLayerOverrides()
void SetOrientation(const EDA_ANGLE &aAngle)
Set the rotation angle of the pad.
std::mutex m_zoneLayerOverridesMutex
PADSTACK::UNCONNECTED_LAYER_MODE GetUnconnectedLayerMode() const
VECTOR2I GetSolderPasteMargin(PCB_LAYER_ID aLayer) const
Usually < 0 (mask shape smaller than pad)because the margin can be dependent on the pad size,...
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
void AppendPrimitives(PCB_LAYER_ID aLayer, const std::vector< std::shared_ptr< PCB_SHAPE > > &aPrimitivesList)
Import a custom shape primitive list (composed of basic shapes) and add items to the current list.
bool HasDrilledHole() const override
LAYER_POLYGON_MAP m_effectivePolygons
void SetLocalClearance(std::optional< int > aClearance)
int GetSubRatsnest() const
void SetSizeX(const int aX)
ZONE_CONNECTION GetLocalZoneConnection() const
void SetThermalSpokeWidth(int aWidth)
Set the width of the thermal spokes connecting the pad to a zone.
bool HasHole() const override
void SetDrillSizeY(const int aY)
double GetThermalSpokeAngleDegrees() const
PAD * ClonePad() const
Same as Clone, but returns a PAD item.
int GetThermalGap() const
VECTOR2I ShapePos(PCB_LAYER_ID aLayer) const
std::shared_ptr< SHAPE_SEGMENT > GetEffectiveHoleShape() const override
Return a SHAPE_SEGMENT object representing the pad's hole.
void SetOrientationDegrees(double aOrientation)
ZONE_CONNECTION GetZoneConnectionOverrides(wxString *aSource=nullptr) const
void SetLayerSet(const LSET &aLayers) override
bool SharesNetTieGroup(const PAD *aOther) const
PAD_SHAPE GetAnchorPadShape(PCB_LAYER_ID aLayer) const
void SetRoundRectRadiusRatio(PCB_LAYER_ID aLayer, double aRadiusScale)
Has meaning only for rounded rectangle pads.
double ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
void SetSubRatsnest(int aSubRatsnest)
int GetLocalSpokeWidthOverride(wxString *aSource=nullptr) const
bool TransformHoleToPolygon(SHAPE_POLY_SET &aBuffer, int aClearance, int aError, ERROR_LOC aErrorLoc=ERROR_INSIDE) const
Build the corner list of the polygonal drill shape in the board coordinate system.
void SetPadToDieLength(int aLength)
bool operator==(const PAD &aOther) const
bool IsType(const std::vector< KICAD_T > &aScanTypes) const override
Check whether the item is one of the listed types.
wxString ShowPadShape(PCB_LAYER_ID aLayer) const
void SetSizeY(const int aY)
int GetPadToDieLength() const
BOX2I m_effectiveBoundingBox
const VECTOR2I & GetSize(PCB_LAYER_ID aLayer) const
virtual std::vector< int > ViewGetLayers() const override
Return the all the layers within the VIEW the object is painted on.
Represent a set of closed polygons.
An abstract shape on 2D plane.
FLASHING
Enum used during connectivity building to ensure we do not query connectivity while building the data...
PCB_LAYER_ID
A quick note on layer IDs:
The Cairo implementation of the graphics abstraction layer.
PAD_DRILL_SHAPE
The set of pad drill shapes, used with PAD::{Set,Get}DrillShape()
PAD_ATTRIB
The set of pad shapes, used with PAD::{Set,Get}Attribute().
PAD_SHAPE
The set of pad shapes, used with PAD::{Set,Get}Shape()
PAD_PROP
The set of pad properties used in Gerber files (Draw files, and P&P files) to define some properties ...
VECTOR2I size
Drill diameter (x == y) or slot dimensions (x != y)
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
@ PCB_PAD_T
class PAD, a pad in a footprint
ZONE_CONNECTION
How pads are covered by copper in zone.