92 return static_cast<const BOARD*
>( this );
101 return static_cast<BOARD*
>( this );
130 owningIndex->Rebind( *
this, aUuid );
148 if(
group->AsEdaItem()->IsLocked() )
161 wxFAIL_MSG( wxString(
"GetStroke() not defined by " ) +
GetClass() );
169 wxFAIL_MSG( wxString(
"SetStroke() not defined by " ) +
GetClass() );
182 return board->GetDesignSettings().m_MaxError;
191 wxString::Format( wxT(
"GetLayer() must be overridden for multi-layer types (%s)." ),
GetClass() ) );
204 return ::FlipLayer( aLayer );
291 if( (
int) copperLayers.count() == copperLayerCount )
292 return _(
"all copper layers" );
294 for(
LSET testLayers : { copperLayers, techLayers, layers } )
298 if( testLayers[ layer ] )
303 if( testLayers.count() > 1 )
304 layerInfo << wxS(
" " ) +
_(
"and others" );
312 return _(
"no layers" );
345 if( aImage ==
nullptr )
380 if( addToParentGroup )
382 wxCHECK_MSG( aCommit, dupe,
"Must supply a commit to update parent group" );
387 group->AddItem( dupe );
396 int aClearance,
int aError,
ERROR_LOC aErrorLoc,
397 bool ignoreLineWidth )
const
399 wxCHECK_MSG(
false, ,
400 wxString::Format( wxT(
"%s doesn't implement TransformShapeToPolygon()" ),
GetClass() ) );
418 for(
int jj = 0; jj < aPolySet.
HoleCount( ii ); jj++ )
422 return aPolySet.
Area();
443 static std::shared_ptr<SHAPE> shape;
453 static std::shared_ptr<SHAPE_SEGMENT> slot;
464 return parentFP->GetTransform().InverseApply(
GetPosition() );
473 SetPosition( parentFP->GetTransform().Apply( aPos ) );
481 wxMessageBox( wxT(
"virtual BOARD_ITEM::Rotate used, should not occur" ),
GetClass() );
487 wxMessageBox( wxT(
"virtual BOARD_ITEM::Flip used, should not occur" ),
GetClass() );
493 wxMessageBox( wxT(
"virtual BOARD_ITEM::Mirror used, should not occur" ),
GetClass() );
500 return fp->GetReference();
509 return board->GetFontFiles();
521 if( layerEnum.
Choices().GetCount() == 0 )
538 auto isNotFootprintHolder =
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
constexpr int ARC_HIGH_DEF
constexpr EDA_IU_SCALE pcbIUScale
constexpr int ARC_LOW_DEF
LAYER_T
The allowed types of layers, same as Specctra DSN spec.
#define DEFAULT_LINE_WIDTH
static struct BOARD_ITEM_DESC _BOARD_ITEM_DESC
Abstract interface for BOARD_ITEMs capable of storing other items inside.
virtual void Remove(BOARD_ITEM *aItem, REMOVE_MODE aMode=REMOVE_MODE::NORMAL)=0
Removes an item from the container.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
BOARD_ITEM(BOARD_ITEM *aParent, KICAD_T idtype, PCB_LAYER_ID aLayer=F_Cu)
virtual void Mirror(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection)
Mirror this object relative to a given horizontal axis the layer is not changed.
void SetUuidDirect(const KIID &aUuid)
Raw UUID assignment.
bool IsGroupableType() const
virtual BOARD_ITEM * Duplicate(bool addToParentGroup, BOARD_COMMIT *aCommit=nullptr) const
Create a copy of this BOARD_ITEM.
void DeleteStructure()
Delete this object after removing from its parent if it has one.
const std::vector< wxString > * GetEmbeddedFonts() override
void SwapItemData(BOARD_ITEM *aImage)
Swap data between aItem and aImage.
void SetLocked(bool aLocked) override
virtual STROKE_PARAMS GetStroke() const
PCB_LAYER_ID GetFlippedLayer(PCB_LAYER_ID aLayer) const
Return the layer paired with aLayer on the opposite side of the board.
virtual int BoardLayerCount() const
Return the total number of layers for the board that this item resides on.
virtual void SetStroke(const STROKE_PARAMS &aStroke)
void SetUuid(const KIID &aUuid)
static double polygonArea(SHAPE_POLY_SET &aPolySet)
Area of aPolySet with every contour closed first, holes subtracted.
wxString GetParentAsString() const
For "parent" property.
virtual std::shared_ptr< SHAPE_SEGMENT > GetEffectiveHoleShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, DRC_CONSTRAINT_T aUsage=NULL_CONSTRAINT) const
bool IsLocked() const override
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
virtual void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const
Convert the item shape to a closed polygon.
virtual void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle)
Rotate this object.
virtual double GetCoverageArea(int aTextMargin) const
Return the board area this item covers, used to rank candidates under the cursor so a click on a smal...
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
virtual std::vector< int > ViewGetLayers() const override
Return the all the layers within the VIEW the object is painted on.
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
FOOTPRINT * GetParentFootprint() const
VECTOR2I GetFPRelativePosition() const
virtual LSET BoardLayerSet() const
Return the LSET for the board that this item resides on.
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
virtual bool IsLayerAgnostic() const
Check if this item's layer set must not be confined to a board's enabled layers.
virtual void swapData(BOARD_ITEM *aImage)
const KIFONT::METRICS & GetFontMetrics() const
friend class BOARD_ITEM_INDEX
void SetFPRelativePosition(const VECTOR2I &aPos)
virtual wxString LayerMaskDescribe() const
Return a string (to be shown to the user) describing a layer mask.
virtual bool FitsEnabledLayers(const LSET &aEnabledLayers, int aCopperLayerCount) const
Check if a board offering aEnabledLayers can hold this item.
virtual void CopyFrom(const BOARD_ITEM *aOther)
BOARD_ITEM_INDEX * m_owningIndex
Board index that indexes this item, or nullptr.
BOARD_ITEM_CONTAINER * GetParent() const
bool IsSideSpecific() const
virtual int BoardCopperLayerCount() const
Return the total number of copper layers for the board that this item resides on.
virtual std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=FLASHING::DEFAULT, DRC_CONSTRAINT_T aUsage=NULL_CONSTRAINT) const
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
wxString GetLayerName() const
Return the name of the PCB layer on which the item resides.
virtual void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection)
Flip this object, i.e.
Information pertinent to a Pcbnew printed circuit board.
bool IsFootprintHolder() const
Find out if the board is being used to hold a single footprint for editing/viewing.
void CacheChildrenById(const BOARD_ITEM &aParent)
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Return an "English Standard" name of a PCB layer when given aLayerNumber.
LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayer) const
int GetCopperLayerCount() const
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
const LSET & GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
void UncacheChildrenById(const BOARD_ITEM &aParent)
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
A set of EDA_ITEMs (i.e., without duplicates).
A base class for most all the KiCad significant classes used in schematics and boards.
virtual VECTOR2I GetPosition() const
virtual void SetPosition(const VECTOR2I &aPos)
virtual EDA_GROUP * GetParentGroup() const
KICAD_T Type() const
Returns the type of object.
virtual void SetParentGroup(EDA_GROUP *aGroup)
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
virtual void SetParent(EDA_ITEM *aParent)
EDA_ITEM * m_parent
Owner.
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
EDA_ITEM * findParent(KICAD_T aType) const
ENUM_MAP & Map(T aValue, const wxString &aName)
static ENUM_MAP< T > & Instance()
ENUM_MAP & Undefined(T aValue)
Class that other classes need to inherit from, in order to be inspectable.
static const METRICS & Default()
virtual wxString GetClass() const =0
Return the class name.
LSET is a set of PCB_LAYER_IDs.
static const LSET & AllCuMask()
return AllCuMask( MAX_CU_LAYERS );
static const LSET & SideSpecificMask()
LSEQ Seq(const LSEQ &aSequence) const
Return an LSEQ from the union of this LSET and a desired sequence.
static const LSET & AllTechMask()
Return a mask holding all technical layers (no CU layer) on both side.
static const LSET & AllLayersMask()
static wxString Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
PROPERTY_BASE & SetAvailableFunc(std::function< bool(INSPECTABLE *)> aFunc)
Set a callback function to determine whether an object provides this property.
PROPERTY_BASE & SetIsCopyable(bool aIsCopyable=true)
PROPERTY_BASE & SetIsHiddenFromPropertiesManager(bool aHide=true)
PROPERTY_BASE & SetIsHiddenFromLibraryEditors(bool aIsHidden=true)
void InheritsAfter(TYPE_ID aDerived, TYPE_ID aBase)
Declare an inheritance relationship between types.
static PROPERTY_MANAGER & Instance()
PROPERTY_BASE & AddProperty(PROPERTY_BASE *aProperty, const wxString &aGroup=wxEmptyString)
Register a property.
void SetClosed(bool aClosed)
Mark the line chain as closed (i.e.
Represent a set of closed polygons.
double Area()
Return the area of this poly set.
int HoleCount(int aOutline) const
Returns the number of holes in a given outline.
SHAPE_LINE_CHAIN & Outline(int aIndex)
Return the reference to aIndex-th outline in the set.
SHAPE_LINE_CHAIN & Hole(int aOutline, int aHole)
Return the reference to aHole-th hole in the aIndex-th outline.
int OutlineCount() const
Return the number of outlines in the set.
Simple container to manage line stroke parameters.
A type-safe container of any type.
Some functions to handle hotkeys in KiCad.
wxString LayerName(int aLayer)
Returns the default display name for a given layer.
constexpr PCB_LAYER_ID PCBNEW_LAYER_ID_START
FLASHING
Enum used during connectivity building to ensure we do not query connectivity while building the data...
@ LAYER_LOCKED_ITEM_SHADOW
Shadow layer for locked items.
PCB_LAYER_ID
A quick note on layer IDs:
PCB_LAYER_ID ToLAYER_ID(int aLayer)
This file contains miscellaneous commonly used macros and functions.
#define UNIMPLEMENTED_FOR(type)
Class to handle a set of BOARD_ITEMs.
#define TYPE_HASH(x)
Macro to generate unique identifier for a type.
#define IMPLEMENT_ENUM_TO_WXANY(type)
#define NO_SETTER(owner, type)
Macro to define read-only fields (no setter method available)
@ PT_COORD
Coordinate expressed in distance units (mm/inch)
#define REGISTER_TYPE(x)
Helper macro to map type hashes to names.
bool operator()(const BOARD_ITEM *a, const BOARD_ITEM *b) const
constexpr bool IsSingleLayerType(const KICAD_T aType)
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
@ PCB_DIM_ORTHOGONAL_T
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
@ PCB_DIM_LEADER_T
class PCB_DIM_LEADER, a leader dimension (graphic item)
@ PCB_GENERATOR_T
class PCB_GENERATOR, generator on a layer
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
@ PCB_DRILL_MAP_T
class PCB_DRILL_MAP, drill symbols drawn at the holes
@ PCB_DIM_CENTER_T
class PCB_DIM_CENTER, a center point marking (graphic item)
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
@ PCB_TEXTBOX_T
class PCB_TEXTBOX, wrapped text on a layer
@ PCB_ZONE_T
class ZONE, a copper pour area
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
@ PCB_REFERENCE_IMAGE_T
class PCB_REFERENCE_IMAGE, bitmap on a layer
@ PCB_FIELD_T
class PCB_FIELD, text associated with a footprint property
@ PCB_BARCODE_T
class PCB_BARCODE, a barcode (graphic item)
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
@ PCB_GRID_ITEM_T
a subgrid placed on a board
@ PCB_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
@ PCB_PAD_T
class PAD, a pad in a footprint
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
@ PCB_DIMENSION_T
class PCB_DIMENSION_BASE: abstract dimension meta-type
@ PCB_TABLE_T
class PCB_TABLE, table of PCB_TABLECELLs
@ PCB_POINT_T
class PCB_POINT, a 0-dimensional point
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
@ PCB_DIM_RADIAL_T
class PCB_DIM_RADIAL, a radius or diameter dimension
@ PCB_DRILL_CHART_T
class PCB_DRILL_CHART, a live drill chart derived from PCB_TABLE
VECTOR2< int32_t > VECTOR2I