KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcb_group.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2020 Joshua Redstone redstone at gmail.com
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20#include "pcb_group.h"
21
22#include <bitmaps.h>
23#include <eda_draw_frame.h>
25#include <board.h>
26#include <board_item.h>
27#include <confirm.h>
28#include <footprint.h>
29#include <pcb_generator.h>
30#include <string_utils.h>
31#include <widgets/msgpanel.h>
32#include <view/view.h>
33#include <api/api_enums.h>
34#include <api/api_utils.h>
35#include <api/api_pcb_utils.h>
36#include <api/board/board_types.pb.h>
37#include <google/protobuf/any.pb.h>
38
39#include <wx/debug.h>
40#include <properties/property.h>
42
44 BOARD_ITEM( aParent, PCB_GROUP_T )
45{
46}
47
48
50 BOARD_ITEM( aParent, idtype, aLayer )
51{
52}
53
54void PCB_GROUP::Serialize( google::protobuf::Any &aContainer ) const
55{
56 using namespace kiapi::board::types;
57 Group group;
58
59 group.mutable_id()->set_value( m_Uuid.AsStdString() );
60 group.set_name( GetName().ToUTF8() );
61
62 for( EDA_ITEM* item : GetItems() )
63 {
64 kiapi::common::types::KIID* itemId = group.add_items();
65 itemId->set_value( item->m_Uuid.AsStdString() );
66 }
67
68 aContainer.PackFrom( group );
69}
70
71
72bool PCB_GROUP::Deserialize( const google::protobuf::Any &aContainer )
73{
74 kiapi::board::types::Group group;
75
76 if( !aContainer.UnpackTo( &group ) )
77 return false;
78
79 SetUuidDirect( KIID( group.id().value() ) );
80 SetName( wxString( group.name().c_str(), wxConvUTF8 ) );
81
82 BOARD* board = GetBoard();
83
84 if( !board )
85 return false;
86
87 for( const kiapi::common::types::KIID& itemId : group.items() )
88 {
89 KIID id( itemId.value() );
90
91 if( BOARD_ITEM* item = board->ResolveItem( id, true ) )
92 AddItem( item );
93 }
94
95 return true;
96}
97
98std::unordered_set<BOARD_ITEM*> PCB_GROUP::GetBoardItems() const
99{
100 std::unordered_set<BOARD_ITEM*> items;
101
102 for( EDA_ITEM* item : m_items )
103 {
104 if( item->IsBOARD_ITEM() )
105 items.insert( static_cast<BOARD_ITEM*>( item ) );
106 }
107
108 return items;
109}
110
111
112/*
113 * @return if not in the footprint editor and aItem is in a footprint, returns the
114 * footprint's parent group. Otherwise, returns the aItem's parent group.
115 */
116EDA_GROUP* getClosestGroup( BOARD_ITEM* aItem, bool isFootprintEditor )
117{
118 if( !isFootprintEditor && aItem->GetParent() && aItem->GetParent()->Type() == PCB_FOOTPRINT_T )
119 return aItem->GetParent()->GetParentGroup();
120 else
121 return aItem->GetParentGroup();
122}
123
124
126EDA_GROUP* getNestedGroup( BOARD_ITEM* aItem, EDA_GROUP* aScope, bool isFootprintEditor )
127{
128 EDA_GROUP* group = getClosestGroup( aItem, isFootprintEditor );
129
130 if( group == aScope )
131 return nullptr;
132
133 while( group && group->AsEdaItem()->GetParentGroup() && group->AsEdaItem()->GetParentGroup() != aScope )
134 group = group->AsEdaItem()->GetParentGroup();
135
136 return group;
137}
138
139
140EDA_GROUP* PCB_GROUP::TopLevelGroup( BOARD_ITEM* aItem, EDA_GROUP* aScope, bool isFootprintEditor )
141{
142 return getNestedGroup( aItem, aScope, isFootprintEditor );
143}
144
145
146bool PCB_GROUP::WithinScope( BOARD_ITEM* aItem, PCB_GROUP* aScope, bool isFootprintEditor )
147{
148 EDA_GROUP* group = getClosestGroup( aItem, isFootprintEditor );
149
150 if( group && group == aScope )
151 return true;
152
153 EDA_GROUP* nested = getNestedGroup( aItem, aScope, isFootprintEditor );
154
155 return nested && nested->AsEdaItem()->GetParentGroup() && ( nested->AsEdaItem()->GetParentGroup() == aScope );
156}
157
158
160{
161 return GetBoundingBox().Centre();
162}
163
164
165void PCB_GROUP::SetPosition( const VECTOR2I& aNewpos )
166{
167 VECTOR2I delta = aNewpos - GetPosition();
168
169 Move( delta );
170}
171
172
173void PCB_GROUP::SetLocked( bool aLockState )
174{
175 BOARD_ITEM::SetLocked( aLockState );
176
178 [&]( BOARD_ITEM* child )
179 {
180 child->SetLocked( aLockState );
181 },
183}
184
185
187{
188 // Use copy constructor to get the same uuid and other fields
189 PCB_GROUP* newGroup = new PCB_GROUP( *this );
190 return newGroup;
191}
192
193
195{
196 // Use copy constructor to get the same uuid and other fields
197 PCB_GROUP* newGroup = new PCB_GROUP( *this );
198 newGroup->m_items.clear();
199
200 for( EDA_ITEM* member : m_items )
201 {
202 if( member->Type() == PCB_GROUP_T )
203 newGroup->AddItem( static_cast<PCB_GROUP*>( member )->DeepClone() );
204 else if( member->Type() == PCB_GENERATOR_T )
205 newGroup->AddItem( static_cast<PCB_GENERATOR*>( member )->DeepClone() );
206 else
207 newGroup->AddItem( static_cast<BOARD_ITEM*>( member->Clone() ) );
208 }
209
210 return newGroup;
211}
212
213
214PCB_GROUP* PCB_GROUP::DeepDuplicate( bool addToParentGroup, BOARD_COMMIT* aCommit,
215 std::map<KIID, KIID>* aKIIDMap ) const
216{
217 PCB_GROUP* newGroup = static_cast<PCB_GROUP*>( Duplicate( addToParentGroup, aCommit ) );
218 newGroup->m_items.clear();
219
220 if( aKIIDMap )
221 ( *aKIIDMap )[m_Uuid] = newGroup->m_Uuid;
222
223 for( EDA_ITEM* member : m_items )
224 {
225 // A PCB_GENERATOR owns member items that are not in this group's m_items, so a shallow
226 // copy would leave the duplicate referencing the original's members.
227 if( member->Type() == PCB_GROUP_T || member->Type() == PCB_GENERATOR_T )
228 {
229 newGroup->AddItem( static_cast<PCB_GROUP*>( member )->DeepDuplicate( IGNORE_PARENT_GROUP,
230 nullptr, aKIIDMap ) );
231 }
232 else
233 {
234 BOARD_ITEM* orig = static_cast<BOARD_ITEM*>( member );
235 BOARD_ITEM* memberDupe = orig->Duplicate( IGNORE_PARENT_GROUP );
236
237 if( aKIIDMap )
238 {
239 ( *aKIIDMap )[orig->m_Uuid] = memberDupe->m_Uuid;
240
241 // Children from ordered vectors so lockstep walk pairs reliably
242 // only unordered group membership above needs clone-time capture
243 std::vector<BOARD_ITEM*> dupeChildren;
244 memberDupe->RunOnChildren( [&]( BOARD_ITEM* aChild ) { dupeChildren.push_back( aChild ); },
246
247 std::size_t index = 0;
248 orig->RunOnChildren(
249 [&]( BOARD_ITEM* aChild )
250 {
251 if( index < dupeChildren.size() )
252 ( *aKIIDMap )[aChild->m_Uuid] = dupeChildren[index]->m_Uuid;
253
254 index++;
255 },
257 }
258
259 newGroup->AddItem( memberDupe );
260 }
261 }
262
263 return newGroup;
264}
265
266
268{
269 assert( aImage->Type() == PCB_GROUP_T );
270 PCB_GROUP* image = static_cast<PCB_GROUP*>( aImage );
271
272 std::swap( *this, *image );
273
274 // A group doesn't own its children (they're owned by the board), so undo doesn't do a
275 // deep clone when making an image. However, it's still safest to update the parentGroup
276 // pointers of the group's children. We must do it in the right order in case any of the
277 // children are shared (ie: image first, "this" second so that any shared children end up
278 // with "this").
279 image->RunOnChildren(
280 [&]( BOARD_ITEM* child )
281 {
282 child->SetParentGroup( image );
283 },
285
287 [&]( BOARD_ITEM* child )
288 {
289 child->SetParentGroup( this );
290 },
292}
293
294
295bool PCB_GROUP::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
296{
297 // Groups are selected by promoting a selection of one of their children
298 return false;
299}
300
301
302bool PCB_GROUP::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) const
303{
304 // Groups are selected by promoting a selection of one of their children
305 return false;
306}
307
308
309bool PCB_GROUP::HitTest( const SHAPE_LINE_CHAIN& aPoly, bool aContained ) const
310{
311 // Groups are selected by promoting a selection of one of their children
312 return false;
313}
314
315
317{
318 BOX2I bbox;
319
320 for( EDA_ITEM* item : m_items )
321 {
322 if( item->Type() == PCB_FOOTPRINT_T )
323 bbox.Merge( static_cast<FOOTPRINT*>( item )->GetBoundingBox( true ) );
324 else
325 bbox.Merge( item->GetBoundingBox() );
326 }
327
328 bbox.Inflate( pcbIUScale.mmToIU( 0.25 ) ); // Give a min size to the bbox
329
330 return bbox;
331}
332
333
334std::shared_ptr<SHAPE> PCB_GROUP::GetEffectiveShape( PCB_LAYER_ID aLayer, FLASHING aFlash ) const
335{
336 std::shared_ptr<SHAPE_COMPOUND> shape = std::make_shared<SHAPE_COMPOUND>();
337
338 for( BOARD_ITEM* item : GetBoardItems() )
339 shape->AddShape( item->GetEffectiveShape( aLayer, aFlash )->Clone() );
340
341 return shape;
342}
343
344
345INSPECT_RESULT PCB_GROUP::Visit( INSPECTOR aInspector, void* aTestData,
346 const std::vector<KICAD_T>& aScanTypes )
347{
348 for( KICAD_T scanType : aScanTypes )
349 {
350 if( scanType == Type() )
351 {
352 if( INSPECT_RESULT::QUIT == aInspector( this, aTestData ) )
354 }
355 }
356
358}
359
360
362{
363 LSET aSet;
364
365 for( EDA_ITEM* item : m_items )
366 aSet |= static_cast<BOARD_ITEM*>( item )->GetLayerSet();
367
368 return aSet;
369}
370
371
373{
374 // A group is on a layer if any item is on the layer
375 for( EDA_ITEM* item : m_items )
376 {
377 if( static_cast<BOARD_ITEM*>( item )->IsOnLayer( aLayer ) )
378 return true;
379 }
380
381 return false;
382}
383
384
385std::vector<int> PCB_GROUP::ViewGetLayers() const
386{
387 return { LAYER_ANCHOR };
388}
389
390
391double PCB_GROUP::ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const
392{
393 if( aView->IsLayerVisibleCached( LAYER_ANCHOR ) )
394 return LOD_SHOW;
395
396 return LOD_HIDE;
397}
398
399
400void PCB_GROUP::Move( const VECTOR2I& aMoveVector )
401{
402 for( EDA_ITEM* member : m_items )
403 static_cast<BOARD_ITEM*>( member )->Move( aMoveVector );
404}
405
406
407void PCB_GROUP::Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle )
408{
409 for( EDA_ITEM* item : m_items )
410 static_cast<BOARD_ITEM*>( item )->Rotate( aRotCentre, aAngle );
411}
412
413
414void PCB_GROUP::Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection )
415{
416 for( EDA_ITEM* item : m_items )
417 static_cast<BOARD_ITEM*>( item )->Flip( aCentre, aFlipDirection );
418}
419
420
421void PCB_GROUP::Mirror( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection )
422{
423 // Footprints have no mirror, only flip. If the group holds one, leave the whole group alone
424 // rather than mirror the rest and tear it apart.
425 bool hasFootprint = false;
426
428 [&]( BOARD_ITEM* aChild )
429 {
430 if( aChild->Type() == PCB_FOOTPRINT_T )
431 hasFootprint = true;
432 },
434
435 if( hasFootprint )
436 return;
437
438 for( EDA_ITEM* item : m_items )
439 static_cast<BOARD_ITEM*>( item )->Mirror( aCentre, aFlipDirection );
440}
441
442
443wxString PCB_GROUP::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const
444{
445 if( m_name.empty() )
446 return wxString::Format( _( "Unnamed Group, %zu members" ), m_items.size() );
447 else
448 return wxString::Format( _( "Group '%s', %zu members" ), m_name, m_items.size() );
449}
450
451
453{
454 return BITMAPS::module;
455}
456
457
458void PCB_GROUP::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
459{
460 aList.emplace_back( _( "Group" ), m_name.empty() ? _( "<unnamed>" ) : m_name );
461 aList.emplace_back( _( "Members" ), wxString::Format( wxT( "%zu" ), m_items.size() ) );
462
463 if( aFrame->GetName() == PCB_EDIT_FRAME_NAME && IsLocked() )
464 aList.emplace_back( _( "Status" ), _( "Locked" ) );
465}
466
467
468bool PCB_GROUP::Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const
469{
470 return EDA_ITEM::Matches( UnescapeString( GetName() ), aSearchData );
471}
472
473
474void PCB_GROUP::RunOnChildren( const std::function<void( BOARD_ITEM* )>& aFunction, RECURSE_MODE aMode ) const
475{
476 try
477 {
478 for( BOARD_ITEM* item : GetBoardItems() )
479 {
480 aFunction( item );
481
482 if( aMode == RECURSE_MODE::RECURSE && ( item->Type() == PCB_GROUP_T || item->Type() == PCB_GENERATOR_T ) )
483 {
484 item->RunOnChildren( aFunction, RECURSE_MODE::RECURSE );
485 }
486 }
487 }
488 catch( std::bad_function_call& )
489 {
490 wxFAIL_MSG( wxT( "Error calling function in PCB_GROUP::RunOnChildren" ) );
491 }
492}
493
494
495bool PCB_GROUP::operator==( const BOARD_ITEM& aBoardItem ) const
496{
497 if( aBoardItem.Type() != Type() )
498 return false;
499
500 const PCB_GROUP& other = static_cast<const PCB_GROUP&>( aBoardItem );
501
502 return *this == other;
503}
504
505
506bool PCB_GROUP::operator==( const PCB_GROUP& aOther ) const
507{
508 if( m_items.size() != aOther.m_items.size() )
509 return false;
510
511 // The items in groups are in unordered sets hashed by the pointer value, so we need to
512 // order them by UUID (EDA_ITEM_SET) to compare
513 EDA_ITEM_SET itemSet( m_items.begin(), m_items.end() );
514 EDA_ITEM_SET otherItemSet( aOther.m_items.begin(), aOther.m_items.end() );
515
516 for( auto it1 = itemSet.begin(), it2 = otherItemSet.begin(); it1 != itemSet.end(); ++it1, ++it2 )
517 {
518 // Compare UUID instead of the items themselves because we only care if the contents
519 // of the group has changed, not which elements in the group have changed
520 if( ( *it1 )->m_Uuid != ( *it2 )->m_Uuid )
521 return false;
522 }
523
524 return true;
525}
526
527
528double PCB_GROUP::Similarity( const BOARD_ITEM& aOther ) const
529{
530 if( aOther.Type() != Type() )
531 return 0.0;
532
533 const PCB_GROUP& other = static_cast<const PCB_GROUP&>( aOther );
534
535 double similarity = 0.0;
536
537 for( EDA_ITEM* item : m_items )
538 {
539 for( EDA_ITEM* otherItem : other.m_items )
540 {
541 similarity += static_cast<BOARD_ITEM*>( item )->Similarity( *static_cast<BOARD_ITEM*>( otherItem ) );
542 }
543 }
544
545 return similarity / m_items.size();
546}
547
548
549static struct PCB_GROUP_DESC
550{
552 {
559
560 propMgr.Mask( TYPE_HASH( PCB_GROUP ), TYPE_HASH( BOARD_ITEM ), _HKI( "Position X" ) );
561 propMgr.Mask( TYPE_HASH( PCB_GROUP ), TYPE_HASH( BOARD_ITEM ), _HKI( "Position Y" ) );
562 propMgr.Mask( TYPE_HASH( PCB_GROUP ), TYPE_HASH( BOARD_ITEM ), _HKI( "Layer" ) );
563
564 const wxString groupTab = _HKI( "Group Properties" );
565
566 propMgr.AddProperty(
568 groupTab );
569 }
int index
constexpr EDA_IU_SCALE pcbIUScale
Definition base_units.h:121
BITMAPS
A list of all bitmap identifiers.
BOX2< VECTOR2I > BOX2I
Definition box2.h:918
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition board_item.h:83
BOARD_ITEM(BOARD_ITEM *aParent, KICAD_T idtype, PCB_LAYER_ID aLayer=F_Cu)
Definition board_item.h:85
friend class BOARD
Definition board_item.h:548
void SetUuidDirect(const KIID &aUuid)
Raw UUID assignment.
virtual BOARD_ITEM * Duplicate(bool addToParentGroup, BOARD_COMMIT *aCommit=nullptr) const
Create a copy of this BOARD_ITEM.
void SetLocked(bool aLocked) override
Definition board_item.h:386
bool IsLocked() const override
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
virtual void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction, RECURSE_MODE aMode) const
Invoke a function on all children.
Definition board_item.h:233
BOARD_ITEM_CONTAINER * GetParent() const
Definition board_item.h:235
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition box2.h:554
constexpr Vec Centre() const
Definition box2.h:93
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Definition box2.h:654
The base class for create windows for drawing purpose.
A set of EDA_ITEMs (i.e., without duplicates).
Definition eda_group.h:42
wxString m_name
Definition eda_group.h:78
std::unordered_set< EDA_ITEM * > m_items
Definition eda_group.h:77
std::unordered_set< EDA_ITEM * > & GetItems()
Definition eda_group.h:50
wxString GetName() const
Definition eda_group.h:47
void AddItem(EDA_ITEM *aItem)
Add item to group.
Definition eda_group.cpp:58
virtual EDA_ITEM * AsEdaItem()=0
void SetName(const wxString &aName)
Definition eda_group.h:48
const KIID m_Uuid
Definition eda_item.h:531
virtual EDA_GROUP * GetParentGroup() const
Definition eda_item.h:114
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:108
virtual bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const
Compare the item against the search criteria in aSearchData.
Definition eda_item.h:416
virtual void SetParentGroup(EDA_GROUP *aGroup)
Definition eda_item.h:113
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
Definition eda_item.cpp:37
static constexpr double LOD_HIDE
Return this constant from ViewGetLOD() to hide the item unconditionally.
Definition view_item.h:176
static constexpr double LOD_SHOW
Return this constant from ViewGetLOD() to show the item unconditionally.
Definition view_item.h:181
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition view.h:63
bool IsLayerVisibleCached(int aLayer) const
Definition view.h:437
Definition kiid.h:46
LSET is a set of PCB_LAYER_IDs.
Definition lset.h:37
A set of BOARD_ITEMs (i.e., without duplicates).
Definition pcb_group.h:51
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.
Definition pcb_group.cpp:72
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.
Definition pcb_group.cpp:54
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
Definition pcb_group.cpp:98
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, std::map< KIID, KIID > *aKIIDMap=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)
Definition pcb_group.cpp:43
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 _(s)
#define PCB_EDIT_FRAME_NAME
RECURSE_MODE
Definition eda_item.h:48
@ RECURSE
Definition eda_item.h:49
@ NO_RECURSE
Definition eda_item.h:50
INSPECT_RESULT
Definition eda_item.h:42
std::set< EDA_ITEM *, CompareByUuid > EDA_ITEM_SET
Definition eda_item.h:585
const INSPECTOR_FUNC & INSPECTOR
std::function passed to nested users by ref, avoids copying std::function.
Definition eda_item.h:89
#define IGNORE_PARENT_GROUP
Definition eda_item.h:53
FLASHING
Enum used during connectivity building to ensure we do not query connectivity while building the data...
Definition layer_ids.h:180
@ LAYER_ANCHOR
Anchor of items having an anchor point (texts, footprints).
Definition layer_ids.h:244
PCB_LAYER_ID
A quick note on layer IDs:
Definition layer_ids.h:56
FLIP_DIRECTION
Definition mirror.h:23
Message panel definition file.
#define _HKI(x)
Definition page_info.cpp:40
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.
#define TYPE_HASH(x)
Definition property.h:74
#define REGISTER_TYPE(x)
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)
int delta
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition typeinfo.h:71
@ PCB_GENERATOR_T
class PCB_GENERATOR, generator on a layer
Definition typeinfo.h:84
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
Definition typeinfo.h:104
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
Definition typeinfo.h:79
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683