00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef QV3DMODEL_H
00022 #define QV3DMODEL_H
00023
00024 #ifndef DOXYGEN_IGNORE_THIS
00025 #include <QGLWidget>
00026
00027 #include <qvcore/qvimage.h>
00028
00030 class QV3DModelSegment
00031 {
00032 friend class QV3DModel;
00033
00034 public:
00035 QV3DModelSegment( const double x0, const double y0, const double z0,
00036 const double x1, const double y1, const double z1,
00037 const double r, const double g, const double b)
00038 {
00039 this->x0 = x0; this->y0 = y0; this->z0 = z0;
00040 this->x1 = x1; this->y1 = y1; this->z1 = z1;
00041 this->r = r; this->g = g; this->b = b;
00042 }
00043 private:
00044 double x0, y0, z0, x1, y1, z1, r, g, b;
00045 };
00046
00047 class QV3DModelText
00048 {
00049 friend class QV3DModel;
00050
00051 public:
00052 QV3DModelText(const double x, const double y, const double z, const QString &text, const double r, const double g, const double b)
00053 {
00054 this->x = x; this->y = y; this->z = z;
00055 this->r = r; this->g = g; this->b = b;
00056 this->text = text;
00057 }
00058 private:
00059 double x, y, z;
00060 double r, g, b;
00061 QString text;
00062 };
00063
00064 class QVGLCanvas;
00065 class QV3DModel
00066 {
00067 private:
00068 QList<QV3DModelSegment> segmentList;
00069 QList<QV3DModelText> textList;
00070 QList< QVImage<uChar> > imgList;
00071
00072 public:
00073 QV3DModel() {}
00074
00075 void addSegment( const double x0, const double y0, const double z0,
00076 const double x1, const double y1, const double z1,
00077 const double r, const double g, const double b)
00078 { segmentList.append(QV3DModelSegment(x0, y0, z0, x1, y1, z1, r, g, b)); }
00079
00080 void addText(const int x, const int y, const int z, const QString &text, const double r, const double g, const double b)
00081 { textList.append(QV3DModelText(x,y,z,text, r,g,b)); }
00082
00083 void addImage(QVImage<uChar,1> image) { imgList.append(image); }
00084
00085 virtual void paint(QVGLCanvas &glWidget) const;
00086
00087 static QV3DModel image(QVImage<uChar> &);
00088 static QV3DModel crossHair(const double size);
00089 static QV3DModel cube(const double size);
00090 static QV3DModel cuboid(const double sizex, const double sizey, const double sizez);
00091 static QV3DModel referenceCoordinates(const double size, const bool labelAxis = false);
00092 static QV3DModel grid(const double stepX, const double stepY, const int cellsX, const int cellsY);
00093 };
00094
00095 Q_DECLARE_METATYPE(QV3DModel);
00096
00097 #endif
00098
00099 #endif
00100
00101