54 if(
m_items.erase( aItem ) == 1 )
67 item->SetParentGroup(
nullptr );
77 if( isFootprintEditor )
89 while(
group &&
group->GetParentGroup() &&
group->GetParentGroup() != aScope )
104 return candidate == aScope ? nullptr : candidate;
112 return candidate == aScope;
134 if( ( item->Type() ==
PCB_GROUP_T ) && ( aDepth > 0 ) )
136 static_cast<PCB_GROUP*>( item )->SetLayerRecursive( aLayer, aDepth - 1 );
140 item->SetLayer( aLayer );
175 newGroup->
AddItem( static_cast<PCB_GROUP*>( member )->DeepClone() );
177 newGroup->
AddItem( static_cast<BOARD_ITEM*>( member->Clone() ) );
192 newGroup->
AddItem( static_cast<PCB_GROUP*>( member )->DeepDuplicate() );
194 newGroup->
AddItem( static_cast<BOARD_ITEM*>( member->Duplicate() ) );
228 area.
Merge( item->GetBoundingBox() );
238 for(
const KICAD_T* stype = aScanTypes; *stype !=
EOT; ++stype )
241 if( *stype ==
Type() )
257 aSet |= item->GetLayerSet();
268 if( item->IsOnLayer( aLayer ) )
288 return std::numeric_limits<double>::max();
295 member->Move( aMoveVector );
302 item->Rotate( aRotCentre, aAngle );
309 item->Flip( aCentre, aFlipLeftRight );
335 aList.emplace_back(
_(
"Group" ),
m_name.empty() ?
_(
"<unnamed>" ) :
m_name );
339 aList.emplace_back(
_(
"Status" ),
_(
"Locked" ) );
350 catch( std::bad_function_call& )
352 wxFAIL_MSG( wxT(
"Error calling function in PCB_GROUP::RunOnChildren" ) );
366 static_cast<PCB_GROUP*>( item )->RunOnDescendants( aFunction );
369 catch( std::bad_function_call& )
371 wxFAIL_MSG( wxT(
"Error calling function in PCB_GROUP::RunOnDescendants" ) );
PCB_GROUP * GetParentGroup() const
void ViewGetLayers(int aLayers[], int &aCount) const override
bool AddItem(BOARD_ITEM *aItem)
Add item to group.
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Return a pointer to an image to be used in menus.
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
void SetLocked(bool aLocked) override
Create a duplicate of this item with linked list members set to NULL.
void Merge(const EDA_RECT &aRect)
Modify the position and size of the rectangle in order to contain aRect.
void SwapData(BOARD_ITEM *aImage) override
Test to see if this object is on the given layer.
This file is part of the common library.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
class PCB_GROUP, a set of BOARD_ITEMs
A set of BOARD_ITEMs (i.e., without duplicates).
PCB_GROUP * getTopLevelGroup(BOARD_ITEM *aItem, PCB_GROUP *aScope, bool isFootprintEditor)
wxPoint GetPosition() const override
SEARCH_RESULT Visit(INSPECTOR aInspector, void *aTestData, const KICAD_T aScanTypes[]) override
anchor of items having an anchor point (texts, footprints)
PCB_GROUP * DeepClone() const
static PCB_GROUP * TopLevelGroup(BOARD_ITEM *aItem, PCB_GROUP *aScope, bool isFootprintEditor)
virtual void SetLocked(bool aLocked)
Modify the 'lock' status for of the item.
const EDA_RECT GetBoundingBox() const override
May be re-implemented for each derived class in order to handle all the types given by its member dat...
The base class for create windows for drawing purpose.
virtual bool IsLocked() const
void Flip(const wxPoint &aCentre, bool aFlipLeftRight) override
Return the text to display to be used in the selection clarification context menu when multiple items...
PCB_GROUP * DeepDuplicate() const
Swap data between aItem and aImage.
const INSPECTOR_FUNC & INSPECTOR
search types array terminator (End Of Types)
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
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.
void Rotate(const wxPoint &aRotCentre, double aAngle) override
Flip this object, i.e.
LSET is a set of PCB_LAYER_IDs.
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
void Move(const wxPoint &aMoveVector) override
Rotate this object.
LSET GetLayerSet() const override
Set the layer this item is on.
bool RemoveItem(BOARD_ITEM *aItem)
Remove item from group.
static bool WithinScope(BOARD_ITEM *aItem, PCB_GROUP *aScope, bool isFootprintEditor)
void RunOnDescendants(const std::function< void(BOARD_ITEM *)> &aFunction) const
Invoke a function on all descendants of the group.
double ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Move this object.
class FOOTPRINT, a footprint
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test if aPosition is inside or on the boundary of this item.
BITMAPS
A list of all bitmap identifiers.
void SetLayerRecursive(PCB_LAYER_ID aLayer, int aDepth)
Set layer for all items within the group.
void SetPosition(const wxPoint &aNewpos) override
Return a std::bitset of all layers on which the item physically resides.
PCB_LAYER_ID
A quick note on layer IDs:
Handle the component boundary box.
A base class for most all the KiCad significant classes used in schematics and boards.
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction) const
Invoke a function on all members of the group.
#define PCB_EDIT_FRAME_NAME
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Message panel definition file.
BOARD_ITEM_CONTAINER * GetParent() const
static constexpr int Millimeter2iu(double mm)
std::unordered_set< BOARD_ITEM * > m_items
PCB_GROUP(BOARD_ITEM *aParent)
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
virtual BOARD_ITEM * Duplicate() const
Create a copy of this BOARD_ITEM.
KICAD_T Type() const
Returns the type of object.
bool IsLayerVisible(int aLayer) const
Return information about visibility of a particular layer.
void SetParentGroup(PCB_GROUP *aGroup)