1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0031946: Modeling Data - replace version numbers with enumerations in TopTools and BinTools

Added enumerations BinTools_FormatVersion & TopTools_FormatVersion for more clear version tracking in the code.
Added new BinTools::Write() & BRepTools::Write() overloaded functions with version & isWithTriangles parameters.

Added new "readbrep"/"writebrep" DRAW commands handling reading and writing of both Binary and ASCII .brep formats
and providing arguments to setup writing of triangulation data and of format version.
"binrestore" is made an alias to new command "readbrep".
"binsave" now is an alias to new "writebrep" saving into binary format by default ("writebrep" writes into ASCII format by default).
This commit is contained in:
asuraven
2020-11-03 17:22:14 +03:00
committed by bugmaster
parent 1e1158c78b
commit 14eea8293d
44 changed files with 653 additions and 203 deletions

View 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;

View File

@@ -23,6 +23,7 @@
#include <Standard_Type.hxx>
#include <TDataStd_AsciiString.hxx>
#include <TDF_Attribute.hxx>
#include <TDocStd_FormatVersion.hxx>
#include <BinMDataStd.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BinMDataStd_AsciiStringDriver,BinMDF_ADriver)
@@ -62,7 +63,7 @@ Standard_Boolean BinMDataStd_AsciiStringDriver::Paste
Standard_Boolean ok = Source >> aString;
if (ok)
aStrAtt->Set( aString );
if(RelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 8) { // process user defined guid
if(RelocTable.GetHeaderData()->StorageVersion().IntegerValue() >= TDocStd_FormatVersion_VERSION_9) { // process user defined guid
const Standard_Integer& aPos = Source.Position();
Standard_GUID aGuid;
ok = Source >> aGuid;

View File

@@ -23,6 +23,7 @@
#include <TColStd_HArray1OfByte.hxx>
#include <TDataStd_ByteArray.hxx>
#include <TDF_Attribute.hxx>
#include <TDocStd_FormatVersion.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BinMDataStd_ByteArrayDriver,BinMDF_ADriver)
@@ -71,7 +72,7 @@ Standard_Boolean BinMDataStd_ByteArrayDriver::Paste(const BinObjMgt_Persistent&
anAtt->ChangeArray(bytes);
Standard_Boolean aDelta(Standard_False);
if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 2) {
if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() >= TDocStd_FormatVersion_VERSION_3) {
Standard_Byte aDeltaValue;
if (! (theSource >> aDeltaValue))
return Standard_False;

View File

@@ -23,6 +23,7 @@
#include <TColStd_HArray1OfExtendedString.hxx>
#include <TDataStd_ExtStringArray.hxx>
#include <TDF_Attribute.hxx>
#include <TDocStd_FormatVersion.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BinMDataStd_ExtStringArrayDriver,BinMDF_ADriver)
@@ -81,7 +82,7 @@ Standard_Boolean BinMDataStd_ExtStringArrayDriver::Paste
if(ok) {
Standard_Boolean aDelta(Standard_False);
if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 2) {
if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() >= TDocStd_FormatVersion_VERSION_3) {
Standard_Byte aDeltaValue;
if (! (theSource >> aDeltaValue)) {
return Standard_False;

View File

@@ -18,6 +18,7 @@
#include <Standard_Type.hxx>
#include <TDataStd_Name.hxx>
#include <TDF_Attribute.hxx>
#include <TDocStd_FormatVersion.hxx>
#include <BinMDataStd.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BinMDataStd_GenericExtStringDriver,BinMDF_ADriver)
@@ -67,7 +68,7 @@ Standard_Boolean BinMDataStd_GenericExtStringDriver::Paste
Standard_Boolean ok = Source >> aStr;
if (ok)
aStrAttr->Set( aStr );
if(RelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 8) { // process user defined guid
if(RelocTable.GetHeaderData()->StorageVersion().IntegerValue() >= TDocStd_FormatVersion_VERSION_9) { // process user defined guid
const Standard_Integer& aPos = Source.Position();
Standard_GUID aGuid;
ok = Source >> aGuid;

View File

@@ -28,6 +28,7 @@
#include <TColStd_PackedMapOfInteger.hxx>
#include <TDataStd_IntPackedMap.hxx>
#include <TDF_Attribute.hxx>
#include <TDocStd_FormatVersion.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BinMDataStd_IntPackedMapDriver,BinMDF_ADriver)
@@ -87,7 +88,7 @@ Standard_Boolean BinMDataStd_IntPackedMapDriver::Paste
}
Standard_Boolean aDelta(Standard_False);
if(RelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 2) {
if(RelocTable.GetHeaderData()->StorageVersion().IntegerValue() >= TDocStd_FormatVersion_VERSION_3) {
Standard_Byte aDeltaValue;
if (! (Source >> aDeltaValue))
return Standard_False;

View File

@@ -22,6 +22,7 @@
#include <TColStd_HArray1OfInteger.hxx>
#include <TDataStd_IntegerArray.hxx>
#include <TDF_Attribute.hxx>
#include <TDocStd_FormatVersion.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BinMDataStd_IntegerArrayDriver,BinMDF_ADriver)
@@ -69,7 +70,7 @@ Standard_Boolean BinMDataStd_IntegerArrayDriver::Paste
if(!theSource.GetIntArray (&aTargetArray(aFirstInd), aLength))
return Standard_False;
Standard_Boolean aDelta(Standard_False);
if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 2) {
if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() >= TDocStd_FormatVersion_VERSION_3) {
Standard_Byte aDeltaValue;
if (! (theSource >> aDeltaValue))
return Standard_False;

View File

@@ -20,6 +20,7 @@
#include <Standard_Type.hxx>
#include <TDataStd_Integer.hxx>
#include <TDF_Attribute.hxx>
#include <TDocStd_FormatVersion.hxx>
#include <BinMDataStd.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BinMDataStd_IntegerDriver,BinMDF_ADriver)
@@ -59,7 +60,7 @@ Standard_Boolean BinMDataStd_IntegerDriver::Paste
Standard_Boolean ok = theSource >> aValue;
if (ok)
anAtt->Set(aValue);
if(theRT.GetHeaderData()->StorageVersion().IntegerValue() > 8) { // process user defined guid
if(theRT.GetHeaderData()->StorageVersion().IntegerValue() >= TDocStd_FormatVersion_VERSION_9) { // process user defined guid
const Standard_Integer& aPos = theSource.Position();
Standard_GUID aGuid;
ok = theSource >> aGuid;

View File

@@ -70,7 +70,7 @@ Standard_Boolean BinMDataStd_RealArrayDriver::Paste
return Standard_False;
Standard_Boolean aDelta(Standard_False);
if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 2) {
if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() >= TDocStd_FormatVersion_VERSION_3) {
Standard_Byte aDeltaValue;
if (! (theSource >> aDeltaValue))
return Standard_False;

View File

@@ -20,6 +20,7 @@
#include <Standard_Type.hxx>
#include <TDataStd_Real.hxx>
#include <TDF_Attribute.hxx>
#include <TDocStd_FormatVersion.hxx>
#include <BinMDataStd.hxx>
IMPLEMENT_STANDARD_RTTIEXT(BinMDataStd_RealDriver,BinMDF_ADriver)
@@ -59,7 +60,7 @@ Standard_Boolean BinMDataStd_RealDriver::Paste
Standard_Boolean ok = theSource >> aValue;
if (ok)
anAtt->Set(aValue);
if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 8) { // process user defined guid
if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() >= TDocStd_FormatVersion_VERSION_9) { // process user defined guid
const Standard_Integer& aPos = theSource.Position();
Standard_GUID aGuid;
ok = theSource >> aGuid;