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

RWPly_CafWriter Class Reference

PLY writer context from XCAF document. More...

#include <RWPly_CafWriter.hxx>

Inheritance diagram for RWPly_CafWriter:
Inheritance graph
[legend]

Public Member Functions

 RWPly_CafWriter (const TCollection_AsciiString &theFile)
 Main constructor. More...
 
virtual ~RWPly_CafWriter ()
 Destructor. More...
 
const RWMesh_CoordinateSystemConverterCoordinateSystemConverter () const
 Return transformation from OCCT to PLY coordinate system. More...
 
RWMesh_CoordinateSystemConverterChangeCoordinateSystemConverter ()
 Return transformation from OCCT to PLY coordinate system. More...
 
void SetCoordinateSystemConverter (const RWMesh_CoordinateSystemConverter &theConverter)
 Set transformation from OCCT to PLY coordinate system. More...
 
const XCAFPrs_StyleDefaultStyle () const
 Return default material definition to be used for nodes with only color defined. More...
 
void SetDefaultStyle (const XCAFPrs_Style &theStyle)
 Set default material definition to be used for nodes with only color defined. More...
 
bool IsDoublePrecision () const
 Return TRUE if vertex position should be stored with double floating point precision; FALSE by default. More...
 
void SetDoublePrecision (bool theDoublePrec)
 Set if vertex position should be stored with double floating point precision. More...
 
bool HasNormals () const
 Return TRUE if normals should be written; TRUE by default. More...
 
void SetNormals (const bool theHasNormals)
 Set if normals are defined. More...
 
bool HasTexCoords () const
 Return TRUE if UV / texture coordinates should be written; FALSE by default. More...
 
void SetTexCoords (const bool theHasTexCoords)
 Set if UV / texture coordinates should be written. More...
 
bool HasColors () const
 Return TRUE if point colors should be written; TRUE by default. More...
 
void SetColors (bool theToWrite)
 Set if point colors should be written. More...
 
bool HasPartId () const
 Return TRUE if part Id should be written as element attribute; TRUE by default. More...
 
void SetPartId (bool theSurfId)
 Set if part Id should be written as element attribute; FALSE by default. Cannot be combined with HasFaceId(). More...
 
bool HasFaceId () const
 Return TRUE if face Id should be written as element attribute; FALSE by default. More...
 
void SetFaceId (bool theSurfId)
 Set if face Id should be written as element attribute; FALSE by default. Cannot be combined with HasPartId(). More...
 
virtual bool Perform (const Handle< TDocStd_Document > &theDocument, const TDF_LabelSequence &theRootLabels, const TColStd_MapOfAsciiString *theLabelFilter, const TColStd_IndexedDataMapOfStringString &theFileInfo, const Message_ProgressRange &theProgress)
 Write PLY file and associated MTL material file. Triangulation data should be precomputed within shapes! More...
 
virtual bool Perform (const Handle< TDocStd_Document > &theDocument, const TColStd_IndexedDataMapOfStringString &theFileInfo, const Message_ProgressRange &theProgress)
 Write PLY file and associated MTL material file. Triangulation data should be precomputed within shapes! 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 toSkipFaceMesh (const RWMesh_FaceIterator &theFaceIter)
 Return TRUE if face mesh should be skipped (e.g. because it is invalid or empty). More...
 
virtual void addFaceInfo (const RWMesh_FaceIterator &theFace, Standard_Integer &theNbNodes, Standard_Integer &theNbElems)
 Collect face triangulation info. More...
 
virtual bool writeShape (RWPly_PlyWriterContext &theWriter, Message_LazyProgressScope &thePSentry, const Standard_Integer theWriteStep, const TDF_Label &theLabel, const TopLoc_Location &theParentTrsf, const XCAFPrs_Style &theParentStyle)
 Write the shape. More...
 
virtual bool writeNodes (RWPly_PlyWriterContext &theWriter, Message_LazyProgressScope &thePSentry, const RWMesh_FaceIterator &theFace)
 Write face triangle vertices and attributes. More...
 
virtual bool writeIndices (RWPly_PlyWriterContext &theWriter, Message_LazyProgressScope &thePSentry, const RWMesh_FaceIterator &theFace)
 Write face triangles indices. More...
 

Protected Attributes

TCollection_AsciiString myFile
 output PLY file More...
 
RWMesh_CoordinateSystemConverter myCSTrsf
 transformation from OCCT to PLY coordinate system More...
 
XCAFPrs_Style myDefaultStyle
 default material definition to be used for nodes with only color defined More...
 
Standard_Boolean myIsDoublePrec
 
Standard_Boolean myHasNormals
 
Standard_Boolean myHasColors
 
Standard_Boolean myHasTexCoords
 
Standard_Boolean myHasPartId
 
Standard_Boolean myHasFaceId
 

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

PLY writer context from XCAF document.

Constructor & Destructor Documentation

◆ RWPly_CafWriter()

RWPly_CafWriter::RWPly_CafWriter ( const TCollection_AsciiString theFile)

Main constructor.

Parameters
[in]theFilepath to output PLY file

◆ ~RWPly_CafWriter()

virtual RWPly_CafWriter::~RWPly_CafWriter ( )
virtual

Destructor.

Member Function Documentation

◆ addFaceInfo()

virtual void RWPly_CafWriter::addFaceInfo ( const RWMesh_FaceIterator theFace,
Standard_Integer theNbNodes,
Standard_Integer theNbElems 
)
protectedvirtual

Collect face triangulation info.

Parameters
[in]theFaceface to process
[in,out]theNbNodesoverall number of triangulation nodes (should be appended)
[in,out]theNbElemsoverall number of triangulation elements (should be appended)

◆ ChangeCoordinateSystemConverter()

RWMesh_CoordinateSystemConverter& RWPly_CafWriter::ChangeCoordinateSystemConverter ( )
inline

Return transformation from OCCT to PLY coordinate system.

◆ CoordinateSystemConverter()

const RWMesh_CoordinateSystemConverter& RWPly_CafWriter::CoordinateSystemConverter ( ) const
inline

Return transformation from OCCT to PLY coordinate system.

◆ DefaultStyle()

const XCAFPrs_Style& RWPly_CafWriter::DefaultStyle ( ) const
inline

Return default material definition to be used for nodes with only color defined.

◆ HasColors()

bool RWPly_CafWriter::HasColors ( ) const
inline

Return TRUE if point colors should be written; TRUE by default.

◆ HasFaceId()

bool RWPly_CafWriter::HasFaceId ( ) const
inline

Return TRUE if face Id should be written as element attribute; FALSE by default.

◆ HasNormals()

bool RWPly_CafWriter::HasNormals ( ) const
inline

Return TRUE if normals should be written; TRUE by default.

◆ HasPartId()

bool RWPly_CafWriter::HasPartId ( ) const
inline

Return TRUE if part Id should be written as element attribute; TRUE by default.

◆ HasTexCoords()

bool RWPly_CafWriter::HasTexCoords ( ) const
inline

Return TRUE if UV / texture coordinates should be written; FALSE by default.

◆ IsDoublePrecision()

bool RWPly_CafWriter::IsDoublePrecision ( ) const
inline

Return TRUE if vertex position should be stored with double floating point precision; FALSE by default.

◆ Perform() [1/2]

virtual bool RWPly_CafWriter::Perform ( const Handle< TDocStd_Document > &  theDocument,
const TColStd_IndexedDataMapOfStringString theFileInfo,
const Message_ProgressRange theProgress 
)
virtual

Write PLY file and associated MTL material file. Triangulation data should be precomputed within shapes!

Parameters
[in]theDocumentinput document
[in]theFileInfomap with file metadata to put into PLY header section
[in]theProgressoptional progress indicator
Returns
FALSE on file writing failure

◆ Perform() [2/2]

virtual bool RWPly_CafWriter::Perform ( const Handle< TDocStd_Document > &  theDocument,
const TDF_LabelSequence theRootLabels,
const TColStd_MapOfAsciiString theLabelFilter,
const TColStd_IndexedDataMapOfStringString theFileInfo,
const Message_ProgressRange theProgress 
)
virtual

Write PLY file and associated MTL material file. Triangulation data should be precomputed within shapes!

Parameters
[in]theDocumentinput document
[in]theRootLabelslist of root shapes to export
[in]theLabelFilteroptional filter with document nodes to export, with keys defined by XCAFPrs_DocumentExplorer::DefineChildId() and filled recursively (leaves and parent assembly nodes at all levels); when not NULL, all nodes not included into the map will be ignored
[in]theFileInfomap with file metadata to put into PLY header section
[in]theProgressoptional progress indicator
Returns
FALSE on file writing failure

◆ SetColors()

void RWPly_CafWriter::SetColors ( bool  theToWrite)
inline

Set if point colors should be written.

◆ SetCoordinateSystemConverter()

void RWPly_CafWriter::SetCoordinateSystemConverter ( const RWMesh_CoordinateSystemConverter theConverter)
inline

Set transformation from OCCT to PLY coordinate system.

◆ SetDefaultStyle()

void RWPly_CafWriter::SetDefaultStyle ( const XCAFPrs_Style theStyle)
inline

Set default material definition to be used for nodes with only color defined.

◆ SetDoublePrecision()

void RWPly_CafWriter::SetDoublePrecision ( bool  theDoublePrec)
inline

Set if vertex position should be stored with double floating point precision.

◆ SetFaceId()

void RWPly_CafWriter::SetFaceId ( bool  theSurfId)
inline

Set if face Id should be written as element attribute; FALSE by default. Cannot be combined with HasPartId().

◆ SetNormals()

void RWPly_CafWriter::SetNormals ( const bool  theHasNormals)
inline

Set if normals are defined.

◆ SetPartId()

void RWPly_CafWriter::SetPartId ( bool  theSurfId)
inline

Set if part Id should be written as element attribute; FALSE by default. Cannot be combined with HasFaceId().

◆ SetTexCoords()

void RWPly_CafWriter::SetTexCoords ( const bool  theHasTexCoords)
inline

Set if UV / texture coordinates should be written.

◆ toSkipFaceMesh()

virtual Standard_Boolean RWPly_CafWriter::toSkipFaceMesh ( const RWMesh_FaceIterator theFaceIter)
protectedvirtual

Return TRUE if face mesh should be skipped (e.g. because it is invalid or empty).

◆ writeIndices()

virtual bool RWPly_CafWriter::writeIndices ( RWPly_PlyWriterContext theWriter,
Message_LazyProgressScope thePSentry,
const RWMesh_FaceIterator theFace 
)
protectedvirtual

Write face triangles indices.

Parameters
[in]theWriterPLY writer context
[in]thePSentryprogress sentry
[in]theFacecurrent face
Returns
FALSE on writing file error

◆ writeNodes()

virtual bool RWPly_CafWriter::writeNodes ( RWPly_PlyWriterContext theWriter,
Message_LazyProgressScope thePSentry,
const RWMesh_FaceIterator theFace 
)
protectedvirtual

Write face triangle vertices and attributes.

Parameters
[in]theWriterPLY writer context
[in]thePSentryprogress sentry
[in]theFacecurrent face
Returns
FALSE on writing file error

◆ writeShape()

virtual bool RWPly_CafWriter::writeShape ( RWPly_PlyWriterContext theWriter,
Message_LazyProgressScope thePSentry,
const Standard_Integer  theWriteStep,
const TDF_Label theLabel,
const TopLoc_Location theParentTrsf,
const XCAFPrs_Style theParentStyle 
)
protectedvirtual

Write the shape.

Parameters
[in]theWriterPLY writer context
[in]thePSentryprogress sentry
[in]theWriteStepexport step, 0 for vertex attributes, 1 for elements
[in]theLabeldocument label to process
[in]theParentTrsfparent node transformation
[in]theParentStyleparent node style

Field Documentation

◆ myCSTrsf

RWMesh_CoordinateSystemConverter RWPly_CafWriter::myCSTrsf
protected

transformation from OCCT to PLY coordinate system

◆ myDefaultStyle

XCAFPrs_Style RWPly_CafWriter::myDefaultStyle
protected

default material definition to be used for nodes with only color defined

◆ myFile

TCollection_AsciiString RWPly_CafWriter::myFile
protected

output PLY file

◆ myHasColors

Standard_Boolean RWPly_CafWriter::myHasColors
protected

◆ myHasFaceId

Standard_Boolean RWPly_CafWriter::myHasFaceId
protected

◆ myHasNormals

Standard_Boolean RWPly_CafWriter::myHasNormals
protected

◆ myHasPartId

Standard_Boolean RWPly_CafWriter::myHasPartId
protected

◆ myHasTexCoords

Standard_Boolean RWPly_CafWriter::myHasTexCoords
protected

◆ myIsDoublePrec

Standard_Boolean RWPly_CafWriter::myIsDoublePrec
protected

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