00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
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