glc_factory.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 
00003  This file is part of the GLC-lib library.
00004  Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
00005  Copyright (C) 2011 Jrme Forrissier
00006  http://glc-lib.sourceforge.net
00007 
00008  GLC-lib is free software; you can redistribute it and/or modify
00009  it under the terms of the GNU Lesser General Public License as published by
00010  the Free Software Foundation; either version 3 of the License, or
00011  (at your option) any later version.
00012 
00013  GLC-lib is distributed in the hope that it will be useful,
00014  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  GNU Lesser General Public License for more details.
00017 
00018  You should have received a copy of the GNU Lesser General Public License
00019  along with GLC-lib; if not, write to the Free Software
00020  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00021 
00022 *****************************************************************************/
00023 
00025 
00026 #ifndef GLC_FACTORY_
00027 #define GLC_FACTORY_
00028 
00029 #include <QObject>
00030 #include <QtOpenGL>
00031 #include <QString>
00032 #include <QSet>
00033 
00034 //class to built
00035 #include "geometry/glc_point.h"
00036 #include "geometry/glc_pointsprite.h"
00037 #include "geometry/glc_line.h"
00038 #include "geometry/glc_circle.h"
00039 #include "geometry/glc_box.h"
00040 #include "geometry/glc_cylinder.h"
00041 #include "geometry/glc_cone.h"
00042 #include "geometry/glc_sphere.h"
00043 #include "geometry/glc_rectangle.h"
00044 #include "geometry/glc_3drep.h"
00045 #include "geometry/glc_pointcloud.h"
00046 #include "shading/glc_material.h"
00047 #include "shading/glc_texture.h"
00048 #include "sceneGraph/glc_world.h"
00049 #include "sceneGraph/glc_3dviewinstance.h"
00050 #include "glc_boundingbox.h"
00051 #include "viewport/glc_movercontroller.h"
00052 #include "viewport/glc_viewport.h"
00053 #include "io/glc_fileloader.h"
00054 
00055 // end of class to built
00056 
00057 class GLC_WorldReaderHandler;
00058 class GLC_WorldReaderPlugin;
00059 
00060 #include "glc_config.h"
00063 
00066 
00067 class GLC_LIB_EXPORT GLC_Factory : public QObject
00068 {
00069         Q_OBJECT
00070 
00071 public:
00073         static GLC_Factory* instance();
00074 
00075 protected:
00077         GLC_Factory();
00078 public:
00080         ~GLC_Factory();
00081 
00083 
00085 
00086 public:
00087 
00089         GLC_3DRep createPoint(const GLC_Point3d &coord) const;
00090 
00091         GLC_3DRep createPoint(double x, double y, double z) const;
00092 
00094         GLC_3DRep createPointCloud(const GLfloatVector& data, const QColor& color);
00095 
00096         GLC_3DRep createPointCloud(const QList<GLC_Point3d>& pointList, const QColor& color);
00097 
00098         GLC_3DRep createPointCloud(const QList<GLC_Point3df>& pointList, const QColor& color);
00099 
00101         GLC_3DRep createPointSprite(float, GLC_Material*) const;
00102 
00104         GLC_3DRep createLine(const GLC_Point3d&, const GLC_Point3d&) const;
00105 
00107         GLC_3DRep createCircle(double radius, double angle= 2 * glc::PI) const;
00108 
00110         GLC_3DRep createBox(double lx, double ly, double lz) const;
00111 
00112         GLC_3DViewInstance createBox(const GLC_BoundingBox& boundingBox) const;
00113 
00115         GLC_3DRep createCylinder(double radius, double length) const;
00116 
00118         GLC_3DRep createCone(double radius, double length) const;
00119 
00121         GLC_3DRep createSphere(double radius) const;
00122 
00124         GLC_3DRep createRectangle(double, double);
00125 
00127         GLC_3DViewInstance createRectangle(const GLC_Point3d& point, const GLC_Vector3d& normal, double l1, double l2);
00128 
00130         GLC_3DViewInstance createCuttingPlane(const GLC_Point3d& point, const GLC_Vector3d& normal, double l1, double l2, GLC_Material* pMat);
00131 
00133         GLC_World createWorldFromFile(QFile &file, QStringList* pAttachedFileName= NULL) const;
00134 
00136         GLC_World createWorldStructureFrom3dxml(QFile &file, bool GetExtRefName= false) const;
00137 
00139         GLC_3DRep create3DRepFromFile(const QString&) const;
00140 
00142         GLC_FileLoader* createFileLoader() const;
00143 
00145         GLC_Material* createMaterial() const;
00146 
00148         GLC_Material* createMaterial(const GLfloat *pAmbiantColor) const;
00149 
00151         GLC_Material* createMaterial(const QColor &color) const;
00152 
00154         GLC_Material* createMaterial(GLC_Texture* pTexture) const;
00155 
00157         GLC_Material* createMaterial(const QString &textureFullFileName) const;
00158 
00160         GLC_Material* createMaterial(const QImage &) const;
00161 
00163         GLC_Texture* createTexture(const QString &textureFullFileName) const;
00164 
00166         GLC_Texture* createTexture(const QImage &, const QString& imageFileName= QString()) const;
00167 
00169         GLC_MoverController createDefaultMoverController(const QColor&, GLC_Viewport*);
00170 
00172         static QList<GLC_WorldReaderPlugin*> worldReaderPlugins();
00173 
00175         static bool canBeLoaded(const QString& extension);
00176 
00178         static GLC_WorldReaderHandler* loadingHandler(const QString& fileName);
00179 
00181 
00182 signals:
00184         void currentQuantum(int) const;
00185 
00187 // Private services functions
00189 private:
00191         void loadPlugins();
00192 
00194 // Private members
00196 
00197 private:
00199         static GLC_Factory* m_pFactory;
00200 
00202         static QList<GLC_WorldReaderPlugin*> m_WorldReaderPluginList;
00203 
00205         static QSet<QString> m_SupportedExtensionSet;
00206 
00207 };
00208 
00209 #endif /*GLC_FACTORY_*/

SourceForge.net Logo

©2005-2011 Laurent Ribon