KiCad PCB EDA Suite
pcb_group.cpp File Reference
#include <bitmaps.h>
#include <board.h>
#include <board_item.h>
#include <pcb_group.h>
#include <confirm.h>
#include <widgets/msgpanel.h>
#include <view/view.h>

Go to the source code of this file.

Functions

PCB_GROUPgetTopLevelGroup (BOARD_ITEM *aItem, PCB_GROUP *aScope, bool isFootprintEditor)
 

Function Documentation

◆ getTopLevelGroup()

PCB_GROUP* getTopLevelGroup ( BOARD_ITEM aItem,
PCB_GROUP aScope,
bool  isFootprintEditor 
)

Definition at line 72 of file pcb_group.cpp.

73 {
74  PCB_GROUP* group = nullptr;
75 
76  if( isFootprintEditor )
77  {
78  group = aItem->GetParentGroup();
79  }
80  else
81  {
82  if( aItem->GetParent() && aItem->GetParent()->Type() == PCB_FOOTPRINT_T )
83  group = aItem->GetParent()->GetParentGroup();
84  else
85  group = aItem->GetParentGroup();
86  }
87 
88  while( group && group->GetParentGroup() && group->GetParentGroup() != aScope )
89  {
90  if( group->GetParent()->Type() == PCB_FOOTPRINT_T && isFootprintEditor )
91  break;
92 
93  group = group->GetParentGroup();
94  }
95 
96  return group;
97 }
PCB_GROUP * GetParentGroup() const
Definition: board_item.h:91
A set of BOARD_ITEMs (i.e., without duplicates).
Definition: pcb_group.h:50
class FOOTPRINT, a footprint
Definition: typeinfo.h:88
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:166
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113

References BOARD_ITEM::GetParent(), BOARD_ITEM::GetParentGroup(), group, PCB_FOOTPRINT_T, and EDA_ITEM::Type().

Referenced by PCB_GROUP::TopLevelGroup(), and PCB_GROUP::WithinScope().