24#include <wx/filedlg.h>
75 const std::vector<EDA_ITEM*>& aAdditionalFootprints )
77 if( aSelectionToReannotate.
Empty() )
82 std::multimap<wxString, KIID> usedDesignatorsMap;
84 for(
EDA_ITEM* item : aAdditionalFootprints )
87 fpOnBoard.push_back(
static_cast<FOOTPRINT*
>( item ) );
97 fpOnBoard.push_back(
static_cast<FOOTPRINT*
>( aGroupItem ) );
104 usedDesignatorsMap.insert( { fp->GetReference(), fp->m_Uuid } );
109 for(
EDA_ITEM* item : aSelectionToReannotate )
112 fpInSelection.push_back(
static_cast<FOOTPRINT*
>( item ) );
118 group->RunOnChildren(
122 fpInSelection.push_back(
static_cast<FOOTPRINT*
>( aGroupItem ) );
128 std::sort( fpInSelection.begin(), fpInSelection.end(),
131 int ii = StrNumCmp( aA->GetReference(), aB->GetReference(), true );
136 if( aA->GetPosition().y == aB->GetPosition().y )
138 if( aA->GetPosition().x == aB->GetPosition().x )
139 return aA->m_Uuid < aB->m_Uuid;
141 return aA->GetPosition().x < aB->GetPosition().x;
145 return aA->GetPosition().y > aB->GetPosition().y;
159 while( usedDesignatorsMap.find( fp->GetReference() ) != usedDesignatorsMap.end() )
161 auto result = usedDesignatorsMap.equal_range( fp->GetReference() );
163 for(
auto& it =
result.first; it !=
result.second; it++ )
165 if( it->second != fp->m_Uuid )
180 fp->SetReference( stem + std::to_string( value ) );
184 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.
std::deque< FOOTPRINT * > FOOTPRINTS
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