glc_worldto3dxml.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00025
00026 #ifndef GLC_WORLDTO3DXML_H_
00027 #define GLC_WORLDTO3DXML_H_
00028 #include <QObject>
00029 #include <QXmlStreamWriter>
00030
00031 #include "../sceneGraph/glc_world.h"
00032 #include "../glc_config.h"
00033 #include <QReadWriteLock>
00034
00035 class QuaZip;
00036 class QuaZipFile;
00037 class QFile;
00038 class GLC_Mesh;
00039
00042
00043
00044 class GLC_LIB_EXPORT GLC_WorldTo3dxml : public QObject
00045 {
00046 Q_OBJECT
00047
00048 public:
00049 enum ExportType
00050 {
00051 Compressed3dxml,
00052 Exploded3dxml
00053 };
00055
00057
00058 public:
00059 GLC_WorldTo3dxml(const GLC_World& world);
00060 virtual ~GLC_WorldTo3dxml();
00062
00064
00066
00067 public:
00069 bool exportToFile(const QString& filename, GLC_WorldTo3dxml::ExportType exportType, bool exportMaterial= true);
00070
00072 inline void setGeneratorName(const QString& generator)
00073 {m_Generator= generator;}
00074
00076 void setInterupt(QReadWriteLock* pReadWriteLock, bool* pInterupt);
00078
00080
00082
00083 private:
00084
00086 void writeHeader();
00087
00089 void writeReference3D(const GLC_StructReference* pRef);
00090
00092 void writeReferenceRep(const GLC_3DRep* p3DRep);
00093
00095 void writeInstance3D(const GLC_StructInstance* pInstance, unsigned int parentId);
00096
00098 void writeInstanceRep(const GLC_3DRep* p3DRep, unsigned int parentId);
00099
00101 void setStreamWriterToFile(const QString& fileName);
00102
00104 void addManifest();
00105
00107 void exportAssemblyStructure();
00108
00110 void exportAssemblyFromOccurence(const GLC_StructOccurence* pOccurence);
00111
00113 QString matrixString(const GLC_Matrix4x4& matrix);
00114
00116 void write3DRep(const GLC_3DRep* pRep, const QString& fileName);
00117
00119 QString representationFileName(const GLC_3DRep* pRep);
00120
00122 void writeGeometry(const GLC_Mesh* pMesh);
00123
00125 void writeGeometryFace(const GLC_Mesh* pMesh, int lod, GLC_uint materialId);
00126
00128 void writeSurfaceAttributes(const GLC_Material* pMaterial);
00129
00131 void writeEdges(const GLC_Mesh* pMesh);
00132
00134 void writeLineAttributes(const QColor& color);
00135
00137 void writeMaterial(const GLC_Material* pMaterial);
00138
00140 void writeMaterialAttributtes(const QString& name, const QString& type, const QString& value);
00141
00143 QString colorToString(const QColor& color);
00144
00146 void writeCatRepImageFile(const QList<GLC_Material*>& materialList);
00147
00149 void writeCATRepresentationImage(const GLC_Material* pMat, unsigned int id);
00150
00152 void writeAllMaterialRelatedFilesIn3dxml();
00153
00155 void writeImageFileIn3dxml(const QList<GLC_Material*>& materialList);
00156
00158 void writeCatMaterialRef(const QList<GLC_Material*>& materialList);
00159
00161 void writeMaterialToCatMaterialRef(const GLC_Material* pMat, unsigned int* id);
00162
00164 void addImageTextureTo3dxml(const QImage& image, const QString& fileName);
00165
00167 QString xmlFileName(const QString& fileName);
00168
00170 void writeExtensionAttributes(GLC_Attributes* pAttributes);
00171
00173 void writeOccurenceDefaultViewProperty(const GLC_StructOccurence* pOccurence);
00174
00176 bool continu();
00177
00179
00181
00183 signals:
00184 void currentQuantum(int);
00185
00187
00189 private:
00191 GLC_World m_World;
00192
00194 QString m_FileName;
00195
00197 QXmlStreamWriter* m_pOutStream;
00198
00200 QString m_Generator;
00201
00203 unsigned int m_CurrentId;
00204
00206 QuaZip* m_p3dxmlArchive;
00207
00209 QuaZipFile* m_pCurrentZipFile;
00210
00212 QFile* m_pCurrentFile;
00213
00215 QString m_AbsolutePath;
00216
00218 QHash<const GLC_StructReference*, unsigned int> m_ReferenceToIdHash;
00219
00221 QHash<const GLC_StructInstance*, unsigned int> m_InstanceToIdHash;
00222
00224 QHash<const GLC_3DRep*, unsigned int> m_ReferenceRepToIdHash;
00225
00227 QHash<const GLC_3DRep*, QString> m_ReferenceRepTo3dxmlFileName;
00228
00230 QSet<unsigned int> m_InstanceRep;
00231
00233 QHash<GLC_uint, QString> m_MaterialIdToMaterialName;
00234
00236 QHash<GLC_uint, unsigned int> m_MaterialIdToMaterialId;
00237
00239 QHash<GLC_uint, QString> m_MaterialIdToTexture3dxmlName;
00240
00242 QHash<GLC_uint, unsigned int> m_MaterialIdTo3dxmlImageId;
00243
00245 bool m_ExportMaterial;
00246
00248 QSet<QString> m_3dxmlFileSet;
00249
00251 unsigned int m_FileNameIncrement;
00252
00254 QList<const GLC_StructOccurence*> m_ListOfOverLoadedOccurence;
00255
00257 QReadWriteLock* m_pReadWriteLock;
00258
00260 bool* m_pIsInterupted;
00261
00262 };
00263
00264 #endif