1 // Copyright (c) 2019 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
14 #ifndef _RWObj_CafReader_HeaderFile
15 #define _RWObj_CafReader_HeaderFile
17 #include <RWMesh_CafReader.hxx>
18 #include <RWObj_TriangulationReader.hxx>
20 //! The OBJ mesh reader into XDE document.
21 class RWObj_CafReader : public RWMesh_CafReader, protected RWObj_IShapeReceiver
23 DEFINE_STANDARD_RTTIEXT(RWObj_CafReader, RWMesh_CafReader)
26 //! Empty constructor.
27 Standard_EXPORT RWObj_CafReader();
29 //! Return single precision flag for reading vertex data (coordinates); FALSE by default.
30 Standard_Boolean IsSinglePrecision() const { return myIsSinglePrecision; }
32 //! Setup single/double precision flag for reading vertex data (coordinates).
33 void SetSinglePrecision (Standard_Boolean theIsSinglePrecision) { myIsSinglePrecision = theIsSinglePrecision; }
37 //! Read the mesh from specified file.
38 Standard_EXPORT virtual Standard_Boolean performMesh (const TCollection_AsciiString& theFile,
39 const Message_ProgressRange& theProgress,
40 const Standard_Boolean theToProbe) Standard_OVERRIDE;
44 //! Create reader context.
45 //! Can be overridden by sub-class to read triangulation into application-specific data structures instead of Poly_Triangulation.
46 Standard_EXPORT virtual Handle(RWObj_TriangulationReader) createReaderContext();
48 //! @param theShape shape to register
49 //! @param theName shape name
50 //! @param theMaterial shape material
51 //! @param theIsRootShape indicates that this is a root object (free shape)
52 Standard_EXPORT virtual void BindNamedShape (const TopoDS_Shape& theShape,
53 const TCollection_AsciiString& theName,
54 const RWObj_Material* theMaterial,
55 const Standard_Boolean theIsRootShape) Standard_OVERRIDE;
59 NCollection_DataMap<TCollection_AsciiString, Handle(XCAFDoc_VisMaterial)> myObjMaterialMap;
60 Standard_Boolean myIsSinglePrecision; //!< flag for reading vertex data with single or double floating point precision
63 #endif // _RWObj_CafReader_HeaderFile