#include <BRep_Tool.hxx>
-#include <OSD_OpenFile.hxx>
+#include <OSD_FileSystem.hxx>
#include <OSD_Path.hxx>
#include <Poly_Triangulation.hxx>
-#include <Quantity_HArray1OfColor.hxx>
#include <Standard_Stream.hxx>
#include <TColStd_HArray1OfReal.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Shape.hxx>
-#include <TopTools_Array1OfShape.hxx>
#include <Vrml.hxx>
#include <Vrml_Group.hxx>
#include <Vrml_Instancing.hxx>
{
myDrawer = new VrmlConverter_Drawer;
myDeflection = -1;
- Quantity_Color color;
- color.SetValues(0, 0, 0, Quantity_TOC_RGB);
- Handle(Quantity_HArray1OfColor) Col1 = new Quantity_HArray1OfColor(1,1);
- Col1->SetValue(1,color);
+ Handle(Quantity_HArray1OfColor) Col1 = new Quantity_HArray1OfColor (1, 1, Quantity_NOC_BLACK);
Handle(TColStd_HArray1OfReal) kik1 = new TColStd_HArray1OfReal(1,1,0.0);
Handle(TColStd_HArray1OfReal) kik2 = new TColStd_HArray1OfReal(1,1,0.1);
myFrontMaterial = new Vrml_Material(Col1,Col1, Col1, Col1, kik1, kik2);
myShininess = 0.1;
Handle(TColStd_HArray1OfReal) kik1 = new TColStd_HArray1OfReal(1,1,myTransparency);
Handle(TColStd_HArray1OfReal) kik2 = new TColStd_HArray1OfReal(1,1,myShininess);
- Handle(Quantity_HArray1OfColor) Col = new Quantity_HArray1OfColor(1,1);
- Quantity_Color color;
- color.SetValues(0, 0, 0, Quantity_TOC_RGB);
- Col->SetValue(1,color);
+ Handle(Quantity_HArray1OfColor) Col = new Quantity_HArray1OfColor(1, 1, Quantity_NOC_BLACK);
//
myFrontMaterial->SetAmbientColor(Col); myFrontMaterial->SetTransparency(kik1);myFrontMaterial->SetShininess(kik2);
myPointsMaterial->SetAmbientColor(Col); myPointsMaterial->SetTransparency(kik1);myPointsMaterial->SetShininess(kik2);
myUnfreeBoundsMaterial->SetAmbientColor(Col); myUnfreeBoundsMaterial->SetTransparency(kik1);myUnfreeBoundsMaterial->SetShininess(kik2);
//
//
- Handle(Quantity_HArray1OfColor) Col2 = new Quantity_HArray1OfColor(1,1);
- color.SetValues(0.75, 0.75, 0.75, Quantity_TOC_RGB);
- Col2->SetValue(1,color);
- Handle(Quantity_HArray1OfColor) Col3 = new Quantity_HArray1OfColor(1,1);
- color.SetValues(0.82, 0.79, 0.42, Quantity_TOC_RGB);
- Col3->SetValue(1,color);
-
+ Handle(Quantity_HArray1OfColor) Col2 = new Quantity_HArray1OfColor(1, 1, Quantity_Color (0.75, 0.75, 0.75, Quantity_TOC_sRGB));
+ Handle(Quantity_HArray1OfColor) Col3 = new Quantity_HArray1OfColor(1, 1, Quantity_Color (0.82, 0.79, 0.42, Quantity_TOC_sRGB));
myUisoMaterial->SetDiffuseColor(Col2);
myVisoMaterial->SetDiffuseColor(Col2);
myFreeBoundsMaterial->SetDiffuseColor(Col2);
{
OSD_Path thePath(aFile);
TCollection_AsciiString theFile;thePath.SystemName(theFile);
- std::ofstream outfile;
- OSD_OpenStream(outfile, theFile.ToCString(), std::ios::out);
- if (!outfile)
+ const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
+ std::shared_ptr<std::ostream> anOutFile = aFileSystem->OpenOStream (theFile, std::ios::out | std::ios::binary);
+ if (anOutFile.get() == NULL)
{
return Standard_False;
}
XUp, YUp, ZUp,
Camera,
Light);
- Vrml::VrmlHeaderWriter(outfile);
+ Vrml::VrmlHeaderWriter (*anOutFile);
if (myRepresentation == VrmlAPI_BothRepresentation)
- Vrml::CommentWriter(" This file contents both Shaded and Wire Frame representation of selected Shape ",outfile);
+ Vrml::CommentWriter(" This file contents both Shaded and Wire Frame representation of selected Shape ", *anOutFile);
if (myRepresentation == VrmlAPI_ShadedRepresentation)
- Vrml::CommentWriter(" This file contents only Shaded representation of selected Shape ",outfile);
+ Vrml::CommentWriter(" This file contents only Shaded representation of selected Shape ", *anOutFile);
if (myRepresentation == VrmlAPI_WireFrameRepresentation)
- Vrml::CommentWriter(" This file contents only Wire Frame representation of selected Shape ",outfile);
+ Vrml::CommentWriter(" This file contents only Wire Frame representation of selected Shape ", *anOutFile);
Vrml_Separator S1;
- S1.Print(outfile);
- projector->Add(outfile);
+ S1.Print (*anOutFile);
+ projector->Add (*anOutFile);
Light = VrmlConverter_DirectionLight;
Camera = VrmlConverter_OrthographicCamera;
Handle(VrmlConverter_Projector) projector1 = new VrmlConverter_Projector (Shapes,
XUp, YUp, ZUp,
Camera,
Light);
- projector1->Add(outfile);
+ projector1->Add (*anOutFile);
Vrml_Separator S2;
- S2.Print(outfile);
+ S2.Print (*anOutFile);
if ( (myRepresentation == VrmlAPI_ShadedRepresentation || myRepresentation == VrmlAPI_BothRepresentation) && hasTriangles)
{
Vrml_Group Group1;
- Group1.Print(outfile);
+ Group1.Print (*anOutFile);
Vrml_Instancing I2 ("Shaded representation of shape");
- I2.DEF(outfile);
- VrmlConverter_ShadedShape::Add(outfile,aShape,myDrawer);
- Group1.Print(outfile);
+ I2.DEF (*anOutFile);
+ VrmlConverter_ShadedShape::Add (*anOutFile,aShape,myDrawer);
+ Group1.Print (*anOutFile);
}
if (myRepresentation == VrmlAPI_WireFrameRepresentation || myRepresentation == VrmlAPI_BothRepresentation)
{
Vrml_Group Group2;
- Group2.Print(outfile);
+ Group2.Print (*anOutFile);
Vrml_Instancing I3 ("Wire Frame representation of shape");
- I3.DEF(outfile);
- VrmlConverter_WFDeflectionShape::Add(outfile,aShape,myDrawer);
- Group2.Print(outfile);
+ I3.DEF (*anOutFile);
+ VrmlConverter_WFDeflectionShape::Add (*anOutFile,aShape,myDrawer);
+ Group2.Print (*anOutFile);
}
- S2.Print(outfile);
- S1.Print(outfile);
+ S2.Print (*anOutFile);
+ S1.Print (*anOutFile);
- outfile.close();
- return outfile.good();
+ anOutFile->flush();
+ return anOutFile->good();
}
Standard_Boolean VrmlAPI_Writer::write_v2(const TopoDS_Shape& aShape,const Standard_CString aFile) const
aConv.AddShape(aShape);
aConv.Convert(anExtFace, anExtEdge);
- std::ofstream anOutStream;
- OSD_OpenStream(anOutStream, aFile, std::ios::out);
- if (anOutStream)
+ const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
+ std::shared_ptr<std::ostream> anOutStream = aFileSystem->OpenOStream (aFile, std::ios::out | std::ios::binary);
+ if (anOutStream.get() != NULL)
{
- anOutStream << aScene;
- anOutStream.close();
- return anOutStream.good();
+ *anOutStream << aScene;
+ anOutStream->flush();
+ return anOutStream->good();
}
-
+ anOutStream.reset();
return Standard_False;
}
VrmlData_ShapeConvert aConv(aScene, theScale);
aConv.ConvertDocument(theDoc);
- std::ofstream anOutStream;
- OSD_OpenStream(anOutStream, theFile, std::ios::out);
- if (anOutStream)
+ const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
+ std::shared_ptr<std::ostream> anOutStream = aFileSystem->OpenOStream (theFile, std::ios::out | std::ios::binary);
+ if (anOutStream.get() != NULL)
{
- anOutStream << aScene;
- anOutStream.close();
- return anOutStream.good();
+ *anOutStream << aScene;
+ anOutStream->flush();
+ return anOutStream->good();
}
-
+ anOutStream.reset();
return Standard_False;
}