38#include <api/board/board_types.pb.h>
39#include <google/protobuf/any.pb.h>
64 kiapi::common::types::KIID* itemId =
group.add_items();
65 itemId->set_value( item->m_Uuid.AsStdString() );
68 aContainer.PackFrom(
group );
74 kiapi::board::types::Group
group;
76 if( !aContainer.UnpackTo( &
group ) )
87 for(
const kiapi::common::types::KIID& itemId :
group.items() )
89 KIID id( itemId.value() );
100 std::unordered_set<BOARD_ITEM*> items;
104 if( item->IsBOARD_ITEM() )
105 items.insert(
static_cast<BOARD_ITEM*
>( item ) );
130 if(
group == aScope )
133 while(
group &&
group->AsEdaItem()->GetParentGroup() &&
group->AsEdaItem()->GetParentGroup() != aScope )
187 RECURSE_MODE::NO_RECURSE );
241 std::swap( *
this, *
image );
275 bbox.
Merge( item->GetBoundingBox() );
286 std::shared_ptr<SHAPE_COMPOUND> shape = std::make_shared<SHAPE_COMPOUND>();
289 shape->AddShape( item->GetEffectiveShape( aLayer, aFlash )->Clone() );
296 const std::vector<KICAD_T>& aScanTypes )
298 for(
KICAD_T scanType : aScanTypes )
300 if( scanType ==
Type() )
302 if( INSPECT_RESULT::QUIT == aInspector(
this, aTestData ) )
303 return INSPECT_RESULT::QUIT;
307 return INSPECT_RESULT::CONTINUE;
367 static_cast<BOARD_ITEM*
>( item )->
Flip( aCentre, aFlipDirection );
381 return wxString::Format(
_(
"Unnamed Group, %zu members" ),
m_items.size() );
383 return wxString::Format(
_(
"Group '%s', %zu members" ),
m_name,
m_items.size() );
389 return BITMAPS::module;
395 aList.emplace_back(
_(
"Group" ),
m_name.empty() ?
_(
"<unnamed>" ) :
m_name );
396 aList.emplace_back(
_(
"Members" ), wxString::Format( wxT(
"%zu" ),
m_items.size() ) );
399 aList.emplace_back(
_(
"Status" ),
_(
"Locked" ) );
419 item->RunOnChildren( aFunction, RECURSE_MODE::RECURSE );
423 catch( std::bad_function_call& )
425 wxFAIL_MSG( wxT(
"Error calling function in PCB_GROUP::RunOnChildren" ) );
437 return *
this == other;
451 for(
auto it1 = itemSet.begin(), it2 = otherItemSet.begin(); it1 != itemSet.end(); ++it1, ++it2 )
455 if( ( *it1 )->m_Uuid != ( *it2 )->m_Uuid )
470 double similarity = 0.0;
480 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...
virtual BOARD_ITEM * Duplicate(bool addToParentGroup, BOARD_COMMIT *aCommit=nullptr) const
Create a copy of this BOARD_ITEM.
void SetLocked(bool aLocked) override
bool IsLocked() const override
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
BOARD_ITEM_CONTAINER * GetParent() const
Information pertinent to a Pcbnew printed circuit board.
BOARD_ITEM * ResolveItem(const KIID &aID, bool aAllowNullptrReturn=false) 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 set of EDA_ITEMs (i.e., without duplicates).
std::unordered_set< EDA_ITEM * > m_items
std::unordered_set< EDA_ITEM * > & GetItems()
void AddItem(EDA_ITEM *aItem)
Add item to group.
virtual EDA_ITEM * AsEdaItem()=0
void SetName(const wxString &aName)
A base class for most all the KiCad significant classes used in schematics and boards.
virtual EDA_GROUP * GetParentGroup() const
KICAD_T Type() const
Returns the type of object.
virtual bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const
Compare the item against the search criteria in aSearchData.
static constexpr double LOD_HIDE
Return this constant from ViewGetLOD() to hide the item unconditionally.
static constexpr double LOD_SHOW
Return this constant from ViewGetLOD() to show the item unconditionally.
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.
std::string AsStdString() const
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.
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.
bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const override
Compare the item against the search criteria in aSearchData.
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction, RECURSE_MODE aMode) const override
Invoke a function on all children.
PCB_GROUP * DeepClone() const
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
void Mirror(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Mirror this object relative to a given horizontal axis the layer is not changed.
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
static EDA_GROUP * TopLevelGroup(BOARD_ITEM *aItem, EDA_GROUP *aScope, bool isFootprintEditor)
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.
LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
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...
double ViewGetLOD(int aLayer, const KIGFX::VIEW *aView) const override
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.
std::unordered_set< BOARD_ITEM * > GetBoardItems() const
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.
PCB_GROUP * DeepDuplicate(bool addToParentGroup, BOARD_COMMIT *aCommit=nullptr) const
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
std::vector< int > ViewGetLayers() const 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.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
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
std::function passed to nested users by ref, avoids copying std::function.
#define IGNORE_PARENT_GROUP
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.
EDA_GROUP * getClosestGroup(BOARD_ITEM *aItem, bool isFootprintEditor)
static struct PCB_GROUP_DESC _PCB_GROUP_DESC
EDA_GROUP * getNestedGroup(BOARD_ITEM *aItem, EDA_GROUP *aScope, bool isFootprintEditor)
Returns the top level group inside the aScope group, or nullptr.
Class to handle a set of BOARD_ITEMs.
EDA_GROUP * getNestedGroup(SCH_ITEM *aItem, EDA_GROUP *aScope, bool isSymbolEditor)
Returns the top level group inside the aScope group, or nullptr.
EDA_GROUP * getClosestGroup(SCH_ITEM *aItem, bool isSymbolEditor)
wxString UnescapeString(const wxString &aSource)
constexpr int mmToIU(double mm) const
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
@ PCB_GENERATOR_T
class PCB_GENERATOR, generator on a layer
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint