]> OCCT Git - occt-copy.git/commitdiff
Amending commit to enable CMP-67 "Add ability to partially load OCAF document"
authoragv <agv@opencascade.com>
Sun, 24 Jan 2021 22:17:39 +0000 (01:17 +0300)
committeragv <agv@opencascade.com>
Wed, 7 Apr 2021 07:52:52 +0000 (10:52 +0300)
src/BinMDataStd/BinMDataStd.hxx
src/BinMXCAFDoc/BinMXCAFDoc_LocationDriver.cxx
src/BinTools/BinTools_FormatVersion.hxx [new file with mode: 0644]
src/BinTools/BinTools_ShapeSet.cxx
src/BinTools/FILES

index 50864bb07c5a90637c67008d1868344dd138fba8..52576381359effd3ce9688aa167c28374f0000b2 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <Standard_Integer.hxx>
 #include <BinObjMgt_Persistent.hxx>
+#include <TDocStd_FormatVersion.hxx>
 
 class BinMDF_ADriverTable;
 class Message_Messenger;
@@ -41,7 +42,7 @@ template<class T>
 static void SetAttributeID(const BinObjMgt_Persistent& theSource, const Handle(T)& anAtt, const Standard_Integer aDocFormatVersion)
 {
   Standard_Boolean ok = Standard_True;
-  if(aDocFormatVersion > 9) { // process user defined guid
+  if(aDocFormatVersion >= TDocStd_FormatVersion_VERSION_10) { // process user defined guid
     const Standard_Integer& aPos = theSource.Position();
     Standard_GUID aGuid;
     ok = theSource >> aGuid;
index 65736d1519c73f2a9cab55ad810dc6e74adefbfe..cc0492e18478aed478092aa7060ed320a24c87b2 100644 (file)
@@ -135,7 +135,7 @@ Standard_Boolean BinMXCAFDoc_LocationDriver::Translate(const BinObjMgt_Persisten
       } else
         return Standard_False;
     } else {
-      // read the datum's trasformation
+      // read the datum's transformation
       gp_Trsf aTrsf;
 
       Standard_Real aScaleFactor;
diff --git a/src/BinTools/BinTools_FormatVersion.hxx b/src/BinTools/BinTools_FormatVersion.hxx
new file mode 100644 (file)
index 0000000..faced8f
--- /dev/null
@@ -0,0 +1,30 @@
+// Copyright (c) 2020 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _BinToolsFormatVersion_HeaderFile
+#define _BinToolsFormatVersion_HeaderFile
+
+//! Defined BinTools format version
+enum BinTools_FormatVersion
+{
+  BinTools_FormatVersion_VERSION_1 = 1, //!< Does not write CurveOnSurface UV Points into the file.
+                                        //!  On reading calls Check() method.
+  BinTools_FormatVersion_VERSION_2 = 2, //!< Stores CurveOnSurface UV Points.
+                                        //!  On reading format is recognized from Version string.
+  BinTools_FormatVersion_VERSION_3 = 3, //!< (OCCT 6.2.1) Correctly processes geometry with points on Curve,
+                                        //!  or point on Surface, or points on curve of surface [#0009745]
+
+  BinTools_FormatVersion_CURRENT = BinTools_FormatVersion_VERSION_1 //!< The current version.
+};
+
+#endif
index 0d396cca45bcad603c0fed377ea11dd62b9e7626..b0687c210c15dd7ccad5d84ecf8ecf9d03545d49 100644 (file)
@@ -299,8 +299,11 @@ void  BinTools_ShapeSet::Write (Standard_OStream& OS,
   else if (FormatNb() == BinTools_FormatVersion_VERSION_2)
   {
     OS << "\n" << Version_2 << "\n";
+  }
   else
+  {
     OS << "\n" << Version_1 << "\n";
+  }
 
   //-----------------------------------------
   // write the locations
@@ -381,13 +384,22 @@ void  BinTools_ShapeSet::Read (Standard_IStream& IS,
   } while ( ! IS.fail() && strcmp(vers,Version_1) && strcmp(vers,Version_2) &&
           strcmp(vers,Version_3));
   if (IS.fail()) {
-    std::cout << "BinTools_ShapeSet::Read: File was not written with this version of the topology"<<std::endl;
-     return;
+    std::cout << "BinTools_ShapeSet::Read: File was not written with this version of the topology" << std::endl;
+    return;
   }
 
-  if (strcmp(vers,Version_3) == 0) SetFormatNb(3);
-  else  if (strcmp(vers,Version_2) == 0) SetFormatNb(2);    
-  else SetFormatNb(1);
+  if (strcmp (vers, Version_3) == 0)
+  {
+    SetFormatNb (BinTools_FormatVersion_VERSION_3);
+  }
+  else if (strcmp (vers, Version_2) == 0)
+  {
+    SetFormatNb (BinTools_FormatVersion_VERSION_2);
+  }
+  else
+  {
+    SetFormatNb (BinTools_FormatVersion_VERSION_1);
+  }
 
   //-----------------------------------------
   // read the locations
@@ -667,13 +679,11 @@ void BinTools_ShapeSet::WriteShape (const TopoDS_Shape& S,
            {
              gp_Pnt2d Pf,Pl;
              if (CR->IsCurveOnClosedSurface()) {
-               Handle(BRep_CurveOnClosedSurface) COCS = 
-                 Handle(BRep_CurveOnClosedSurface)::DownCast(CR);
+               Handle(BRep_CurveOnClosedSurface) COCS = Handle(BRep_CurveOnClosedSurface)::DownCast(CR);
                COCS->UVPoints2(Pf,Pl);
              }
              else {
-               Handle(BRep_CurveOnSurface) COS = 
-                 Handle(BRep_CurveOnSurface)::DownCast(CR);
+               Handle(BRep_CurveOnSurface) COS = Handle(BRep_CurveOnSurface)::DownCast(CR);
                COS->UVPoints(Pf,Pl);
              }
              BinTools::PutReal(OS, Pf.X());
index 2b7455af35b519c32d0dd06985e73eb1fd40fa51..09bfe591d1034b4f32f7e62dcbd0dd11d09577a1 100644 (file)
@@ -4,6 +4,7 @@ BinTools_Curve2dSet.cxx
 BinTools_Curve2dSet.hxx
 BinTools_CurveSet.cxx
 BinTools_CurveSet.hxx
+BinTools_FormatVersion.hxx
 BinTools_IStream.cxx
 BinTools_IStream.hxx
 BinTools_LocationSet.cxx