GLC_WorldTo3dxml Class Reference

GLC_WorldTo3dxml : Export a GLC_World to a 3dxml file. More...

#include <glc_worldto3dxml.h>

List of all members.

Public Types

enum  ExportType { Compressed3dxml, Exploded3dxml, StructureOnly }

Signals

void currentQuantum (int)

Public Member Functions

Constructor / Destructor

 GLC_WorldTo3dxml (const GLC_World &world, bool threaded=true)
virtual ~GLC_WorldTo3dxml ()
Set Functions

bool exportTo3dxml (const QString &filename, GLC_WorldTo3dxml::ExportType exportType, bool exportMaterial=true)
 Save the world to the specified file name.
bool exportReferenceTo3DRep (const GLC_3DRep *p3DRep, const QString &fullFileName)
 Save the given 3DRep into the given path name.
void setGeneratorName (const QString &generator)
 Set the name of the 3dxml generator default is GLC_LIB.
void setInterupt (QReadWriteLock *pReadWriteLock, bool *pInterupt)
 set interrupt flag adress

Private Member Functions

Private services functions

void writeHeader ()
 Write 3DXML Header.
void writeReference3D (const GLC_StructReference *pRef)
 Write 3DXML reference 3D element.
void writeReferenceRep (const GLC_3DRep *p3DRep)
 Write 3DXML reference representation.
void writeInstance3D (const GLC_StructInstance *pInstance, unsigned int parentId)
 Write 3DXML instance 3D element.
void writeInstanceRep (const GLC_3DRep *p3DRep, unsigned int parentId)
 Write 3DXML instance 3D element.
void setStreamWriterToFile (const QString &fileName)
 Set the streamwriter to the specified file and return true if success.
void addManifest ()
 Add the manifest to 3DXML compressed file.
void exportAssemblyStructure ()
 Export the assembly structure from the list of reference.
void exportAssemblyFromOccurence (const GLC_StructOccurence *pOccurence)
 Export assembly from the given occurence.
QString matrixString (const GLC_Matrix4x4 &matrix)
 Return the 3DXML string of the given matrix.
void write3DRep (const GLC_3DRep *pRep, const QString &fileName)
 Write the given 3DRep to 3DXML 3DRep.
QString representationFileName (const GLC_3DRep *pRep)
 Return the file name of the given 3DRep.
void writeGeometry (const GLC_Mesh *pMesh)
 Write the given mesh to 3DXML 3DRep.
void writeGeometryFace (const GLC_Mesh *pMesh, int lod, GLC_uint materialId)
 Write the geometry face from the given lod and material.
void writeSurfaceAttributes (const GLC_Material *pMaterial)
 Write surface attributes.
void writeEdges (const GLC_Mesh *pMesh)
 Write edges.
void writeLineAttributes (const QColor &color)
 Write lines attributes.
void writeMaterial (const GLC_Material *pMaterial)
 Write Material.
void writeMaterialAttributtes (const QString &name, const QString &type, const QString &value)
 Write material attributes.
QString colorToString (const QColor &color)
 Return a QString of a color.
void writeCatRepImageFile (const QList< GLC_Material * > &materialList)
 Write the CATRepImage.3dxml file.
void writeCATRepresentationImage (const GLC_Material *pMat, unsigned int id)
 Write CATRepresentationImage of the given material and id.
void writeAllMaterialRelatedFilesIn3dxml ()
 Write all material related files in the 3dxml.
void writeImageFileIn3dxml (const QList< GLC_Material * > &materialList)
 Write image file in 3DXML archive or folder.
void writeCatMaterialRef (const QList< GLC_Material * > &materialList)
 Write de CATMaterialRef.
void writeMaterialToCatMaterialRef (const GLC_Material *pMat, unsigned int *id)
 Write a material in the CATMaterialRef.
void addImageTextureTo3dxml (const QImage &image, const QString &fileName)
 Add the given texture to 3DXML with the given name.
QString xmlFileName (QString fileName)
 Transform the given name to the 3DXML name (no double).
void writeExtensionAttributes (GLC_Attributes *pAttributes)
 Write extension attributes to 3DXML.
void writeOccurenceDefaultViewProperty (const GLC_StructOccurence *pOccurence)
 Write the default view property of the given occurence.
bool continu ()
 return true if export must continu
QString symplifyName (QString name)
 Return the simplified name of the given name.
QList< unsigned int > instancePath (const GLC_StructOccurence *pOccurence)
 Return the path of the given occurence.

Private Attributes

GLC_World m_World
 The world to export.
ExportType m_ExportType
 The export type.
QString m_FileName
 The file name in which the world is exported.
QXmlStreamWriter * m_pOutStream
 The Stream writer.
QString m_Generator
 QString the 3DXML Generator.
unsigned int m_CurrentId
 The current 3DXML id.
QuaZip * m_p3dxmlArchive
 The 3DXML Archive.
QuaZipFile * m_pCurrentZipFile
 The current quazp file.
QFile * m_pCurrentFile
 The current file.
QString m_AbsolutePath
 the 3dxml absolute path
QHash< const
GLC_StructReference
*, unsigned int > 
m_ReferenceToIdHash
 Map reference to 3dxml id.
QHash< const
GLC_StructInstance *, unsigned
int > 
m_InstanceToIdHash
 Map instance to 3dxml id.
QHash< const GLC_3DRep
*, unsigned int > 
m_ReferenceRepToIdHash
 Map reference rep to 3dxml id.
QHash< const GLC_3DRep *, QString > m_ReferenceRepTo3dxmlFileName
 Map Reference rep to 3dxml fileName.
QSet< unsigned int > m_InstanceRep
 InstanceRep SET.
QHash< GLC_uint, QString > m_MaterialIdToMaterialName
 Map between material id and 3DRep name.
QHash< GLC_uint, unsigned int > m_MaterialIdToMaterialId
 Map between material id and 3dxml image id.
QHash< GLC_uint, QString > m_MaterialIdToTexture3dxmlName
 Map between material id and 3DXML texture name.
QHash< GLC_uint, unsigned int > m_MaterialIdTo3dxmlImageId
 Map between material id and 3dxml image id.
bool m_ExportMaterial
 Flag to know if material must be exported.
QSet< QString > m_3dxmlFileSet
 Set of files in the 3dxml.
unsigned int m_FileNameIncrement
 file name increment
QList< const
GLC_StructOccurence * > 
m_ListOfOverLoadedOccurence
 List of structOccurence with overload properties.
QReadWriteLock * m_pReadWriteLock
 Mutex.
bool * m_pIsInterupted
 Flag to know if export must be interupted.
bool m_IsThreaded
 Flag to know if export is threaded (the default).

Detailed Description

GLC_WorldTo3dxml : Export a GLC_World to a 3dxml file.

Definition at line 42 of file glc_worldto3dxml.h.


Member Enumeration Documentation

Enumerator:
Compressed3dxml 
Exploded3dxml 
StructureOnly 

Definition at line 47 of file glc_worldto3dxml.h.


Constructor & Destructor Documentation

GLC_WorldTo3dxml::GLC_WorldTo3dxml ( const GLC_World world,
bool  threaded = true 
)
GLC_WorldTo3dxml::~GLC_WorldTo3dxml (  )  [virtual]

Definition at line 65 of file glc_worldto3dxml.cpp.

References m_p3dxmlArchive, m_pCurrentFile, and m_pCurrentZipFile.


Member Function Documentation

void GLC_WorldTo3dxml::addImageTextureTo3dxml ( const QImage &  image,
const QString &  fileName 
) [private]

Add the given texture to 3DXML with the given name.

Definition at line 1069 of file glc_worldto3dxml.cpp.

References m_AbsolutePath, m_p3dxmlArchive, m_pCurrentFile, m_pCurrentZipFile, and m_pOutStream.

Referenced by writeImageFileIn3dxml().

void GLC_WorldTo3dxml::addManifest (  )  [private]

Add the manifest to 3DXML compressed file.

Definition at line 296 of file glc_worldto3dxml.cpp.

References m_FileName, m_pOutStream, and setStreamWriterToFile().

Referenced by exportTo3dxml().

QString GLC_WorldTo3dxml::colorToString ( const QColor &  color  )  [private]

Return a QString of a color.

Definition at line 853 of file glc_worldto3dxml.cpp.

Referenced by writeMaterial().

bool GLC_WorldTo3dxml::continu (  )  [private]

return true if export must continu

Definition at line 1242 of file glc_worldto3dxml.cpp.

References m_pIsInterupted, and m_pReadWriteLock.

Referenced by exportTo3dxml().

void GLC_WorldTo3dxml::currentQuantum ( int   )  [signal]

Referenced by exportTo3dxml().

void GLC_WorldTo3dxml::exportAssemblyFromOccurence ( const GLC_StructOccurence pOccurence  )  [private]
void GLC_WorldTo3dxml::exportAssemblyStructure (  )  [private]
bool GLC_WorldTo3dxml::exportReferenceTo3DRep ( const GLC_3DRep p3DRep,
const QString &  fullFileName 
)

Save the given 3DRep into the given path name.

Definition at line 141 of file glc_worldto3dxml.cpp.

References m_3dxmlFileSet, m_AbsolutePath, m_ExportMaterial, m_FileNameIncrement, m_ListOfOverLoadedOccurence, and write3DRep().

bool GLC_WorldTo3dxml::exportTo3dxml ( const QString &  filename,
GLC_WorldTo3dxml::ExportType  exportType,
bool  exportMaterial = true 
)
QList< unsigned int > GLC_WorldTo3dxml::instancePath ( const GLC_StructOccurence pOccurence  )  [private]
QString GLC_WorldTo3dxml::matrixString ( const GLC_Matrix4x4 matrix  )  [private]

Return the 3DXML string of the given matrix.

Definition at line 417 of file glc_worldto3dxml.cpp.

References GLC_Matrix4x4::getData().

Referenced by writeInstance3D(), and writeOccurenceDefaultViewProperty().

QString GLC_WorldTo3dxml::representationFileName ( const GLC_3DRep pRep  )  [private]
void GLC_WorldTo3dxml::setGeneratorName ( const QString &  generator  )  [inline]

Set the name of the 3dxml generator default is GLC_LIB.

Definition at line 74 of file glc_worldto3dxml.h.

void GLC_WorldTo3dxml::setInterupt ( QReadWriteLock *  pReadWriteLock,
bool *  pInterupt 
)

set interrupt flag adress

Definition at line 155 of file glc_worldto3dxml.cpp.

References m_pIsInterupted, and m_pReadWriteLock.

void GLC_WorldTo3dxml::setStreamWriterToFile ( const QString &  fileName  )  [private]

Set the streamwriter to the specified file and return true if success.

Definition at line 251 of file glc_worldto3dxml.cpp.

References m_AbsolutePath, m_p3dxmlArchive, m_pCurrentFile, m_pCurrentZipFile, and m_pOutStream.

Referenced by addManifest(), exportAssemblyStructure(), write3DRep(), writeCatMaterialRef(), writeCatRepImageFile(), and writeMaterial().

QString GLC_WorldTo3dxml::symplifyName ( QString  name  )  [private]

Return the simplified name of the given name.

Definition at line 1255 of file glc_worldto3dxml.cpp.

Referenced by writeMaterial(), and xmlFileName().

void GLC_WorldTo3dxml::write3DRep ( const GLC_3DRep pRep,
const QString &  fileName 
) [private]

Write the given 3DRep to 3DXML 3DRep.

Definition at line 442 of file glc_worldto3dxml.cpp.

References GLC_3DRep::geomAt(), m_CurrentId, m_pOutStream, GLC_3DRep::numberOfBody(), setStreamWriterToFile(), and writeGeometry().

Referenced by exportReferenceTo3DRep(), and exportTo3dxml().

void GLC_WorldTo3dxml::writeAllMaterialRelatedFilesIn3dxml (  )  [private]
void GLC_WorldTo3dxml::writeCatMaterialRef ( const QList< GLC_Material * > &  materialList  )  [private]

Write de CATMaterialRef.

Definition at line 995 of file glc_worldto3dxml.cpp.

References m_pOutStream, setStreamWriterToFile(), writeHeader(), and writeMaterialToCatMaterialRef().

Referenced by writeAllMaterialRelatedFilesIn3dxml().

void GLC_WorldTo3dxml::writeCatRepImageFile ( const QList< GLC_Material * > &  materialList  )  [private]

Write the CATRepImage.3dxml file.

Definition at line 858 of file glc_worldto3dxml.cpp.

References m_pOutStream, setStreamWriterToFile(), writeCATRepresentationImage(), and writeHeader().

Referenced by writeAllMaterialRelatedFilesIn3dxml().

void GLC_WorldTo3dxml::writeCATRepresentationImage ( const GLC_Material pMat,
unsigned int  id 
) [private]
void GLC_WorldTo3dxml::writeEdges ( const GLC_Mesh pMesh  )  [private]
void GLC_WorldTo3dxml::writeExtensionAttributes ( GLC_Attributes pAttributes  )  [private]

Write extension attributes to 3DXML.

Definition at line 1136 of file glc_worldto3dxml.cpp.

References m_AbsolutePath, m_pOutStream, GLC_Attributes::names(), and GLC_Attributes::value().

Referenced by writeInstance3D(), and writeReference3D().

void GLC_WorldTo3dxml::writeGeometry ( const GLC_Mesh pMesh  )  [private]
void GLC_WorldTo3dxml::writeGeometryFace ( const GLC_Mesh pMesh,
int  lod,
GLC_uint  materialId 
) [private]
void GLC_WorldTo3dxml::writeHeader (  )  [private]

Write 3DXML Header.

Definition at line 161 of file glc_worldto3dxml.cpp.

References m_FileName, m_Generator, and m_pOutStream.

Referenced by exportAssemblyStructure(), writeCatMaterialRef(), and writeCatRepImageFile().

void GLC_WorldTo3dxml::writeImageFileIn3dxml ( const QList< GLC_Material * > &  materialList  )  [private]
void GLC_WorldTo3dxml::writeInstance3D ( const GLC_StructInstance pInstance,
unsigned int  parentId 
) [private]
void GLC_WorldTo3dxml::writeInstanceRep ( const GLC_3DRep p3DRep,
unsigned int  parentId 
) [private]

Write 3DXML instance 3D element.

Definition at line 237 of file glc_worldto3dxml.cpp.

References m_CurrentId, m_InstanceRep, m_pOutStream, m_ReferenceRepToIdHash, and GLC_Rep::name().

Referenced by exportAssemblyFromOccurence().

void GLC_WorldTo3dxml::writeLineAttributes ( const QColor &  color  )  [private]

Write lines attributes.

Definition at line 750 of file glc_worldto3dxml.cpp.

References m_pOutStream.

Referenced by writeEdges().

void GLC_WorldTo3dxml::writeMaterial ( const GLC_Material pMaterial  )  [private]
void GLC_WorldTo3dxml::writeMaterialAttributtes ( const QString &  name,
const QString &  type,
const QString &  value 
) [private]

Write material attributes.

Definition at line 844 of file glc_worldto3dxml.cpp.

References m_pOutStream.

Referenced by writeMaterial().

void GLC_WorldTo3dxml::writeMaterialToCatMaterialRef ( const GLC_Material pMat,
unsigned int *  id 
) [private]
void GLC_WorldTo3dxml::writeOccurenceDefaultViewProperty ( const GLC_StructOccurence pOccurence  )  [private]
void GLC_WorldTo3dxml::writeReference3D ( const GLC_StructReference pRef  )  [private]
void GLC_WorldTo3dxml::writeReferenceRep ( const GLC_3DRep p3DRep  )  [private]

Write 3DXML reference representation.

Definition at line 190 of file glc_worldto3dxml.cpp.

References m_CurrentId, m_pOutStream, m_ReferenceRepTo3dxmlFileName, m_ReferenceRepToIdHash, GLC_Rep::name(), and representationFileName().

Referenced by exportAssemblyFromOccurence().

void GLC_WorldTo3dxml::writeSurfaceAttributes ( const GLC_Material pMaterial  )  [private]

Write surface attributes.

Definition at line 692 of file glc_worldto3dxml.cpp.

References GLC_Material::diffuseColor(), GLC_Object::id(), m_ExportMaterial, m_MaterialIdToMaterialId, and m_pOutStream.

Referenced by writeGeometryFace().

QString GLC_WorldTo3dxml::xmlFileName ( QString  fileName  )  [private]

Transform the given name to the 3DXML name (no double).

Definition at line 1108 of file glc_worldto3dxml.cpp.

References m_3dxmlFileSet, m_FileNameIncrement, and symplifyName().

Referenced by representationFileName(), writeCATRepresentationImage(), and writeMaterial().


Member Data Documentation

QSet<QString> GLC_WorldTo3dxml::m_3dxmlFileSet [private]

Set of files in the 3dxml.

Definition at line 259 of file glc_worldto3dxml.h.

Referenced by exportReferenceTo3DRep(), exportTo3dxml(), and xmlFileName().

unsigned int GLC_WorldTo3dxml::m_CurrentId [private]

The current 3DXML id.

Definition at line 214 of file glc_worldto3dxml.h.

Referenced by write3DRep(), writeGeometry(), writeInstance3D(), writeInstanceRep(), writeReference3D(), and writeReferenceRep().

Flag to know if material must be exported.

Definition at line 256 of file glc_worldto3dxml.h.

Referenced by exportReferenceTo3DRep(), exportTo3dxml(), and writeSurfaceAttributes().

The export type.

Definition at line 202 of file glc_worldto3dxml.h.

Referenced by exportTo3dxml(), and representationFileName().

QString GLC_WorldTo3dxml::m_FileName [private]

The file name in which the world is exported.

Definition at line 205 of file glc_worldto3dxml.h.

Referenced by addManifest(), exportAssemblyStructure(), exportTo3dxml(), writeHeader(), and writeOccurenceDefaultViewProperty().

unsigned int GLC_WorldTo3dxml::m_FileNameIncrement [private]

file name increment

Definition at line 262 of file glc_worldto3dxml.h.

Referenced by exportReferenceTo3DRep(), exportTo3dxml(), and xmlFileName().

QString GLC_WorldTo3dxml::m_Generator [private]

QString the 3DXML Generator.

Definition at line 211 of file glc_worldto3dxml.h.

Referenced by writeHeader().

QSet<unsigned int> GLC_WorldTo3dxml::m_InstanceRep [private]

InstanceRep SET.

Definition at line 241 of file glc_worldto3dxml.h.

Referenced by exportAssemblyFromOccurence(), exportAssemblyStructure(), and writeInstanceRep().

QHash<const GLC_StructInstance*, unsigned int> GLC_WorldTo3dxml::m_InstanceToIdHash [private]

Map instance to 3dxml id.

Definition at line 232 of file glc_worldto3dxml.h.

Referenced by exportAssemblyFromOccurence(), exportAssemblyStructure(), instancePath(), and writeInstance3D().

Flag to know if export is threaded (the default).

Definition at line 274 of file glc_worldto3dxml.h.

Referenced by exportTo3dxml().

List of structOccurence with overload properties.

Definition at line 265 of file glc_worldto3dxml.h.

Referenced by exportAssemblyFromOccurence(), exportAssemblyStructure(), exportReferenceTo3DRep(), and exportTo3dxml().

Map between material id and 3dxml image id.

Definition at line 253 of file glc_worldto3dxml.h.

Referenced by writeAllMaterialRelatedFilesIn3dxml(), writeCATRepresentationImage(), writeMaterial(), and writeMaterialToCatMaterialRef().

QHash<GLC_uint, unsigned int> GLC_WorldTo3dxml::m_MaterialIdToMaterialId [private]

Map between material id and 3dxml image id.

Definition at line 247 of file glc_worldto3dxml.h.

Referenced by writeAllMaterialRelatedFilesIn3dxml(), writeMaterialToCatMaterialRef(), and writeSurfaceAttributes().

Map between material id and 3DRep name.

Definition at line 244 of file glc_worldto3dxml.h.

Referenced by writeAllMaterialRelatedFilesIn3dxml(), writeMaterial(), and writeMaterialToCatMaterialRef().

Map between material id and 3DXML texture name.

Definition at line 250 of file glc_worldto3dxml.h.

Referenced by writeAllMaterialRelatedFilesIn3dxml(), writeCATRepresentationImage(), and writeImageFileIn3dxml().

The 3DXML Archive.

Definition at line 217 of file glc_worldto3dxml.h.

Referenced by addImageTextureTo3dxml(), exportTo3dxml(), setStreamWriterToFile(), and ~GLC_WorldTo3dxml().

The current file.

Definition at line 223 of file glc_worldto3dxml.h.

Referenced by addImageTextureTo3dxml(), setStreamWriterToFile(), and ~GLC_WorldTo3dxml().

QuaZipFile* GLC_WorldTo3dxml::m_pCurrentZipFile [private]

The current quazp file.

Definition at line 220 of file glc_worldto3dxml.h.

Referenced by addImageTextureTo3dxml(), setStreamWriterToFile(), and ~GLC_WorldTo3dxml().

Flag to know if export must be interupted.

Definition at line 271 of file glc_worldto3dxml.h.

Referenced by continu(), and setInterupt().

QXmlStreamWriter* GLC_WorldTo3dxml::m_pOutStream [private]
QReadWriteLock* GLC_WorldTo3dxml::m_pReadWriteLock [private]

Mutex.

Definition at line 268 of file glc_worldto3dxml.h.

Referenced by continu(), and setInterupt().

Map Reference rep to 3dxml fileName.

Definition at line 238 of file glc_worldto3dxml.h.

Referenced by exportAssemblyStructure(), exportTo3dxml(), and writeReferenceRep().

QHash<const GLC_3DRep*, unsigned int> GLC_WorldTo3dxml::m_ReferenceRepToIdHash [private]
QHash<const GLC_StructReference*, unsigned int> GLC_WorldTo3dxml::m_ReferenceToIdHash [private]

Map reference to 3dxml id.

Definition at line 229 of file glc_worldto3dxml.h.

Referenced by exportAssemblyFromOccurence(), exportAssemblyStructure(), writeInstance3D(), and writeReference3D().


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

SourceForge.net Logo

©2005-2011 Laurent Ribon