KiCad PCB EDA Suite
placement_tool.cpp File Reference
#include "tool/selection.h"
#include "placement_tool.h"
#include "pcb_actions.h"
#include "pcb_selection_tool.h"
#include <ratsnest/ratsnest_data.h>
#include <tool/tool_manager.h>
#include <pcb_edit_frame.h>
#include <board.h>
#include <board_commit.h>
#include <bitmaps.h>
#include <menus_helpers.h>

Go to the source code of this file.

Functions

template<class T >
std::vector< std::pair< BOARD_ITEM *, BOX2I > > GetBoundingBoxes (const T &aItems)
 

Function Documentation

◆ GetBoundingBoxes()

template<class T >
std::vector< std::pair< BOARD_ITEM *, BOX2I > > GetBoundingBoxes ( const T &  aItems)

Definition at line 88 of file placement_tool.cpp.

89{
90 std::vector<std::pair<BOARD_ITEM*, BOX2I>> rects;
91
92 for( EDA_ITEM* item : aItems )
93 {
94 BOARD_ITEM* boardItem = static_cast<BOARD_ITEM*>( item );
95
96 if( item->Type() == PCB_FOOTPRINT_T )
97 {
98 FOOTPRINT* footprint = static_cast<FOOTPRINT*>( item );
99 rects.emplace_back( std::make_pair( footprint,
100 footprint->GetBoundingBox( false, false ) ) );
101 }
102 else
103 {
104 rects.emplace_back( std::make_pair( boardItem, boardItem->GetBoundingBox() ) );
105 }
106 }
107
108 return rects;
109}
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:70
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
virtual const BOX2I GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
Definition: eda_item.cpp:74
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: footprint.cpp:806
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
Definition: typeinfo.h:86

References EDA_ITEM::GetBoundingBox(), FOOTPRINT::GetBoundingBox(), and PCB_FOOTPRINT_T.

Referenced by ALIGN_DISTRIBUTE_TOOL::DistributeHorizontally(), ALIGN_DISTRIBUTE_TOOL::DistributeVertically(), and ALIGN_DISTRIBUTE_TOOL::GetSelections().