25 #ifndef BOARD_ITEM_STRUCT_H 26 #define BOARD_ITEM_STRUCT_H 36 #include <wx/msgdlg.h> 64 case S_RECT:
return "S_RECT";
65 case S_ARC:
return "S_ARC";
69 case S_LAST:
return "S_LAST";
121 wxPoint p( aX,
GetY() );
127 wxPoint p(
GetX(), aY );
181 wxFAIL_MSG(
"Attempted to SetLayerSet() on a single-layer object." );
207 return static_cast<BOARD_ITEM*>( dupe );
277 virtual void Move(
const wxPoint& aMoveVector )
279 wxFAIL_MSG(
wxString::Format( wxT(
"virtual BOARD_ITEM::Move called for %s" ),
285 Move( wxPoint( aMoveVector.
x, aMoveVector.
y ) );
294 virtual void Rotate(
const wxPoint& aRotCentre,
double aAngle )
296 wxMessageBox( wxT(
"virtual BOARD_ITEM::Rotate used, should not occur" ),
GetClass() );
301 Rotate( wxPoint( aRotCentre.
x, aRotCentre.
y ), aAngle );
310 virtual void Flip(
const wxPoint& aCentre,
bool aFlipLeftRight )
312 wxMessageBox( wxT(
"virtual BOARD_ITEM::Flip used, should not occur" ),
GetClass() );
317 Flip( wxPoint( aCentre.
x, aCentre.
y ), aFlipLeftRight );
332 virtual void ViewGetLayers(
int aLayers[],
int& aCount )
const override;
349 bool ignoreLineWidth =
false )
const;
386 return _(
"(Deleted Item)" );
391 return wxT(
"DELETED_BOARD_ITEM" );
409 void Show(
int , std::ostream& )
const override {}
PCB_GROUP * GetParentGroup() const
EDA_ITEM * m_parent
Linked list: Link (parent struct)
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
virtual void SetPosition(const wxPoint &aPos)
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
wxString GetClass() const override
Return the class name.
wxPoint GetPosition() const override
PCB_GROUP is a set of BOARD_ITEMs (i.e., without duplicates)
the 3d code uses this value
polygon (not yet used for tracks, but could be in microwave apps)
virtual void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
void DeleteStructure()
Delete this object after removing from its parent if it has one.
bool IsTrack() const
Test to see if this object is a track or via (or microvia).
virtual void Flip(const wxPoint &aCentre, bool aFlipLeftRight)
Flip this object, i.e.
static wxString ShowShape(PCB_SHAPE_TYPE_T aShape)
Convert the enum PCB_SHAPE_TYPE_T integer value to a wxString.
usual segment : line with rounded ends
virtual void SetLocked(bool aLocked)
Modify the 'lock' status for of the item.
virtual wxPoint GetPosition() const
A singleton item of this class is returned for a weak reference that no longer exists.
virtual void SetLayerSet(LSET aLayers)
segment with non rounded ends
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
static wxPoint ZeroOffset
A value of wxPoint(0,0) which can be passed to the Draw() functions.
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
class TRACK, a track segment (segment on a copper layer)
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
DECLARE_ENUM_TO_WXANY(PCB_LAYER_ID)
virtual void SwapData(BOARD_ITEM *aImage)
Swap data between aItem and aImage.
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
virtual wxString layerMaskDescribe() const
Return a string (to be shown to the user) describing a layer mask.
PCB_LAYER_ID
A quick note on layer IDs:
PCB_SHAPE_TYPE_T
The set of shapes for PCB graphics and tracks and footprint graphics in the .m_Shape member.
LSET is a set of PCB_LAYER_IDs.
virtual bool IsOnLayer(PCB_LAYER_ID aLayer) const
Test to see if this object is on the given layer.
virtual void Move(const wxPoint &aMoveVector)
Move this object.
static DELETED_BOARD_ITEM * GetInstance()
static wxString PCB_SHAPE_TYPE_T_asString(PCB_SHAPE_TYPE_T a)
virtual BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
virtual wxPoint GetCenter() const
This defaults to the center of the bounding box if not overridden.
a few functions useful in geometry calculations.
void SetPosition(const wxPoint &) override
virtual void Rotate(const wxPoint &aRotCentre, double aAngle)
Rotate this object.
void Move(const VECTOR2I &aMoveVector)
#define LOCKED
Pcbnew: locked from movement and deletion.
BOARD_ITEM(BOARD_ITEM *aParent, KICAD_T idtype)
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
virtual bool IsLocked() const
virtual wxString GetClass() const =0
Return the class name.
void SetState(int type, int state)
Board layer functions and definitions.
Information pertinent to a Pcbnew printed circuit board.
bool operator()(const BOARD_ITEM *a, const BOARD_ITEM *b) const
A base class for most all the KiCad significant classes used in schematics and boards.
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
virtual std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER) const
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
virtual bool IsConnected() const
Returns information if the object is derived from BOARD_CONNECTED_ITEM.
virtual BOARD_ITEM * Duplicate() const
Create a copy of a of this BOARD_ITEM.
class VIA, a via (like a track segment on a copper layer)
virtual void TransformShapeWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, PCB_LAYER_ID aLayer, int aClearanceValue, int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const
Convert the item shape to a closed polygon.
Abstract interface for BOARD_ITEMs capable of storing other items inside.
virtual const EDA_RECT GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
const wxPoint GetCenter() const
BOARD_ITEM_CONTAINER * GetParent() const
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight)
wxString GetLayerName() const
Return the name of the PCB layer on which the item resides.
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
int GetState(int type) const
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
virtual bool IsOnCopperLayer() const
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
void Rotate(const VECTOR2I &aRotCentre, double aAngle)
KICAD_T Type() const
Returns the type of object.
void SetParentGroup(PCB_GROUP *aGroup)