GLC_lib  2.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
glc_factory.h
Go to the documentation of this file.
1 /****************************************************************************
2 
3  This file is part of the GLC-lib library.
4  Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
5  Copyright (C) 2011 Jrme Forrissier
6  http://glc-lib.sourceforge.net
7 
8  GLC-lib is free software; you can redistribute it and/or modify
9  it under the terms of the GNU Lesser General Public License as published by
10  the Free Software Foundation; either version 3 of the License, or
11  (at your option) any later version.
12 
13  GLC-lib is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public License
19  along with GLC-lib; if not, write to the Free Software
20  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 
22 *****************************************************************************/
23 
25 
26 #ifndef GLC_FACTORY_
27 #define GLC_FACTORY_
28 
29 #include <QObject>
30 #include <QtOpenGL>
31 #include <QString>
32 #include <QSet>
33 
34 //class to built
35 #include "geometry/glc_point.h"
37 #include "geometry/glc_line.h"
38 #include "geometry/glc_circle.h"
39 #include "geometry/glc_box.h"
40 #include "geometry/glc_cylinder.h"
41 #include "geometry/glc_cone.h"
42 #include "geometry/glc_sphere.h"
43 #include "geometry/glc_rectangle.h"
44 #include "geometry/glc_3drep.h"
46 #include "shading/glc_material.h"
47 #include "shading/glc_texture.h"
48 #include "sceneGraph/glc_world.h"
50 #include "glc_boundingbox.h"
52 #include "viewport/glc_viewport.h"
53 #include "io/glc_fileloader.h"
54 
55 // end of class to built
56 
59 
60 #include "glc_config.h"
63 
66 
67 class GLC_LIB_EXPORT GLC_Factory : public QObject
68 {
69  Q_OBJECT
70 
71 public:
73  static GLC_Factory* instance();
74 
75 protected:
77  GLC_Factory();
78 public:
80  ~GLC_Factory();
81 
83 
85 
86 public:
87 
89  GLC_3DRep createPoint(const GLC_Point3d &coord) const;
90 
91  GLC_3DRep createPoint(double x, double y, double z) const;
92 
94  GLC_3DRep createPointCloud(const GLfloatVector& data, const QColor& color);
95 
96  GLC_3DRep createPointCloud(const QList<GLC_Point3d>& pointList, const QColor& color);
97 
98  GLC_3DRep createPointCloud(const QList<GLC_Point3df>& pointList, const QColor& color);
99 
101  GLC_3DRep createPointSprite(float, GLC_Material*) const;
102 
104  GLC_3DRep createLine(const GLC_Point3d&, const GLC_Point3d&) const;
105 
107  GLC_3DRep createCircle(double radius, double angle= 2 * glc::PI) const;
108 
110  GLC_3DRep createBox(double lx, double ly, double lz) const;
111 
112  GLC_3DViewInstance createBox(const GLC_BoundingBox& boundingBox) const;
113 
115  GLC_3DRep createCylinder(double radius, double length) const;
116 
118  GLC_3DRep createCone(double radius, double length) const;
119 
121  GLC_3DRep createSphere(double radius) const;
122 
124  GLC_3DRep createRectangle(double, double);
125 
127  GLC_3DViewInstance createRectangle(const GLC_Point3d& point, const GLC_Vector3d& normal, double l1, double l2);
128 
130  GLC_3DViewInstance createCuttingPlane(const GLC_Point3d& point, const GLC_Vector3d& normal, double l1, double l2, GLC_Material* pMat);
131 
133  GLC_World createWorldFromFile(QFile &file, QStringList* pAttachedFileName= NULL) const;
134 
136  GLC_World createWorldStructureFrom3dxml(QFile &file, bool GetExtRefName= false) const;
137 
139  GLC_3DRep create3DRepFromFile(const QString&) const;
140 
142  GLC_FileLoader* createFileLoader() const;
143 
145  GLC_Material* createMaterial() const;
146 
148  GLC_Material* createMaterial(const GLfloat *pAmbiantColor) const;
149 
151  GLC_Material* createMaterial(const QColor &color) const;
152 
154  GLC_Material* createMaterial(GLC_Texture* pTexture) const;
155 
157  GLC_Material* createMaterial(const QString &textureFullFileName) const;
158 
160  GLC_Material* createMaterial(const QImage &) const;
161 
163  GLC_Texture* createTexture(const QString &textureFullFileName) const;
164 
166  GLC_Texture* createTexture(const QImage &, const QString& imageFileName= QString()) const;
167 
169  GLC_MoverController createDefaultMoverController(const QColor&, GLC_Viewport*);
170 
172  static QList<GLC_WorldReaderPlugin*> worldReaderPlugins();
173 
175  static bool canBeLoaded(const QString& extension);
176 
178  static GLC_WorldReaderHandler* loadingHandler(const QString& fileName);
179 
181 
182 signals:
184  void currentQuantum(int) const;
185 
187 // Private services functions
189 private:
191  void loadPlugins();
192 
194 // Private members
196 
197 private:
200 
202  static QList<GLC_WorldReaderPlugin*> m_WorldReaderPluginList;
203 
205  static QSet<QString> m_SupportedExtensionSet;
206 
207 };
208 
209 #endif /*GLC_FACTORY_*/

©2005-2013 Laurent Ribon