3DController.qo.h
Go to the documentation of this file.00001
00002 #ifndef GLWIDGET_H
00003 #define GLWIDGET_H
00004
00005 #include <graphics/X11/X_enter.h>
00006 #include <QGLWidget>
00007 #include <QVector>
00008 #include <QAction>
00009 #include <QMenu>
00010 #include <graphics/X11/X_exit.h>
00011
00012 #include <display3d/3DViewer/3DDisplayData.qo.h>
00013 #include <display/Display/Colormap.h>
00014 #include <display3d/3DViewer/3DPoint.h>
00015
00016 namespace casa {
00017
00018 class GLWidget : public QGLWidget
00019 {
00020 Q_OBJECT
00021
00022 public:
00023 GLWidget(QWidget *parent = 0);
00024 ~GLWidget();
00025
00026 QSize minimumSizeHint() const;
00027 QSize sizeHint() const;
00028
00029 void setDD(char*, int& pol);
00030 void getCubeSize(Int&, Int&, Int&);
00031 void getMinMax(Float&, Float&);
00032 Float getBound();
00033
00034 public slots:
00035 void setXRotation(int angle);
00036 void setYRotation(int angle);
00037 void setZRotation(int angle);
00038
00039 void setZNear(int angle);
00040 void setZDepth(int angle);
00041 void setTrans(int angle);
00042
00043 void setColormap(const QString&);
00044
00045 void updatePosition();
00046
00047 void setFrame(bool);
00048 void setFog(int);
00049 void setLight(int);
00050
00051 void setNumColors(int);
00052 void setPol(const QString&, int);
00053
00054 void setBG(const QString&);
00055 void setZoom(int);
00056
00057 void showHelp();
00058
00059 signals:
00060 void xRotationChanged(int angle);
00061 void yRotationChanged(int angle);
00062 void zRotationChanged(int angle);
00063
00064 void zNearChanged(int angle);
00065 void zDepthChanged(int angle);
00066 void transChanged(int angle);
00067
00068 void resetZNear(double, double, double);
00069 void resetZDepth(double, double, double);
00070
00071 void colorChanged(int, float, float, const QString&);
00072
00073 protected:
00074 void initializeGL();
00075 void paintGL();
00076 void resizeGL(int width, int height);
00077 void mousePressEvent(QMouseEvent *event);
00078 void mouseMoveEvent(QMouseEvent *event);
00079 void mouseDoubleClickEvent(QMouseEvent *event);
00080
00081 private:
00082
00083 DisplayData3* dd3;
00084 Cube<Float> data;
00085 QVector<DisplayPoint3> pList;
00086
00087
00088 Vector<Float> rMap;
00089 Vector<Float> gMap;
00090 Vector<Float> bMap;
00091 int numColors;
00092 QString cmapname;
00093
00094 void normalizeAngle(int *angle);
00095 void setColorTable(const QString& cmap = "");
00096
00097 GLuint makeObject(bool transChanged = true);
00098 GLuint makeObject2();
00099 GLuint object;
00100 GLuint box;
00101
00102 void calcLinearMaps(uInt numColors, Vector<Float>& r,
00103 Vector<Float>& g, Vector<Float>& b);
00104
00105 void getLinearColor(Float& r, Float& g, Float& b, Float v,
00106 Float min = 0., Float max = 1.);
00107 void getTableColor(Float& r, Float& g, Float& b, Float v,
00108 Float min = 0., Float max = 1.);
00109 GLfloat cx;
00110 GLfloat cy;
00111 GLfloat cz;
00112 GLfloat cd;
00113 int pol;
00114
00115 GLfloat thresh;
00116
00117 int near;
00118 int depth;
00119 int trans;
00120
00121 int xRot;
00122 int yRot;
00123 int zRot;
00124 QPoint lastPos;
00125
00126 bool frameOn;
00127 int zoom;
00128 QColor bg;
00129
00130 GLuint filter;
00131
00132 static const GLuint fogMode[3];
00133 static const GLfloat fogColor[4];
00134
00135 GLuint light;
00136
00137 QString tips;
00138
00139 QMenu* menu;
00140 QAction* helpAct;
00141 QAction* profileAct;
00142 QAction* momentAct;
00143
00144 };
00145
00146 }
00147 #endif