1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-08 14:17:06 +03:00

0027835: Application Framework, BinXCAF - handle correctly faces with NULL surface within BinTools_ShapeSet

BinTools_ShapeSet::AddGeometry() now writes NULL surface with 0 index.
myWithTriangles is ignored for TopoDS_Face with NULL surface so that
triangulation-only faces are not lost with defaults.

Added Draw Harness command StoreTriangulation defining
WithTriangulation flag for BinXCAF/BinOcaf storage drivers.
This commit is contained in:
kgv
2016-09-03 19:21:58 +03:00
committed by bugmaster
parent e5d7e24960
commit f1fb0901d6
7 changed files with 167 additions and 33 deletions

View File

@@ -13,15 +13,16 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BinDrivers_DocumentStorageDriver.hxx>
#include <BinDrivers.hxx>
#include <BinDrivers_DocumentStorageDriver.hxx>
#include <BinLDrivers_DocumentSection.hxx>
#include <BinMDF_ADriver.hxx>
#include <BinMDF_ADriverTable.hxx>
#include <BinMNaming_NamedShapeDriver.hxx>
#include <CDM_MessageDriver.hxx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_NotImplemented.hxx>
#include <Standard_Type.hxx>
#include <TCollection_AsciiString.hxx>
#include <TNaming_NamedShape.hxx>
@@ -47,6 +48,51 @@ Handle(BinMDF_ADriverTable) BinDrivers_DocumentStorageDriver::AttributeDrivers
return BinDrivers::AttributeDrivers (theMessageDriver);
}
//=======================================================================
//function : IsWithTriangles
//purpose :
//=======================================================================
Standard_Boolean BinDrivers_DocumentStorageDriver::IsWithTriangles() const
{
if (myDrivers.IsNull())
{
return Standard_False;
}
Handle(BinMDF_ADriver) aDriver;
myDrivers->GetDriver (STANDARD_TYPE(TNaming_NamedShape), aDriver);
Handle(BinMNaming_NamedShapeDriver) aShapesDriver = Handle(BinMNaming_NamedShapeDriver)::DownCast(aDriver);
return !aShapesDriver.IsNull()
&& aShapesDriver->IsWithTriangles();
}
//=======================================================================
//function : SetWithTriangles
//purpose :
//=======================================================================
void BinDrivers_DocumentStorageDriver::SetWithTriangles (const Handle(CDM_MessageDriver)& theMessageDriver,
const Standard_Boolean theWithTriangulation)
{
if (myDrivers.IsNull())
{
myDrivers = AttributeDrivers (theMessageDriver);
}
if (myDrivers.IsNull())
{
return;
}
Handle(BinMDF_ADriver) aDriver;
myDrivers->GetDriver (STANDARD_TYPE(TNaming_NamedShape), aDriver);
Handle(BinMNaming_NamedShapeDriver) aShapesDriver = Handle(BinMNaming_NamedShapeDriver)::DownCast(aDriver);
if (aShapesDriver.IsNull())
{
Standard_NotImplemented::Raise("Internal Error - TNaming_NamedShape is not found!");
}
aShapesDriver->SetWithTriangles (theWithTriangulation);
}
//=======================================================================
//function : WriteShapeSection
//purpose : Implements WriteShapeSection

View File

@@ -44,8 +44,12 @@ public:
//! implements the procedure of writing a shape section to file
Standard_EXPORT virtual void WriteShapeSection (BinLDrivers_DocumentSection& theDocSection, Standard_OStream& theOS) Standard_OVERRIDE;
//! Return true if shape should be stored with triangles.
Standard_EXPORT Standard_Boolean IsWithTriangles() const;
//! Set if triangulation should be stored or not.
Standard_EXPORT void SetWithTriangles (const Handle(CDM_MessageDriver)& theMessageDriver,
const Standard_Boolean theWithTriangulation);
DEFINE_STANDARD_RTTIEXT(BinDrivers_DocumentStorageDriver,BinLDrivers_DocumentStorageDriver)