30#include <wx/filedlg.h>
36 m_selectionTool( nullptr ),
53 m_frame = getEditFrame<PCB_EDIT_FRAME>();
76 const std::vector<EDA_ITEM*>& aAdditionalFootprints )
78 if( aSelectionToReannotate.
Empty() )
83 std::multimap<wxString, KIID> usedDesignatorsMap;
85 for(
EDA_ITEM* item : aAdditionalFootprints )
88 fpOnBoard.push_back(
static_cast<FOOTPRINT*
>( item ) );
98 fpOnBoard.push_back(
static_cast<FOOTPRINT*
>( aGroupItem ) );
100 RECURSE_MODE::RECURSE );
105 usedDesignatorsMap.insert( { fp->GetReference(), fp->m_Uuid } );
108 FOOTPRINTS fpInSelection;
110 for(
EDA_ITEM* item : aSelectionToReannotate )
113 fpInSelection.push_back(
static_cast<FOOTPRINT*
>( item ) );
119 group->RunOnChildren(
123 fpInSelection.push_back(
static_cast<FOOTPRINT*
>( aGroupItem ) );
125 RECURSE_MODE::RECURSE );
129 std::sort( fpInSelection.begin(), fpInSelection.end(),
132 int ii = StrNumCmp( aA->GetReference(), aB->GetReference(), true );
137 if( aA->GetPosition().y == aB->GetPosition().y )
139 if( aA->GetPosition().x == aB->GetPosition().x )
140 return aA->m_Uuid < aB->m_Uuid;
142 return aA->GetPosition().x < aB->GetPosition().x;
146 return aA->GetPosition().y > aB->GetPosition().y;
160 while( usedDesignatorsMap.find( fp->GetReference() ) != usedDesignatorsMap.end() )
162 auto result = usedDesignatorsMap.equal_range( fp->GetReference() );
164 for(
auto& it = result.first; it != result.second; it++ )
166 if( it->second != fp->m_Uuid )
181 fp->SetReference( stem + std::to_string( value ) );
185 usedDesignatorsMap.insert( { fp->GetReference(), fp->m_Uuid } );
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
const FOOTPRINTS & Footprints() const
A base class for most all the KiCad significant classes used in schematics and boards.
KICAD_T Type() const
Returns the type of object.
static TOOL_ACTION boardReannotate
A set of BOARD_ITEMs (i.e., without duplicates).
bool Empty() const
Checks if there is anything selected.
wxString GetRefDesPrefix(const wxString &aRefDes)
Get the (non-numeric) prefix from a refdes - e.g.
int GetRefDesNumber(const wxString &aRefDes)
Get the numeric suffix from a refdes - e.g.
Class to handle a set of BOARD_ITEMs.
Collection of utility functions for component reference designators (refdes)
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint