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

0030115: Implementation of import from XCAF to VRML.

This commit is contained in:
skl
2018-09-06 11:18:13 +03:00
committed by bugmaster
parent eaac086605
commit a3506de770
14 changed files with 641 additions and 150 deletions

View File

@@ -371,8 +371,32 @@ void VrmlAPI_Writer::write_v2(const TopoDS_Shape& aShape,const Standard_CString
aConv.AddShape(aShape);
aConv.Convert(anExtFace, anExtEdge);
filebuf aFoc;
ostream outStream (&aFoc);
if (aFoc.open (aFile, ios::out))
outStream << aScene;
std::ofstream anOutStream;
OSD_OpenStream(anOutStream, aFile, std::ios::out);
if (!anOutStream.fail())
{
anOutStream << aScene;
}
}
//=======================================================================
//function : WriteDoc
//purpose :
//=======================================================================
void VrmlAPI_Writer::WriteDoc(
const Handle(TDocStd_Document) &theDoc,
const Standard_CString theFile,
const Standard_Real theScale) const
{
VrmlData_Scene aScene;
VrmlData_ShapeConvert aConv(aScene, theScale);
aConv.ConvertDocument(theDoc);
std::ofstream anOutStream;
OSD_OpenStream(anOutStream, theFile, std::ios::out);
if (!anOutStream.fail())
{
anOutStream << aScene;
}
}

View File

@@ -25,6 +25,8 @@
#include <Quantity_HArray1OfColor.hxx>
#include <Standard_CString.hxx>
#include <Standard_Integer.hxx>
#include <TDocStd_Document.hxx>
class VrmlConverter_Drawer;
class VrmlConverter_Projector;
class Vrml_Material;
@@ -103,7 +105,15 @@ public:
//! Converts the shape aShape to
//! VRML format of the passed version and writes it to the file identified by aFile.
Standard_EXPORT void Write (const TopoDS_Shape& aShape, const Standard_CString aFile, const Standard_Integer aVersion = 2) const;
Standard_EXPORT void Write (const TopoDS_Shape& aShape, const Standard_CString aFile,
const Standard_Integer aVersion = 2) const;
//! Converts the document to VRML format of the passed version
//! and writes it to the file identified by aFile.
Standard_EXPORT void WriteDoc(
const Handle(TDocStd_Document) &theDoc,
const Standard_CString theFile,
const Standard_Real theScale) const;
protected: