mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-15 10:43:15 +02:00
Add useful helper function for getting label name
This commit is contained in:
parent
7a71ebf9ac
commit
e77cdad6fa
@ -74,6 +74,7 @@
|
|||||||
|
|
||||||
#include <TDF_LabelSequence.hxx>
|
#include <TDF_LabelSequence.hxx>
|
||||||
#include <TDF_ChildIterator.hxx>
|
#include <TDF_ChildIterator.hxx>
|
||||||
|
#include <TDataStd_Name.hxx>
|
||||||
|
|
||||||
#include "plugins/3dapi/ifsg_all.h"
|
#include "plugins/3dapi/ifsg_all.h"
|
||||||
|
|
||||||
@ -308,6 +309,24 @@ FormatType fileType( const char* aFileName )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static wxString getLabelName( const TDF_Label& label )
|
||||||
|
{
|
||||||
|
wxString txt;
|
||||||
|
Handle( TDataStd_Name ) name;
|
||||||
|
if( !label.IsNull() && label.FindAttribute( TDataStd_Name::GetID(), name ) )
|
||||||
|
{
|
||||||
|
TCollection_ExtendedString extstr = name->Get();
|
||||||
|
char* str = new char[extstr.LengthOfCString() + 1];
|
||||||
|
extstr.ToUTF8CString( str );
|
||||||
|
|
||||||
|
txt = wxString::FromUTF8( str );
|
||||||
|
delete[] str;
|
||||||
|
txt = txt.Trim();
|
||||||
|
}
|
||||||
|
return txt;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void getTag( TDF_Label& label, std::string& aTag )
|
void getTag( TDF_Label& label, std::string& aTag )
|
||||||
{
|
{
|
||||||
if( label.IsNull() )
|
if( label.IsNull() )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user