1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0031136: Modeling Data - BinXCAF persistence loses normals from triangulation-only Faces

Information about normals are stored in BinOCAF, XmlOCAF, BRep and BBRep (in case of triangulation-only Faces).
Versions of formats have been changed (11 for TDocStd, 4 for BRep Shape and 3 for Binary BRep Shape)
theWithNormals parameter added to BRepTools::Write()
IsWithNormals()/SetWithNormals() function added to BRepTools_ShapeSet
-normals/-noNormals option added to StoreTriangulation DRAW command
-normals/-noNormals option added to writebrep DRAW command
Tests for writing to brep/binary brep/BinXCaf/XmlXCaf added
Test for StoreTriangulation options -normals/-noNormals added
This commit is contained in:
asuraven
2020-11-17 20:37:01 +03:00
committed by bugmaster
parent 6fab0b3428
commit 9f45d35b6b
40 changed files with 703 additions and 209 deletions

View File

@@ -158,8 +158,8 @@ void BinLDrivers_DocumentRetrievalDriver::Read (Standard_IStream&
myReaderStatus = PCDM_RS_FormatFailure;
return;
}
Standard_Integer aFileVer = aHeaderData->StorageVersion().IntegerValue();
Standard_Integer aCurrVer = TDocStd_Document::CurrentStorageFormatVersion();
TDocStd_FormatVersion aFileVer = static_cast<TDocStd_FormatVersion>(aHeaderData->StorageVersion().IntegerValue());
TDocStd_FormatVersion aCurrVer = TDocStd_Document::CurrentStorageFormatVersion();
// maintain one-way compatibility starting from version 2+
if (!CheckDocumentVersion(aFileVer, aCurrVer)) {
myReaderStatus = PCDM_RS_NoVersion;
@@ -560,7 +560,7 @@ Standard_Boolean BinLDrivers_DocumentRetrievalDriver::CheckDocumentVersion(
const Standard_Integer theFileVersion,
const Standard_Integer theCurVersion)
{
if (theFileVersion < TDocStd_FormatVersion_VERSION_2 || theFileVersion > theCurVersion) {
if (theFileVersion < TDocStd_FormatVersion_LOWER || theFileVersion > theCurVersion) {
// file was written with another version
return Standard_False;
}

View File

@@ -111,7 +111,7 @@ void BinLDrivers_DocumentSection::SetLength (const uint64_t theLength)
//=======================================================================
void BinLDrivers_DocumentSection::WriteTOC (Standard_OStream& theStream,
const Standard_Integer theDocFormatVersion)
const TDocStd_FormatVersion theDocFormatVersion)
{
char aBuf[512];
@@ -167,7 +167,7 @@ void BinLDrivers_DocumentSection::WriteTOC (Standard_OStream& theStream,
void BinLDrivers_DocumentSection::Write (Standard_OStream& theStream,
const uint64_t theOffset,
const Standard_Integer theDocFormatVersion)
const TDocStd_FormatVersion theDocFormatVersion)
{
const uint64_t aSectionEnd = (uint64_t) theStream.tellp();
theStream.seekp((std::streamsize)myValue[0]);
@@ -218,7 +218,7 @@ void BinLDrivers_DocumentSection::Write (Standard_OStream& theStream,
void BinLDrivers_DocumentSection::ReadTOC
(BinLDrivers_DocumentSection& theSection,
Standard_IStream& theStream,
const Standard_Integer theDocFormatVersion)
const TDocStd_FormatVersion theDocFormatVersion)
{
char aBuf[512];
Standard_Integer aNameBufferSize;

View File

@@ -25,6 +25,7 @@
#include <Standard_OStream.hxx>
#include <Standard_IStream.hxx>
#include <Message_ProgressIndicator.hxx>
#include <TDocStd_FormatVersion.hxx>
class TCollection_AsciiString;
@@ -67,17 +68,17 @@ public:
//! Create a Section entry in the Document TOC (list of sections)
Standard_EXPORT void WriteTOC (Standard_OStream& theOS,
const Standard_Integer theDocFormatVersion);
const TDocStd_FormatVersion theDocFormatVersion);
//! Save Offset and Length data into the Section entry
//! in the Document TOC (list of sections)
Standard_EXPORT void Write (Standard_OStream& theOS, const uint64_t theOffset,
const Standard_Integer theDocFormatVersion);
const TDocStd_FormatVersion theDocFormatVersion);
//! Fill a DocumentSection instance from the data that are read
//! from TOC.
Standard_EXPORT static void ReadTOC (BinLDrivers_DocumentSection& theSection, Standard_IStream& theIS,
const Standard_Integer theDocFormatVersion);
const TDocStd_FormatVersion theDocFormatVersion);

View File

@@ -124,7 +124,7 @@ void BinLDrivers_DocumentStorageDriver::Write (const Handle(CDM_Document)& theD
}
// 2. Write the Table of Contents of Sections
const Standard_Integer aDocVer = aDoc->StorageFormatVersion();
const TDocStd_FormatVersion aDocVer = aDoc->StorageFormatVersion();
BinLDrivers_VectorOfDocumentSection::Iterator anIterS (mySections);
for (; anIterS.More(); anIterS.Next())
anIterS.ChangeValue().WriteTOC (theOStream, aDocVer);
@@ -547,7 +547,7 @@ void BinLDrivers_DocumentStorageDriver::WriteSection
void BinLDrivers_DocumentStorageDriver::WriteShapeSection
(BinLDrivers_DocumentSection& theSection,
Standard_OStream& theOS,
const Standard_Integer theDocVer,
const TDocStd_FormatVersion theDocVer,
const Message_ProgressRange& /*theRange*/)
{
const Standard_Size aShapesSectionOffset = (Standard_Size) theOS.tellp();

View File

@@ -29,6 +29,7 @@
#include <Standard_OStream.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Type.hxx>
#include <TDocStd_FormatVersion.hxx>
class BinMDF_ADriverTable;
class Message_Messenger;
class TCollection_ExtendedString;
@@ -87,7 +88,7 @@ protected:
//! defines the procedure of writing a shape section to file
Standard_EXPORT virtual void WriteShapeSection (BinLDrivers_DocumentSection& theDocSection,
Standard_OStream& theOS,
const Standard_Integer theDocVer,
const TDocStd_FormatVersion theDocVer,
const Message_ProgressRange& theRange = Message_ProgressRange());
Handle(BinMDF_ADriverTable) myDrivers;