Eeschema Back annotation: fix broken handling of full sheet paths of symbols.

Fixes #12767
https://gitlab.com/kicad/code/kicad/issues/12767
This commit is contained in:
jean-pierre charras 2022-11-03 11:15:23 +01:00
parent 0b5c91d3f4
commit 504adb3467
4 changed files with 21 additions and 9 deletions

View File

@ -175,11 +175,11 @@ int SCH_REFERENCE_LIST::FindUnit( size_t aIndex, int aUnit, bool aIncludeNew ) c
}
int SCH_REFERENCE_LIST::FindRefByPath( const wxString& aPath ) const
int SCH_REFERENCE_LIST::FindRefByFullPath( const wxString& aFullPath ) const
{
for( size_t i = 0; i < m_flatList.size(); ++i )
{
if( m_flatList[i].GetPath() == aPath )
if( m_flatList[i].GetFullPath() == aFullPath )
return i;
}

View File

@ -109,11 +109,22 @@ public:
void SetSheetNumber( int aSheetNumber ) { m_sheetNum = aSheetNumber; }
/**
* @return the sheet path containing the symbol item
*/
const wxString GetPath() const
{
return m_sheetPath.PathAsString();
}
/**
* @return the full patb of the symbol item
*/
const wxString GetFullPath() const
{
return m_sheetPath.PathAsString() + m_symbolUuid.AsString();
}
/**
* Update the annotation of the symbol according the current object state.
*/
@ -514,12 +525,12 @@ public:
int FindUnit( size_t aIndex, int aUnit, bool aIncludeNew = false ) const;
/**
* Search the list for a symbol with the given KIID path.
* Search the list for a symbol with the given KIID path (as string).
*
* @param aPath is the path to search.
* @return index in aSymbolsList if found or -1 if not found.
* @param aFullPath is the path of the symbol item to search.
* @return an index in m_flatList if found or -1 if not found.
*/
int FindRefByPath( const wxString& aPath ) const;
int FindRefByFullPath( const wxString& aFullPath ) const;
/**
* Add all the reference designator numbers greater than \a aMinRefId to \a aIdList

View File

@ -224,7 +224,7 @@ void BACK_ANNOTATE::getChangeList()
if( m_matchByReference )
refIndex = refList.FindRef( pcbPath );
else
refIndex = refList.FindRefByPath( pcbPath );
refIndex = refList.FindRefByFullPath( pcbPath );
if( refIndex >= 0 )
{
@ -248,7 +248,7 @@ void BACK_ANNOTATE::getChangeList()
if( m_matchByReference )
refIndex = m_refs.FindRef( pcbPath );
else
refIndex = m_refs.FindRefByPath( pcbPath );
refIndex = m_refs.FindRefByFullPath( pcbPath );
if( refIndex >= 0 )
{

View File

@ -89,7 +89,8 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( const int* aLayerLookUpTable, int aCopperLa
for( GERBER_DRAW_ITEM* gerb_item : excellon->GetItems() )
collect_hole( gerb_item );
}
else if( gerb and pcb_layer_number == UNDEFINED_LAYER ) // PCB_LAYER_ID doesn't have an entry for Hole Data, but the dialog returns UNDEFINED_LAYER for it
else if( gerb && pcb_layer_number == UNDEFINED_LAYER ) // PCB_LAYER_ID doesn't have an entry for Hole Data,
// but the dialog returns UNDEFINED_LAYER for it
{
for( GERBER_DRAW_ITEM* gerb_item : gerb->GetItems() )
collect_hole( gerb_item );