1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-04 13:13:25 +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

@@ -20,10 +20,12 @@
#include <TColStd_HArray1OfByte.hxx>
#include <TDataStd_ByteArray.hxx>
#include <TDF_Attribute.hxx>
#include <TDocStd_FormatVersion.hxx>
#include <XmlMDataStd.hxx>
#include <XmlMDataStd_ByteArrayDriver.hxx>
#include <XmlObjMgt.hxx>
#include <XmlObjMgt_Persistent.hxx>
IMPLEMENT_DOMSTRING (AttributeIDString, "bytearrattguid")
IMPLEMENT_STANDARD_RTTIEXT(XmlMDataStd_ByteArrayDriver,XmlMDF_ADriver)
@@ -129,7 +131,7 @@ Standard_Boolean XmlMDataStd_ByteArrayDriver::Paste(const XmlObjMgt_Persistent&
Standard_Boolean aDelta(Standard_False);
if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 2) {
if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() >= TDocStd_FormatVersion_VERSION_3) {
Standard_Integer aDeltaValue;
if (!anElement.getAttribute(::IsDeltaOn()).GetInteger(aDeltaValue))
{

View File

@@ -19,6 +19,7 @@
#include <Standard_Type.hxx>
#include <TDataStd_ExtStringArray.hxx>
#include <TDF_Attribute.hxx>
#include <TDocStd_FormatVersion.hxx>
#include <XmlMDataStd.hxx>
#include <XmlMDataStd_ExtStringArrayDriver.hxx>
#include <XmlObjMgt.hxx>
@@ -195,7 +196,7 @@ Standard_Boolean XmlMDataStd_ExtStringArrayDriver::Paste
// Read delta-flag.
Standard_Boolean aDelta(Standard_False);
if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 2) {
if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() >= TDocStd_FormatVersion_VERSION_3) {
Standard_Integer aDeltaValue;
if (!anElement.getAttribute(::IsDeltaOn()).GetInteger(aDeltaValue))
{
@@ -240,7 +241,7 @@ void XmlMDataStd_ExtStringArrayDriver::Paste (const Handle(TDF_Attribute)& theSo
// So, if the user wants to save the document under the 7th or earlier versions,
// don't apply this improvement.
Standard_Character c = '-';
if (theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 7)
if (theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() >= TDocStd_FormatVersion_VERSION_8)
{
// Preferrable symbols for the separator: - _ . : ^ ~
// Don't use a space as a separator: XML low-level parser sometimes "eats" it.

View File

@@ -22,6 +22,7 @@
#include <TColStd_PackedMapOfInteger.hxx>
#include <TDataStd_IntPackedMap.hxx>
#include <TDF_Attribute.hxx>
#include <TDocStd_FormatVersion.hxx>
#include <XmlMDataStd.hxx>
#include <XmlMDataStd_IntPackedMapDriver.hxx>
#include <XmlMDF_ADriver.hxx>
@@ -106,7 +107,7 @@ Standard_Boolean XmlMDataStd_IntPackedMapDriver::Paste
if(Ok) {
Standard_Boolean aDelta(Standard_False);
if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 2) {
if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() >= TDocStd_FormatVersion_VERSION_3) {
Standard_Integer aDeltaValue;
if (!anElement.getAttribute(::IsDeltaOn()).GetInteger(aDeltaValue))
{

View File

@@ -20,6 +20,7 @@
#include <Standard_Type.hxx>
#include <TDataStd_IntegerArray.hxx>
#include <TDF_Attribute.hxx>
#include <TDocStd_FormatVersion.hxx>
#include <XmlMDataStd.hxx>
#include <XmlMDataStd_IntegerArrayDriver.hxx>
#include <XmlObjMgt.hxx>
@@ -129,7 +130,7 @@ Standard_Boolean XmlMDataStd_IntegerArrayDriver::Paste
}
Standard_Boolean aDelta(Standard_False);
if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 2) {
if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() >= TDocStd_FormatVersion_VERSION_3) {
Standard_Integer aDeltaValue;
if (!anElement.getAttribute(::IsDeltaOn()).GetInteger(aDeltaValue))
{

View File

@@ -23,6 +23,7 @@
#include <TColStd_HArray1OfReal.hxx>
#include <TDataStd_RealArray.hxx>
#include <TDF_Attribute.hxx>
#include <TDocStd_FormatVersion.hxx>
#include <XmlMDataStd.hxx>
#include <XmlMDataStd_RealArrayDriver.hxx>
#include <XmlObjMgt.hxx>
@@ -140,7 +141,7 @@ Standard_Boolean XmlMDataStd_RealArrayDriver::Paste
}
Standard_Boolean aDelta(Standard_False);
if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 2) {
if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() >= TDocStd_FormatVersion_VERSION_3) {
Standard_Integer aDeltaValue;
if (!anElement.getAttribute(::IsDeltaOn()).GetInteger(aDeltaValue))
{

View File

@@ -19,6 +19,7 @@
#include <Standard_Type.hxx>
#include <TDataStd_TreeNode.hxx>
#include <TDF_Attribute.hxx>
#include <TDocStd_FormatVersion.hxx>
#include <XmlMDataStd_TreeNodeDriver.hxx>
#include <XmlObjMgt.hxx>
#include <XmlObjMgt_Persistent.hxx>
@@ -118,7 +119,7 @@ void XmlMDataStd_TreeNodeDriver::Paste
// tree id
// A not default ID is skipped for storage version 8 and newer.
if (aS->ID() != TDataStd_TreeNode::GetDefaultTreeID() ||
theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() < 8)
theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() < TDocStd_FormatVersion_VERSION_8)
{
Standard_Character aGuidStr [40];
Standard_PCharacter pGuidStr=aGuidStr;