From 256bb1a5eb529412f1a16bd349c0490c9684476b Mon Sep 17 00:00:00 2001 From: agv Date: Mon, 25 Jan 2021 01:17:39 +0300 Subject: [PATCH] Amending commit to enable CMP-67 "Add ability to partially load OCAF document" --- src/BinMDataStd/BinMDataStd.hxx | 3 +- .../BinMXCAFDoc_LocationDriver.cxx | 2 +- src/BinTools/BinTools_FormatVersion.hxx | 30 +++++++++++++++++++ src/BinTools/BinTools_ShapeSet.cxx | 28 +++++++++++------ src/BinTools/FILES | 1 + 5 files changed, 53 insertions(+), 11 deletions(-) create mode 100644 src/BinTools/BinTools_FormatVersion.hxx diff --git a/src/BinMDataStd/BinMDataStd.hxx b/src/BinMDataStd/BinMDataStd.hxx index 50864bb07c..5257638135 100644 --- a/src/BinMDataStd/BinMDataStd.hxx +++ b/src/BinMDataStd/BinMDataStd.hxx @@ -22,6 +22,7 @@ #include #include +#include class BinMDF_ADriverTable; class Message_Messenger; @@ -41,7 +42,7 @@ template 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; diff --git a/src/BinMXCAFDoc/BinMXCAFDoc_LocationDriver.cxx b/src/BinMXCAFDoc/BinMXCAFDoc_LocationDriver.cxx index 65736d1519..cc0492e184 100644 --- a/src/BinMXCAFDoc/BinMXCAFDoc_LocationDriver.cxx +++ b/src/BinMXCAFDoc/BinMXCAFDoc_LocationDriver.cxx @@ -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 index 0000000000..faced8fb5a --- /dev/null +++ b/src/BinTools/BinTools_FormatVersion.hxx @@ -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 diff --git a/src/BinTools/BinTools_ShapeSet.cxx b/src/BinTools/BinTools_ShapeSet.cxx index 0d396cca45..b0687c210c 100644 --- a/src/BinTools/BinTools_ShapeSet.cxx +++ b/src/BinTools/BinTools_ShapeSet.cxx @@ -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"<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()); diff --git a/src/BinTools/FILES b/src/BinTools/FILES index 2b7455af35..09bfe591d1 100644 --- a/src/BinTools/FILES +++ b/src/BinTools/FILES @@ -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 -- 2.39.5