point3dwidget.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 **
00003 ** Author:  Jaime Valls Miro <jaime.vallsmiro@eng.uts.edu.au>
00004 **          Hue Tuan Thi <huetuan.thi@uts.edu.au>, (C) 2006
00005 **
00006 ** This file is part of the S3D Viewer Project
00007 **
00008 ** This file may be used under the terms of the GNU General Public
00009 ** License version 2.0 as published by the Free Software Foundation
00010 ** and appearing in the file LICENSE.GPL included in the packaging of
00011 ** this file.  Please review the following information to ensure GNU
00012 ** General Public Licensing requirements will be met:
00013 ** http://www.trolltech.com/products/qt/opensource.html
00014 **
00015 ** If you are unsure which license is appropriate for your use, please
00016 ** review the following information:
00017 ** http://www.trolltech.com/products/qt/licensing.html or contact the
00018 ** sales department at sales@trolltech.com.
00019 **
00020 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00021 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00022 **
00023 ****************************************************************************/
00024 
00032 #ifndef POINT3DWIDGET_H
00033 #define POINT3DWIDGET_H
00034 
00035 #include <QGLWidget>
00036 #include <GL/glu.h>
00037 #include <QMainWindow>
00038 #include "filereader.h"
00039 
00040 class QDragEnterEvent;
00041 class QDropEvent;
00042 
00046 const float SIZE = 1.0f; 
00047 const int INIT_X = 0;    
00048 const int INIT_Y = 0;    
00049 const int INIT_Z = 0;    
00050 
00051 const float BR = 0.7;    
00052 const float BG = 0.7;    
00053 const float BB = 0.7;    
00054 
00055 const float POINT_SIZE = 1.0; 
00056 
00060 class Point3dWidget : public QGLWidget
00061 {
00062     Q_OBJECT
00063 
00064 public:
00065     Point3dWidget(QWidget *parent = 0);    
00066     ~Point3dWidget();                      
00067 
00068     int xRotation() const { return xRot; } 
00069     int yRotation() const { return yRot; } 
00070     int zRotation() const { return zRot; } 
00071     void updateFile( FileReader *fd);      
00072     void setDrawAble(bool status);         
00073 
00074     QColor bColor;                         
00075     QColor pointColor;                     
00076 
00077     void initCamera();                     
00078     bool cameraEnable;                     
00079     bool bounding;                         
00080     bool movingClear;                      
00081     bool pointDrawn;                       
00082     int cubeWidth;                         
00083     bool cubeDrawn;                        
00084     bool initColor;                        
00085 
00086 public slots:
00087     void setXRotation(int angle);          
00088     void setYRotation(int angle);          
00089     void setZRotation(int angle);          
00090     void setMousePoint(int mp);            
00091 
00092 signals:
00093     void xRotationChanged(int angle);      
00094     void yRotationChanged(int angle);      
00095     void zRotationChanged(int angle);      
00096     void cubeWidthChanged(int cw);         
00097 
00098 protected:
00099     void initializeGL();                            
00100     void paintGL();                                 
00101     void resizeGL(int width, int height);           
00102     void mousePressEvent(QMouseEvent *event);       
00103     void mouseReleaseEvent(QMouseEvent *event);     
00104     void mouseMoveEvent(QMouseEvent *event);        
00105     void wheelEvent( QWheelEvent *we);              
00106     void mouseDoubleClickEvent(QMouseEvent *event); 
00107     void keyPressEvent(QKeyEvent *event);           
00108 
00109     void dragEnterEvent(QDragEnterEvent *event);
00110     void dropEvent(QDropEvent *event);
00111 private:
00112     void normalizeAngle(int *angle);                
00113     float findMin(int k);                           
00114     float findMax(int i);                           
00115     double getColor(int col, int row, int i);       
00116 
00117     float minX, maxX, minY, maxY, minZ, maxZ;       
00118     float avgX, avgY, avgZ;                         
00119     float depth;                                    
00120     int mousePoint;                                 
00121     int xRot;                                       
00122     int yRot;                                       
00123     int zRot;                                       
00124     bool drawAble;                                  
00125     bool movingMouse;                               
00126 
00127     QPoint lastPos;                                 
00128     FileReader *fileReader;                         
00129     QMainWindow *mainWindow;                        
00130 
00131 };
00132 
00133 #endif

Generated on Mon Aug 14 10:44:20 2006 for S3DViewer by  doxygen 1.4.4