From e77cdad6fa04e2530681a773028e28ce9294273f Mon Sep 17 00:00:00 2001
From: Marek Roszko <mark.roszko@gmail.com>
Date: Sun, 10 Oct 2021 20:07:44 -0400
Subject: [PATCH] Add useful helper function for getting label name

---
 plugins/3d/oce/loadmodel.cpp | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/plugins/3d/oce/loadmodel.cpp b/plugins/3d/oce/loadmodel.cpp
index 49d6b739cb..fb5914f33d 100644
--- a/plugins/3d/oce/loadmodel.cpp
+++ b/plugins/3d/oce/loadmodel.cpp
@@ -74,6 +74,7 @@
 
 #include <TDF_LabelSequence.hxx>
 #include <TDF_ChildIterator.hxx>
+#include <TDataStd_Name.hxx>
 
 #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 )
 {
     if( label.IsNull() )