28#include <wx/filedlg.h>
79 const std::vector<EDA_ITEM*>& aAdditionalFootprints )
81 if( aSelectionToReannotate.
Empty() )
85 FOOTPRINTS fpOnBoard =
m_frame->GetBoard()->Footprints();
86 std::multimap<wxString, KIID> usedDesignatorsMap;
88 for(
EDA_ITEM* item : aAdditionalFootprints )
91 fpOnBoard.push_back(
static_cast<FOOTPRINT*
>( item ) );
101 fpOnBoard.push_back(
static_cast<FOOTPRINT*
>( aGroupItem ) );
108 usedDesignatorsMap.insert( { fp->GetReference(), fp->m_Uuid } );
111 FOOTPRINTS fpInSelection;
113 for(
EDA_ITEM* item : aSelectionToReannotate )
116 fpInSelection.push_back(
static_cast<FOOTPRINT*
>( item ) );
122 group->RunOnChildren(
126 fpInSelection.push_back(
static_cast<FOOTPRINT*
>( aGroupItem ) );
132 std::sort( fpInSelection.begin(), fpInSelection.end(),
135 int ii = StrNumCmp( aA->GetReference(), aB->GetReference(), true );
140 if( aA->GetPosition().y == aB->GetPosition().y )
142 if( aA->GetPosition().x == aB->GetPosition().x )
143 return aA->m_Uuid < aB->m_Uuid;
145 return aA->GetPosition().x < aB->GetPosition().x;
149 return aA->GetPosition().y > aB->GetPosition().y;
163 while( usedDesignatorsMap.find( fp->GetReference() ) != usedDesignatorsMap.end() )
165 auto result = usedDesignatorsMap.equal_range( fp->GetReference() );
167 for(
auto& it =
result.first; it !=
result.second; it++ )
169 if( it->second != fp->m_Uuid )
184 fp->SetReference( stem + std::to_string( value ) );
188 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...
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)
wxString result
Test unit parsing edge cases and error handling.
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint