0023895: XCAF document does not store names for subfigures from IGES files
authordbv <dbv@opencascade.com>
Mon, 15 Apr 2013 14:14:16 +0000 (18:14 +0400)
committerdbv <dbv@opencascade.com>
Mon, 15 Apr 2013 14:14:16 +0000 (18:14 +0400)
Fixed names for subfigures
Added test case bugs/xde/bug23895

src/IGESCAFControl/IGESCAFControl_Reader.cxx
tests/bugs/xde/bug23895 [new file with mode: 0644]

index ee5211e..1a2f5cb 100755 (executable)
@@ -40,6 +40,7 @@
 #include <IGESData_LevelListEntity.hxx>
 #include <TCollection_HAsciiString.hxx>
 #include <XCAFDoc_ShapeMapTool.hxx>
+#include <IGESBasic_SubfigureDef.hxx>
 
 //=======================================================================
 //function : IGESCAFControl_Reader
@@ -233,6 +234,19 @@ Standard_Boolean IGESCAFControl_Reader::Transfer (Handle(TDocStd_Document) &doc)
         }
       }
     }
+
+    //Checks that current entity is a subfigure
+    Handle(IGESBasic_SubfigureDef) aSubfigure = Handle(IGESBasic_SubfigureDef)::DownCast (ent);
+    if (GetNameMode() && !aSubfigure.IsNull() && STool->Search (S, L, Standard_True, Standard_True))
+    {
+      //In this case we attach subfigure name to the label, instead of default "COMPOUND"
+      Handle(TCollection_HAsciiString) aName = aSubfigure->Name();
+      aName->LeftAdjust();
+      aName->RightAdjust();
+      TCollection_ExtendedString anExtStrName (aName->ToCString());
+      TDataStd_Name::Set (L, anExtStrName);
+    }
+
   }
 
   CTool->ReverseChainsOfTreeNodes();
diff --git a/tests/bugs/xde/bug23895 b/tests/bugs/xde/bug23895
new file mode 100644 (file)
index 0000000..ee81e9b
--- /dev/null
@@ -0,0 +1,18 @@
+puts "============"
+puts "OCC23895"
+puts "============"
+puts ""
+#################################################################
+# XCAF document shoud store names for subfigures from IGES files
+#################################################################
+
+ReadIges D [locate_data_file bug23895_test.igs]
+
+set aName [XCheckProps D 0 0:1:1:2]
+
+if { [regexp "ARROW" "$aName"] } {
+    puts "Ok: Subfigure name has been read correctly."
+} else {
+    puts "Error: Subfigure name has not been read."
+}
+