84 wxT(
"Invalid item type added to group: " ) + aItem->
GetTypeDesc() );
99 if(
m_items.erase( aItem ) == 1 )
112 item->SetParentGroup(
nullptr );
136 if(
group == aScope )
139 while(
group &&
group->GetParentGroup() &&
group->GetParentGroup() != aScope )
272 bbox.
Merge( item->GetBoundingBox() );
283 std::shared_ptr<SHAPE_COMPOUND> shape = std::make_shared<SHAPE_COMPOUND>();
286 shape->AddShape( item->GetEffectiveShape( aLayer, aFlash )->Clone() );
293 const std::vector<KICAD_T>& aScanTypes )
295 for(
KICAD_T scanType : aScanTypes )
297 if( scanType ==
Type() )
299 if( INSPECT_RESULT::QUIT == aInspector(
this, aTestData ) )
300 return INSPECT_RESULT::QUIT;
304 return INSPECT_RESULT::CONTINUE;
313 aSet |= item->GetLayerSet();
324 if( item->IsOnLayer( aLayer ) )
344 return std::numeric_limits<double>::max();
351 member->Move( aMoveVector );
358 item->Rotate( aRotCentre, aAngle );
365 item->Flip( aCentre, aFlipDirection );
372 return wxString::Format(
_(
"Unnamed Group, %zu members" ),
m_items.size() );
374 return wxString::Format(
_(
"Group '%s', %zu members" ),
m_name,
m_items.size() );
380 return BITMAPS::module;
386 aList.emplace_back(
_(
"Group" ),
m_name.empty() ?
_(
"<unnamed>" ) :
m_name );
387 aList.emplace_back(
_(
"Members" ), wxString::Format( wxT(
"%zu" ),
m_items.size() ) );
390 aList.emplace_back(
_(
"Status" ),
_(
"Locked" ) );
401 catch( std::bad_function_call& )
403 wxFAIL_MSG( wxT(
"Error calling function in PCB_GROUP::RunOnChildren" ) );
422 item->RunOnDescendants( aFunction, aDepth + 1 );
425 catch( std::bad_function_call& )
427 wxFAIL_MSG( wxT(
"Error calling function in PCB_GROUP::RunOnDescendants" ) );
439 return *
this == other;
453 for(
auto it1 = itemSet.begin(), it2 = otherItemSet.begin(); it1 != itemSet.end(); ++it1, ++it2 )
457 if( ( *it1 )->m_Uuid != ( *it2 )->m_Uuid )
472 double similarity = 0.0;
482 return similarity /
m_items.size();
499 const wxString groupTab =
_HKI(
"Group Properties" );
constexpr EDA_IU_SCALE pcbIUScale
BITMAPS
A list of all bitmap identifiers.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
void SetParentGroup(PCB_GROUP *aGroup)
virtual void SetLocked(bool aLocked)
PCB_GROUP * GetParentGroup() const
virtual BOARD_ITEM * Duplicate() const
Create a copy of this BOARD_ITEM.
virtual bool IsLocked() const
BOARD_ITEM_CONTAINER * GetParent() const
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
constexpr Vec Centre() const
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
wxString GetTypeDesc() const
Return a translated description of the type for this EDA_ITEM for display in user facing messages.
KICAD_T Type() const
Returns the type of object.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
bool IsLayerVisible(int aLayer) const
Return information about visibility of a particular layer.
LSET is a set of PCB_LAYER_IDs.
A set of BOARD_ITEMs (i.e., without duplicates).
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
std::unordered_set< BOARD_ITEM * > m_items
static bool WithinScope(BOARD_ITEM *aItem, PCB_GROUP *aScope, bool isFootprintEditor)
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
PCB_GROUP * DeepClone() const
static PCB_GROUP * TopLevelGroup(BOARD_ITEM *aItem, PCB_GROUP *aScope, bool isFootprintEditor)
void RunOnDescendants(const std::function< void(BOARD_ITEM *)> &aFunction, int aDepth=0) const override
Invoke a function on all descendants.
static bool IsGroupableType(KICAD_T aType)
Check if the proposed type can be added to a group.
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
double ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
bool operator==(const PCB_GROUP &aOther) const
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
PCB_GROUP * DeepDuplicate() const
LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
void SetName(const wxString &aName)
void SetPosition(const VECTOR2I &aNewpos) override
void Move(const VECTOR2I &aMoveVector) override
Move this object.
double Similarity(const BOARD_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
INSPECT_RESULT Visit(INSPECTOR aInspector, void *aTestData, const std::vector< KICAD_T > &aScanTypes) override
May be re-implemented for each derived class in order to handle all the types given by its member dat...
virtual bool RemoveItem(BOARD_ITEM *aItem)
Remove item from group.
std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=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.
VECTOR2I GetPosition() const override
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
virtual bool AddItem(BOARD_ITEM *aItem)
Add item to group.
void ViewGetLayers(int aLayers[], int &aCount) const override
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction) const override
Invoke a function on all descendants.
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
PCB_GROUP(BOARD_ITEM *aParent)
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
void swapData(BOARD_ITEM *aImage) override
void SetLocked(bool aLocked) override
Provide class metadata.Helper macro to map type hashes to names.
void InheritsAfter(TYPE_ID aDerived, TYPE_ID aBase)
Declare an inheritance relationship between types.
void Mask(TYPE_ID aDerived, TYPE_ID aBase, const wxString &aName)
Sets a base class property as masked in a derived class.
static PROPERTY_MANAGER & Instance()
PROPERTY_BASE & AddProperty(PROPERTY_BASE *aProperty, const wxString &aGroup=wxEmptyString)
Register a property.
void AddTypeCast(TYPE_CAST_BASE *aCast)
Register a type converter.
This file is part of the common library.
#define PCB_EDIT_FRAME_NAME
std::set< EDA_ITEM *, CompareByUuid > EDA_ITEM_SET
const INSPECTOR_FUNC & INSPECTOR
FLASHING
Enum used during connectivity building to ensure we do not query connectivity while building the data...
@ LAYER_ANCHOR
anchor of items having an anchor point (texts, footprints)
PCB_LAYER_ID
A quick note on layer IDs:
Message panel definition file.
PCB_GROUP * getNestedGroup(BOARD_ITEM *aItem, PCB_GROUP *aScope, bool isFootprintEditor)
Returns the top level group inside the aScope group, or nullptr.
static struct PCB_GROUP_DESC _PCB_GROUP_DESC
PCB_GROUP * getClosestGroup(BOARD_ITEM *aItem, bool isFootprintEditor)
Class to handle a set of BOARD_ITEMs.
constexpr int mmToIU(double mm) const
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
@ 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_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_FOOTPRINT_T
class FOOTPRINT, a footprint
@ 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_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