OCCT 8.0.1
OCCT documentation

Search guides and API reference

Enter at least two characters.

    Open CASCADE Technology Reference Manual 8.0.1
    RWObj_TriangulationReader Class Reference

    RWObj_Reader implementation dumping OBJ file into Poly_Triangulation. More...

    #include <RWObj_TriangulationReader.hxx>

    Inheritance diagram for RWObj_TriangulationReader:

    Public Member Functions

     RWObj_TriangulationReader ()
     Constructor.
    void SetCreateShapes (bool theToCreateShapes)
     Set flag to create shapes.
    void SetShapeReceiver (RWObj_IShapeReceiver *theReceiver)
     Set shape receiver callback.
    virtual occ::handle< Poly_Triangulation > GetTriangulation ()
     Create Poly_Triangulation from collected data.
    TopoDS_Shape ResultShape ()
     Return result shape.
    Public Member Functions inherited from RWObj_Reader
     RWObj_Reader ()
     Empty constructor.
    bool Read (const TCollection_AsciiString &theFile, const Message_ProgressRange &theProgress)
     Open stream and pass it to Read method Returns true if success, false on error.
    bool Read (std::istream &theStream, const TCollection_AsciiString &theFile, const Message_ProgressRange &theProgress)
     Reads data from OBJ file. Unicode paths can be given in UTF-8 encoding. Returns true if success, false on error or user break.
    bool Probe (const TCollection_AsciiString &theFile, const Message_ProgressRange &theProgress)
     Open stream and pass it to Probe method.
    bool Probe (std::istream &theStream, const TCollection_AsciiString &theFile, const Message_ProgressRange &theProgress)
     Probe data from OBJ file (comments, external references) without actually reading mesh data. Although mesh data will not be collected, the full file content will be parsed, due to OBJ format limitations.
    const TCollection_AsciiString & FileComments () const
     Returns file comments (lines starting with # at the beginning of file).
    const NCollection_IndexedMap< TCollection_AsciiString > & ExternalFiles () const
     Return the list of external file references.
    int NbProbeNodes () const
     Number of probed nodes.
    int NbProbeElems () const
    size_t MemoryLimit () const
     Returns memory limit in bytes; -1 (no limit) by default.
    void SetMemoryLimit (size_t theMemLimit)
     Specify memory limit in bytes, so that import will be aborted by specified limit before memory allocation error occurs.
    const RWMesh_CoordinateSystemConverter & Transformation () const
     Return transformation from one coordinate system to another; no transformation by default.
    void SetTransformation (const RWMesh_CoordinateSystemConverter &theCSConverter)
     Setup transformation from one coordinate system to another. OBJ file might be exported following various coordinate system conventions, so that it might be useful automatically transform data during file reading.
    bool IsSinglePrecision () const
     Return single precision flag for reading vertex data (coordinates); FALSE by default.
    void SetSinglePrecision (bool theIsSinglePrecision)
     Setup single/double precision flag for reading vertex data (coordinates).
    Public Member Functions inherited from Standard_Transient
     Standard_Transient ()
     Empty constructor.
     Standard_Transient (const Standard_Transient &)
     Copy constructor – does nothing.
    Standard_Transient & operator= (const Standard_Transient &)
     Assignment operator, needed to avoid copying reference counter.
    virtual ~Standard_Transient ()=default
     Destructor must be virtual.
    virtual const opencascade::handle< Standard_Type > & DynamicType () const
     Returns a type descriptor about this object.
    bool IsInstance (const opencascade::handle< Standard_Type > &theType) const
     Returns a true value if this is an instance of Type.
    bool IsInstance (const char *const theTypeName) const
     Returns a true value if this is an instance of TypeName.
    bool 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.
    bool IsKind (const char *const 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_Transient * This () 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.
    int GetRefCount () const noexcept
     Get the reference counter of this object.
    void IncrementRefCounter () noexcept
     Increments the reference counter of this object. Uses relaxed memory ordering since incrementing only requires atomicity, not synchronization with other memory operations.
    int DecrementRefCounter () noexcept
     Decrements the reference counter of this object; returns the decremented value. Uses release ordering for the decrement to ensure all writes to the object are visible before the count reaches zero. An acquire fence is added only when the count reaches zero, ensuring proper synchronization before deletion. This is more efficient than using acq_rel for every decrement.
    virtual void Delete () const
     Memory deallocator for transient classes.

    Protected Member Functions

    bool addMesh (const RWObj_SubMesh &theMesh, const RWObj_SubMeshReason theReason) override
     Flush active sub-mesh.
    gp_Pnt getNode (int theIndex) const override
     Retrieve sub-mesh node position.
    int addNode (const gp_Pnt &thePnt) override
     Add new node.
    void setNodeNormal (const int theIndex, const NCollection_Vec3< float > &theNormal) override
     Ignore normal.
    void setNodeUV (const int theIndex, const NCollection_Vec2< float > &theUV) override
     Ignore texture coordinates.
    void addElement (int theN1, int theN2, int theN3, int theN4) override
     Add element.
    bool addSubShape (TopoDS_Shape &theParent, const TopoDS_Shape &theSubShape, const bool theToExpandCompound)
     Add sub-shape into specified shape.
    Protected Member Functions inherited from RWObj_Reader
    bool read (std::istream &theStream, const TCollection_AsciiString &theFile, const Message_ProgressRange &theProgress, const bool theToProbe)
     Reads data from OBJ file. Unicode paths can be given in UTF-8 encoding. Returns true if success, false on error or user break.

    Protected Attributes

    NCollection_DynamicArray< gp_Pnt > myNodes
     nodes of currently filled triangulation
    NCollection_DynamicArray< NCollection_Vec3< float > > myNormals
     normals of currently filled triangulation
    NCollection_DynamicArray< NCollection_Vec2< float > > myNodesUV
     UVs of currently filled triangulation.
    NCollection_DynamicArray< Poly_Triangle > myTriangles
     indexes of currently filled triangulation
    RWObj_IShapeReceiver * myShapeReceiver
     optional shape receiver
    TopoDS_Compound myResultShape
     result shape as Compound of objects
    TopoDS_Compound myLastObjectShape
     Compound containing current object groups.
    TopoDS_Shape myLastGroupShape
     current group shape - either a single Face or Compound of Faces
    TCollection_AsciiString myLastGroupName
     current group name
    TCollection_AsciiString myLastFaceMaterial
     last face material name
    bool myToCreateShapes
     create a single triangulation
    NCollection_IndexedMap< TCollection_AsciiString > myExternalFiles
     list of external file references
    TCollection_AsciiString myFileComments
     file header comments
    TCollection_AsciiString myFolder
     folder containing the OBJ file
    RWMesh_CoordinateSystemConverter myCSTrsf
     coordinate system flipper
    size_t myMemLimitBytes
     memory limit in bytes
    size_t myMemEstim
     estimated memory occupation in bytes
    int myNbLines
     number of parsed lines (e.g. current line)
    int myNbProbeNodes
     number of probed nodes
    int myNbProbeElems
     number of probed elements
    int myNbElemsBig
     number of big elements (polygons with 5+ nodes)
    bool myToAbort
     flag indicating abort state (e.g. syntax error)
    VectorOfVertices myObjVerts
     temporary vector of vertices
    NCollection_DynamicArray< NCollection_Vec2< float > > myObjVertsUV
     temporary vector of UV parameters
    NCollection_DynamicArray< NCollection_Vec3< float > > myObjNorms
     temporary vector of normals
    NCollection_DataMap< NCollection_Vec3< int >, int, ObjVec3iHasher > myPackedIndices
     list of external file references
    NCollection_DataMap< TCollection_AsciiString, RWObj_Material > myMaterials
     map of known materials
    RWObj_SubMesh myActiveSubMesh
     active sub-mesh definition
    NCollection_LinearVector< int > myCurrElem
     indices for the current element

    Additional Inherited Members

    typedef void base_type
     Returns a type descriptor about this object.
    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.

    Detailed Description

    RWObj_Reader implementation dumping OBJ file into Poly_Triangulation.

    Constructor & Destructor Documentation

    ◆ RWObj_TriangulationReader()

    RWObj_TriangulationReader::RWObj_TriangulationReader ( )
    inline

    Constructor.

    Member Function Documentation

    ◆ addElement()

    void RWObj_TriangulationReader::addElement ( int theN1,
    int theN2,
    int theN3,
    int theN4 )
    inlineoverrideprotectedvirtual

    Add element.

    Implements RWObj_Reader.

    ◆ addMesh()

    bool RWObj_TriangulationReader::addMesh ( const RWObj_SubMesh & theMesh,
    const RWObj_SubMeshReason theReason )
    overrideprotectedvirtual

    Flush active sub-mesh.

    Implements RWObj_Reader.

    ◆ addNode()

    int RWObj_TriangulationReader::addNode ( const gp_Pnt & thePnt)
    inlineoverrideprotectedvirtual

    Add new node.

    Implements RWObj_Reader.

    ◆ addSubShape()

    bool RWObj_TriangulationReader::addSubShape ( TopoDS_Shape & theParent,
    const TopoDS_Shape & theSubShape,
    const bool theToExpandCompound )
    protected

    Add sub-shape into specified shape.

    ◆ getNode()

    gp_Pnt RWObj_TriangulationReader::getNode ( int theIndex) const
    inlineoverrideprotectedvirtual

    Retrieve sub-mesh node position.

    Implements RWObj_Reader.

    ◆ GetTriangulation()

    virtual occ::handle< Poly_Triangulation > RWObj_TriangulationReader::GetTriangulation ( )
    virtual

    Create Poly_Triangulation from collected data.

    ◆ ResultShape()

    TopoDS_Shape RWObj_TriangulationReader::ResultShape ( )

    Return result shape.

    ◆ SetCreateShapes()

    void RWObj_TriangulationReader::SetCreateShapes ( bool theToCreateShapes)
    inline

    Set flag to create shapes.

    ◆ setNodeNormal()

    void RWObj_TriangulationReader::setNodeNormal ( const int theIndex,
    const NCollection_Vec3< float > & theNormal )
    inlineoverrideprotectedvirtual

    Ignore normal.

    Implements RWObj_Reader.

    ◆ setNodeUV()

    void RWObj_TriangulationReader::setNodeUV ( const int theIndex,
    const NCollection_Vec2< float > & theUV )
    inlineoverrideprotectedvirtual

    Ignore texture coordinates.

    Implements RWObj_Reader.

    ◆ SetShapeReceiver()

    void RWObj_TriangulationReader::SetShapeReceiver ( RWObj_IShapeReceiver * theReceiver)
    inline

    Set shape receiver callback.

    Field Documentation

    ◆ myLastFaceMaterial

    TCollection_AsciiString RWObj_TriangulationReader::myLastFaceMaterial
    protected

    last face material name

    ◆ myLastGroupName

    TCollection_AsciiString RWObj_TriangulationReader::myLastGroupName
    protected

    current group name

    ◆ myLastGroupShape

    TopoDS_Shape RWObj_TriangulationReader::myLastGroupShape
    protected

    current group shape - either a single Face or Compound of Faces

    ◆ myLastObjectShape

    TopoDS_Compound RWObj_TriangulationReader::myLastObjectShape
    protected

    Compound containing current object groups.

    ◆ myNodes

    NCollection_DynamicArray<gp_Pnt> RWObj_TriangulationReader::myNodes
    protected

    nodes of currently filled triangulation

    ◆ myNodesUV

    NCollection_DynamicArray<NCollection_Vec2<float> > RWObj_TriangulationReader::myNodesUV
    protected

    UVs of currently filled triangulation.

    ◆ myNormals

    NCollection_DynamicArray<NCollection_Vec3<float> > RWObj_TriangulationReader::myNormals
    protected

    normals of currently filled triangulation

    ◆ myResultShape

    TopoDS_Compound RWObj_TriangulationReader::myResultShape
    protected

    result shape as Compound of objects

    ◆ myShapeReceiver

    RWObj_IShapeReceiver* RWObj_TriangulationReader::myShapeReceiver
    protected

    optional shape receiver

    ◆ myToCreateShapes

    bool RWObj_TriangulationReader::myToCreateShapes
    protected

    create a single triangulation

    ◆ myTriangles

    NCollection_DynamicArray<Poly_Triangle> RWObj_TriangulationReader::myTriangles
    protected

    indexes of currently filled triangulation


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