0029597: Data Exchange - unable to read VRML2 file
authorakz <akz@opencascade.com>
Fri, 5 Aug 2016 08:24:58 +0000 (11:24 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 29 Mar 2018 14:13:00 +0000 (17:13 +0300)
VrmlData_Scene::createNode() now handles Collision item.
VrmlData_ArrayVec3d::ReadArray() now handles a case with omitted brackets.

Added test bugs xde bug29597

src/VrmlData/VrmlData_Geometry.cxx
src/VrmlData/VrmlData_Group.cxx
src/VrmlData/VrmlData_Scene.cxx
tests/bugs/xde/bug29597 [new file with mode: 0644]

index 8f20d3e..f0e231d 100644 (file)
@@ -631,7 +631,16 @@ VrmlData_ErrorStatus VrmlData_ArrayVec3d::ReadArray
     // Read the body of the data node (list of triplets)
     if (OK(aStatus) && OK(aStatus, VrmlData_Scene::ReadLine(theBuffer))) {
       if (theBuffer.LinePtr[0] != '[')  // opening bracket
-        aStatus = VrmlData_VrmlFormatError;
+      {
+        // Handle case when brackets are ommited for single element of array
+        gp_XYZ anXYZ;
+        // Read three numbers (XYZ value)
+        if (!OK(aStatus, Scene().ReadXYZ(theBuffer, anXYZ,
+                                          isScale, Standard_False)))
+          aStatus = VrmlData_VrmlFormatError;
+        else
+          vecValues.Append(anXYZ);
+      }
       else {
         theBuffer.LinePtr++;
         for(;;) {
index f1d989a..685b045 100644 (file)
@@ -203,6 +203,10 @@ VrmlData_ErrorStatus VrmlData_Group::Read (VrmlData_InBuffer& theBuffer)
           break;
       }
     }
+    else if (VRMLDATA_LCOMPARE(theBuffer.LinePtr, "collide")) {
+      TCollection_AsciiString aDummy;
+      aStatus = Scene().ReadWord (theBuffer, aDummy);
+    }
     else if (VRMLDATA_LCOMPARE (theBuffer.LinePtr, "Separator") ||
              VRMLDATA_LCOMPARE (theBuffer.LinePtr, "Switch")) {
       Standard_Boolean isBracketed (Standard_False);
index c1862ca..9128cd3 100644 (file)
@@ -497,6 +497,9 @@ VrmlData_ErrorStatus VrmlData_Scene::createNode
     else if (VRMLDATA_LCOMPARE(theBuffer.LinePtr, "Separator"))
       aNode = new VrmlData_Group          (* this, strName,
                                            Standard_False);
+    else if (VRMLDATA_LCOMPARE(theBuffer.LinePtr, "Collision"))
+      aNode = new VrmlData_Group          (* this, strName,
+                                           Standard_False);
     else if (VRMLDATA_LCOMPARE(theBuffer.LinePtr, "Switch"))
       aNode = new VrmlData_Group          (* this, strName,
                                            Standard_False);
diff --git a/tests/bugs/xde/bug29597 b/tests/bugs/xde/bug29597
new file mode 100644 (file)
index 0000000..867f742
--- /dev/null
@@ -0,0 +1,17 @@
+puts "=========="
+puts "0029539: Data Exchange - unable to read VRML from data samples"
+puts "=========="
+puts ""
+
+pload VISUALIZATION XDE
+vclear
+vinit View1
+loadvrml v [locate_data_file bug29597_vrml2.wrl]
+vdisplay -dispMode 1 v
+vfit
+
+set anArea [triarea v]
+checkreal "Triangulation area" [lindex $anArea 0] 5341500. 1. 1e-6
+checktrinfo v -tri 12 -nod 24
+
+#vdump $::imagedir/${::casename}.png