Open CASCADE Technology 7.8.2.dev
RWObj_CafReader Class Reference

The OBJ mesh reader into XDE document. More...

#include <RWObj_CafReader.hxx>

Inheritance diagram for RWObj_CafReader:

Public Member Functions

 RWObj_CafReader ()
 Empty constructor.
 
Standard_Boolean IsSinglePrecision () const
 Return single precision flag for reading vertex data (coordinates); FALSE by default.
 
void SetSinglePrecision (Standard_Boolean theIsSinglePrecision)
 Setup single/double precision flag for reading vertex data (coordinates).
 
- Public Member Functions inherited from RWMesh_CafReader
 RWMesh_CafReader ()
 Empty constructor.
 
virtual ~RWMesh_CafReader ()
 Destructor.
 
const Handle< TDocStd_Document > & Document () const
 Return target document.
 
void SetDocument (const Handle< TDocStd_Document > &theDoc)
 Set target document. Set system length unit according to the units of the document.
 
const TCollection_AsciiStringRootPrefix () const
 Return prefix for generating root labels names.
 
void SetRootPrefix (const TCollection_AsciiString &theRootPrefix)
 Set prefix for generating root labels names.
 
Standard_Boolean ToFillIncompleteDocument () const
 Flag indicating if partially read file content should be put into the XDE document, TRUE by default.
 
void SetFillIncompleteDocument (Standard_Boolean theToFillIncomplete)
 Set flag allowing partially read file content to be put into the XDE document.
 
Standard_Integer MemoryLimitMiB () const
 Return memory usage limit in MiB, -1 by default which means no limit.
 
void SetMemoryLimitMiB (Standard_Integer theLimitMiB)
 Set memory usage limit in MiB; can be ignored by reader implementation!
 
const RWMesh_CoordinateSystemConverterCoordinateSystemConverter () const
 Return coordinate system converter.
 
void SetCoordinateSystemConverter (const RWMesh_CoordinateSystemConverter &theConverter)
 Set coordinate system converter.
 
Standard_Real SystemLengthUnit () const
 Return the length unit to convert into while reading the file, defined as scale factor for m (meters); -1.0 by default, which means that NO conversion will be applied.
 
void SetSystemLengthUnit (Standard_Real theUnits)
 Set system length units to convert into while reading the file, defined as scale factor for m (meters).
 
Standard_Boolean HasSystemCoordinateSystem () const
 Return TRUE if system coordinate system has been defined; FALSE by default.
 
const gp_Ax3SystemCoordinateSystem () const
 Return system coordinate system; UNDEFINED by default, which means that no conversion will be done.
 
void SetSystemCoordinateSystem (const gp_Ax3 &theCS)
 Set system origin coordinate system to perform conversion into during read.
 
void SetSystemCoordinateSystem (RWMesh_CoordinateSystem theCS)
 Set system origin coordinate system to perform conversion into during read.
 
Standard_Real FileLengthUnit () const
 Return the length unit to convert from while reading the file, defined as scale factor for m (meters). Can be undefined (-1.0) if file format is unitless.
 
void SetFileLengthUnit (Standard_Real theUnits)
 Set (override) file length units to convert from while reading the file, defined as scale factor for m (meters).
 
Standard_Boolean HasFileCoordinateSystem () const
 Return TRUE if file origin coordinate system has been defined.
 
const gp_Ax3FileCoordinateSystem () const
 Return file origin coordinate system; can be UNDEFINED, which means no conversion will be done.
 
void SetFileCoordinateSystem (const gp_Ax3 &theCS)
 Set (override) file origin coordinate system to perform conversion during read.
 
void SetFileCoordinateSystem (RWMesh_CoordinateSystem theCS)
 Set (override) file origin coordinate system to perform conversion during read.
 
bool Perform (const TCollection_AsciiString &theFile, const Message_ProgressRange &theProgress)
 Open stream and pass it to Perform method. The Document instance should be set beforehand.
 
bool Perform (std::istream &theStream, const Message_ProgressRange &theProgress, const TCollection_AsciiString &theFile="")
 Read the data from specified file.
 
Standard_Integer ExtraStatus () const
 Return extended status flags.
 
TopoDS_Shape SingleShape () const
 Return result as a single shape.
 
const NCollection_IndexedMap< TCollection_AsciiString > & ExternalFiles () const
 Return the list of complementary files - external references (textures, data, etc.).
 
const TColStd_IndexedDataMapOfStringStringMetadata () const
 Return metadata map.
 
Standard_Boolean ProbeHeader (const TCollection_AsciiString &theFile, const Message_ProgressRange &theProgress=Message_ProgressRange())
 Open stream and pass it to ProbeHeader method.
 
Standard_Boolean ProbeHeader (std::istream &theStream, const TCollection_AsciiString &theFile="", const Message_ProgressRange &theProgress=Message_ProgressRange())
 Read the header data from specified file without reading entire model. The main purpose is collecting metadata and external references - for copying model into a new location, for example. Can be NOT implemented (unsupported by format / reader).
 
- Public Member Functions inherited from Standard_Transient
 Standard_Transient ()
 Empty constructor.
 
 Standard_Transient (const Standard_Transient &)
 Copy constructor – does nothing.
 
Standard_Transientoperator= (const Standard_Transient &)
 Assignment operator, needed to avoid copying reference counter.
 
virtual ~Standard_Transient ()
 Destructor must be virtual.
 
virtual const opencascade::handle< Standard_Type > & DynamicType () const
 Returns a type descriptor about this object.
 
Standard_Boolean IsInstance (const opencascade::handle< Standard_Type > &theType) const
 Returns a true value if this is an instance of Type.
 
Standard_Boolean IsInstance (const Standard_CString theTypeName) const
 Returns a true value if this is an instance of TypeName.
 
Standard_Boolean IsKind (const opencascade::handle< Standard_Type > &theType) const
 Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
 
Standard_Boolean IsKind (const Standard_CString theTypeName) const
 Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
 
Standard_TransientThis () const
 Returns non-const pointer to this object (like const_cast). For protection against creating handle to objects allocated in stack or call from constructor, it will raise exception Standard_ProgramError if reference counter is zero.
 
Standard_Integer GetRefCount () const noexcept
 Get the reference counter of this object.
 
void IncrementRefCounter () noexcept
 Increments the reference counter of this object.
 
Standard_Integer DecrementRefCounter () noexcept
 Decrements the reference counter of this object; returns the decremented value.
 
virtual void Delete () const
 Memory deallocator for transient classes.
 

Protected Member Functions

virtual Standard_Boolean performMesh (std::istream &theStream, const TCollection_AsciiString &theFile, const Message_ProgressRange &theProgress, const Standard_Boolean theToProbe) override
 Read the mesh from specified file.
 
virtual Handle< RWObj_TriangulationReadercreateReaderContext ()
 Create reader context. Can be overridden by sub-class to read triangulation into application-specific data structures instead of Poly_Triangulation.
 
virtual void BindNamedShape (const TopoDS_Shape &theShape, const TCollection_AsciiString &theName, const RWObj_Material *theMaterial, const Standard_Boolean theIsRootShape) override
 
- Protected Member Functions inherited from RWMesh_CafReader
virtual Standard_Boolean perform (const TCollection_AsciiString &theFile, const Message_ProgressRange &theProgress, const Standard_Boolean theToProbe)
 Open stream and pass it to Perform method.
 
virtual Standard_Boolean perform (std::istream &theStream, const TCollection_AsciiString &theFile, const Message_ProgressRange &theProgress, const Standard_Boolean theToProbe)
 Read the data from specified file. Default implementation calls performMesh() and fills XDE document from collected shapes.
 
virtual Standard_Boolean performMesh (const TCollection_AsciiString &theFile, const Message_ProgressRange &theProgress, const Standard_Boolean theToProbe)
 Read the mesh from specified file.
 
virtual void fillDocument ()
 Fill document with new root shapes.
 
Standard_Boolean addShapeIntoDoc (CafDocumentTools &theTools, const TopoDS_Shape &theShape, const TDF_Label &theLabel, const TCollection_AsciiString &theParentName)
 Append new shape into the document (recursively).
 
Standard_Boolean addSubShapeIntoDoc (CafDocumentTools &theTools, const TopoDS_Shape &theShape, const TDF_Label &theParentLabel)
 Append new sub-shape into the document (recursively).
 
void setShapeName (const TDF_Label &theLabel, const TopAbs_ShapeEnum theShapeType, const TCollection_AsciiString &theName, const TDF_Label &theParentLabel, const TCollection_AsciiString &theParentName)
 Put name attribute onto the label.
 
void setShapeStyle (const CafDocumentTools &theTools, const TDF_Label &theLabel, const XCAFPrs_Style &theStyle)
 Put color and material attributes onto the label.
 
void setShapeNamedData (const CafDocumentTools &theTools, const TDF_Label &theLabel, const Handle< TDataStd_NamedData > &theNameData)
 Put name data (metadata) attribute onto the label.
 
void generateNames (const TCollection_AsciiString &theFile, const Standard_Integer theRootLower, const Standard_Boolean theWithSubLabels)
 Generate names for root labels starting from specified index.
 
- Protected Member Functions inherited from RWObj_IShapeReceiver

Protected Attributes

NCollection_DataMap< TCollection_AsciiString, Handle< XCAFDoc_VisMaterial > > myObjMaterialMap
 
Standard_Boolean myIsSinglePrecision
 flag for reading vertex data with single or double floating point precision
 
- Protected Attributes inherited from RWMesh_CafReader
Handle< TDocStd_DocumentmyXdeDoc
 target document
 
TColStd_IndexedDataMapOfStringString myMetadata
 metadata map
 
NCollection_IndexedMap< TCollection_AsciiStringmyExternalFiles
 the list of complementary files - external references (textures, data, etc.)
 
TCollection_AsciiString myRootPrefix
 root folder for generating root labels names
 
TopTools_SequenceOfShape myRootShapes
 sequence of result root shapes
 
RWMesh_NodeAttributeMap myAttribMap
 map of per-shape attributes
 
RWMesh_CoordinateSystemConverter myCoordSysConverter
 coordinate system converter
 
Standard_Boolean myToFillDoc
 fill document from shape sequence
 
Standard_Boolean myToFillIncomplete
 fill the document with partially retrieved data even if reader has failed with error
 
Standard_Integer myMemoryLimitMiB
 memory usage limit
 
Standard_Integer myExtraStatus
 extra status bitmask
 

Additional Inherited Members

- Public Types inherited from Standard_Transient
typedef void base_type
 Returns a type descriptor about this object.
 
- Static Public Member Functions inherited from Standard_Transient
static constexpr const char * get_type_name ()
 Returns a type descriptor about this object.
 
static const opencascade::handle< Standard_Type > & get_type_descriptor ()
 Returns type descriptor of Standard_Transient class.
 
- Static Protected Member Functions inherited from RWMesh_CafReader
static TCollection_AsciiString shapeTypeToString (TopAbs_ShapeEnum theType)
 Return shape type as string.
 

Detailed Description

The OBJ mesh reader into XDE document.

Constructor & Destructor Documentation

◆ RWObj_CafReader()

RWObj_CafReader::RWObj_CafReader ( )

Empty constructor.

Member Function Documentation

◆ BindNamedShape()

virtual void RWObj_CafReader::BindNamedShape ( const TopoDS_Shape & theShape,
const TCollection_AsciiString & theName,
const RWObj_Material * theMaterial,
const Standard_Boolean theIsRootShape )
overrideprotectedvirtual
Parameters
theShapeshape to register
theNameshape name
theMaterialshape material
theIsRootShapeindicates that this is a root object (free shape)

Implements RWObj_IShapeReceiver.

◆ createReaderContext()

virtual Handle< RWObj_TriangulationReader > RWObj_CafReader::createReaderContext ( )
protectedvirtual

Create reader context. Can be overridden by sub-class to read triangulation into application-specific data structures instead of Poly_Triangulation.

◆ IsSinglePrecision()

Standard_Boolean RWObj_CafReader::IsSinglePrecision ( ) const
inline

Return single precision flag for reading vertex data (coordinates); FALSE by default.

◆ performMesh()

virtual Standard_Boolean RWObj_CafReader::performMesh ( std::istream & theStream,
const TCollection_AsciiString & theFile,
const Message_ProgressRange & theProgress,
const Standard_Boolean theToProbe )
overrideprotectedvirtual

Read the mesh from specified file.

Implements RWMesh_CafReader.

◆ SetSinglePrecision()

void RWObj_CafReader::SetSinglePrecision ( Standard_Boolean theIsSinglePrecision)
inline

Setup single/double precision flag for reading vertex data (coordinates).

Field Documentation

◆ myIsSinglePrecision

Standard_Boolean RWObj_CafReader::myIsSinglePrecision
protected

flag for reading vertex data with single or double floating point precision

◆ myObjMaterialMap

NCollection_DataMap<TCollection_AsciiString, Handle< XCAFDoc_VisMaterial > > RWObj_CafReader::myObjMaterialMap
protected

The documentation for this class was generated from the following file: