Open CASCADE Technology  7.4.0
Public Member Functions | Protected Member Functions | Protected Attributes

RWObj_TriangulationReader Class Reference

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

#include <RWObj_TriangulationReader.hxx>

Inheritance diagram for RWObj_TriangulationReader:
Inheritance graph
[legend]

Public Member Functions

 RWObj_TriangulationReader ()
 Constructor. More...
 
void SetCreateShapes (Standard_Boolean theToCreateShapes)
 Set flag to create shapes. More...
 
void SetShapeReceiver (RWObj_IShapeReceiver *theReceiver)
 Set shape receiver callback. More...
 
virtual Handle< Poly_TriangulationGetTriangulation ()
 Create Poly_Triangulation from collected data. More...
 
TopoDS_Shape ResultShape ()
 Return result shape. More...
 
- Public Member Functions inherited from RWObj_Reader
 RWObj_Reader ()
 Empty constructor. More...
 
Standard_Boolean Read (const TCollection_AsciiString &theFile, const Handle< Message_ProgressIndicator > &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. More...
 
Standard_Boolean Probe (const TCollection_AsciiString &theFile, const Handle< Message_ProgressIndicator > &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. More...
 
const TCollection_AsciiStringFileComments () const
 Returns file comments (lines starting with # at the beginning of file). More...
 
const NCollection_IndexedMap< TCollection_AsciiString > & ExternalFiles () const
 Return the list of external file references. More...
 
Standard_Integer NbProbeNodes () const
 Number of probed nodes. More...
 
Standard_Integer NbProbeElems () const
 
Standard_Size MemoryLimit () const
 Returns memory limit in bytes; -1 (no limit) by default. More...
 
void SetMemoryLimit (Standard_Size theMemLimit)
 Specify memory limit in bytes, so that import will be aborted by specified limit before memory allocation error occurs. More...
 
const RWMesh_CoordinateSystemConverterTransformation () const
 Return transformation from one coordinate system to another; no transformation by default. More...
 
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. More...
 
Standard_Boolean IsSinglePrecision () const
 Return single precision flag for reading vertex data (coordinates); FALSE by default. More...
 
void SetSinglePrecision (Standard_Boolean theIsSinglePrecision)
 Setup single/double precision flag for reading vertex data (coordinates). More...
 
- Public Member Functions inherited from Standard_Transient
 Standard_Transient ()
 Empty constructor. More...
 
 Standard_Transient (const Standard_Transient &)
 Copy constructor – does nothing. More...
 
Standard_Transientoperator= (const Standard_Transient &)
 Assignment operator, needed to avoid copying reference counter. More...
 
virtual ~Standard_Transient ()
 Destructor must be virtual. More...
 
virtual void Delete () const
 Memory deallocator for transient classes. More...
 
virtual const opencascade::handle< Standard_Type > & DynamicType () const
 Returns a type descriptor about this object. More...
 
Standard_Boolean IsInstance (const opencascade::handle< Standard_Type > &theType) const
 Returns a true value if this is an instance of Type. More...
 
Standard_Boolean IsInstance (const Standard_CString theTypeName) const
 Returns a true value if this is an instance of TypeName. More...
 
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. More...
 
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. More...
 
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. More...
 
Standard_Integer GetRefCount () const
 Get the reference counter of this object. More...
 
void IncrementRefCounter () const
 Increments the reference counter of this object. More...
 
Standard_Integer DecrementRefCounter () const
 Decrements the reference counter of this object; returns the decremented value. More...
 

Protected Member Functions

virtual Standard_Boolean addMesh (const RWObj_SubMesh &theMesh, const RWObj_SubMeshReason theReason) override
 Flush active sub-mesh. More...
 
virtual gp_Pnt getNode (Standard_Integer theIndex) const override
 Retrieve sub-mesh node position. More...
 
virtual Standard_Integer addNode (const gp_Pnt &thePnt) override
 Add new node. More...
 
virtual void setNodeNormal (const Standard_Integer theIndex, const Graphic3d_Vec3 &theNormal) override
 Ignore normal. More...
 
virtual void setNodeUV (const Standard_Integer theIndex, const Graphic3d_Vec2 &theUV) override
 Ignore texture coordinates. More...
 
virtual void addElement (Standard_Integer theN1, Standard_Integer theN2, Standard_Integer theN3, Standard_Integer theN4) override
 Add element. More...
 
Standard_Boolean addSubShape (TopoDS_Shape &theParent, const TopoDS_Shape &theSubShape, const Standard_Boolean theToExpandCompound)
 Add sub-shape into specified shape. More...
 
- Protected Member Functions inherited from RWObj_Reader
Standard_Boolean read (const TCollection_AsciiString &theFile, const Handle< Message_ProgressIndicator > &theProgress, const Standard_Boolean 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. More...
 

Protected Attributes

NCollection_Vector< gp_PntmyNodes
 nodes of currently filled triangulation More...
 
NCollection_Vector< Graphic3d_Vec3myNormals
 normals of currently filled triangulation More...
 
NCollection_Vector< Graphic3d_Vec2myNodesUV
 UVs of currently filled triangulation. More...
 
NCollection_Vector< Poly_TrianglemyTriangles
 indexes of currently filled triangulation More...
 
RWObj_IShapeReceivermyShapeReceiver
 optional shape receiver More...
 
TopoDS_Compound myResultShape
 result shape as Compound of objects More...
 
TopoDS_Compound myLastObjectShape
 Compound containing current object groups. More...
 
TopoDS_Shape myLastGroupShape
 current group shape - either a single Face or Compound of Faces More...
 
TCollection_AsciiString myLastGroupName
 current group name More...
 
TCollection_AsciiString myLastFaceMaterial
 last face material name More...
 
Standard_Boolean myToCreateShapes
 create a single triangulation More...
 
- Protected Attributes inherited from RWObj_Reader
NCollection_IndexedMap< TCollection_AsciiStringmyExternalFiles
 list of external file references More...
 
TCollection_AsciiString myFileComments
 file header comments More...
 
TCollection_AsciiString myFolder
 folder containing the OBJ file More...
 
RWMesh_CoordinateSystemConverter myCSTrsf
 coordinate system flipper More...
 
Standard_Size myMemLimitBytes
 memory limit in bytes More...
 
Standard_Size myMemEstim
 estimated memory occupation in bytes More...
 
Standard_Integer myNbLines
 number of parsed lines (e.g. current line) More...
 
Standard_Integer myNbProbeNodes
 number of probed nodes More...
 
Standard_Integer myNbProbeElems
 number of probed elements More...
 
Standard_Integer myNbElemsBig
 number of big elements (polygons with 5+ nodes) More...
 
Standard_Boolean myToAbort
 flag indicating abort state (e.g. syntax error) More...
 
VectorOfVertices myObjVerts
 temporary vector of vertices More...
 
NCollection_Vector< Graphic3d_Vec2myObjVertsUV
 temporary vector of UV parameters More...
 
NCollection_Vector< Graphic3d_Vec3myObjNorms
 temporary vector of normals More...
 
NCollection_DataMap< Graphic3d_Vec3i, Standard_Integer, ObjVec3iHashermyPackedIndices
 list of external file references More...
 
NCollection_DataMap< TCollection_AsciiString, RWObj_MaterialmyMaterials
 map of known materials More...
 
RWObj_SubMesh myActiveSubMesh
 active sub-mesh definition More...
 
std::vector< Standard_IntegermyCurrElem
 indices for the current element More...
 

Additional Inherited Members

- Public Types inherited from Standard_Transient
typedef void base_type
 Returns a type descriptor about this object. More...
 
- Static Public Member Functions inherited from Standard_Transient
static const char * get_type_name ()
 Returns a type descriptor about this object. More...
 
static const opencascade::handle< Standard_Type > & get_type_descriptor ()
 Returns type descriptor of Standard_Transient class. More...
 

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()

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

Add element.

Implements RWObj_Reader.

◆ addMesh()

virtual Standard_Boolean RWObj_TriangulationReader::addMesh ( const RWObj_SubMesh theMesh,
const RWObj_SubMeshReason  theReason 
)
overrideprotectedvirtual

Flush active sub-mesh.

Implements RWObj_Reader.

◆ addNode()

virtual Standard_Integer RWObj_TriangulationReader::addNode ( const gp_Pnt thePnt)
inlineoverrideprotectedvirtual

Add new node.

Implements RWObj_Reader.

◆ addSubShape()

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

Add sub-shape into specified shape.

◆ getNode()

virtual gp_Pnt RWObj_TriangulationReader::getNode ( Standard_Integer  theIndex) const
inlineoverrideprotectedvirtual

Retrieve sub-mesh node position.

Implements RWObj_Reader.

◆ GetTriangulation()

virtual 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 ( Standard_Boolean  theToCreateShapes)
inline

Set flag to create shapes.

◆ setNodeNormal()

virtual void RWObj_TriangulationReader::setNodeNormal ( const Standard_Integer  theIndex,
const Graphic3d_Vec3 theNormal 
)
inlineoverrideprotectedvirtual

Ignore normal.

Implements RWObj_Reader.

◆ setNodeUV()

virtual void RWObj_TriangulationReader::setNodeUV ( const Standard_Integer  theIndex,
const Graphic3d_Vec2 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_Vector<gp_Pnt> RWObj_TriangulationReader::myNodes
protected

nodes of currently filled triangulation

◆ myNodesUV

NCollection_Vector<Graphic3d_Vec2> RWObj_TriangulationReader::myNodesUV
protected

UVs of currently filled triangulation.

◆ myNormals

NCollection_Vector<Graphic3d_Vec3> 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

Standard_Boolean RWObj_TriangulationReader::myToCreateShapes
protected

create a single triangulation

◆ myTriangles

NCollection_Vector<Poly_Triangle> RWObj_TriangulationReader::myTriangles
protected

indexes of currently filled triangulation


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