#include <refimagewidget.h>
Signals | |
void | setMousePoint (int mousePoint) |
set pointed image index | |
Public Member Functions | |
RefImgWidget (QWidget *parent=0) | |
The Constructor. | |
~RefImgWidget () | |
The deconstructor. | |
void | updateFile (FileReader *fd) |
update file read | |
void | setDrawAble (bool status) |
set drawable or not | |
void | setPointWidget (Point3dWidget *pw) |
set 3d point widget | |
Public Attributes | |
FileReader * | fileReader |
reference to file reader | |
Protected Member Functions | |
void | initializeGL () |
initialize GL | |
void | paintGL () |
paint GL | |
void | resizeGL (int width, int height) |
resize GL | |
void | mouseMoveEvent (QMouseEvent *event) |
mouse move event | |
void | keyPressEvent (QKeyEvent *e) |
keyboard press event |
Definition at line 50 of file refimagewidget.h.
|
The Constructor.
Definition at line 50 of file refimagewidget.cpp. 00051 : QGLWidget(parent) 00052 { 00053 drawAble = false; 00054 setMouseTracking(true); 00055 mainWindow = qobject_cast<QMainWindow *>(parentWidget()); 00056 mainWindow->setWindowTitle("Reference Image"); 00057 mainWindow->statusBar()->showMessage("Reference Image"); 00058 mainWindow->statusBar()->setFixedHeight(20); 00059 setFocusPolicy(Qt::StrongFocus); 00060 }
|
|
The deconstructor.
Definition at line 65 of file refimagewidget.cpp.
|
|
initialize GL
Definition at line 140 of file refimagewidget.cpp. 00141 { 00142 glClearColor (0.0, 0.0, 0.0, 0.0); 00143 glShadeModel(GL_FLAT); 00144 glPixelStorei(GL_UNPACK_ALIGNMENT, 1); 00145 }
|
|
keyboard press event
Definition at line 234 of file refimagewidget.cpp.
|
|
mouse move event
Definition at line 75 of file refimagewidget.cpp. 00076 { 00077 if( drawAble ){ 00078 int r = getColor(e->x(), e->y(), 0); 00079 int g = getColor(e->x(), e->y(), 1); 00080 int b = getColor(e->x(), e->y(), 2); 00081 00082 float x = getCoord(e->x(), e->y(), 0); 00083 float y = getCoord(e->x(), e->y(), 1); 00084 float z = getCoord(e->x(), e->y(), 2); 00085 00086 QString xSt, ySt, zSt; 00087 xSt.sprintf("%2.2f", x); 00088 ySt.sprintf("%2.2f", y); 00089 zSt.sprintf("%2.2f", z); 00090 00091 if( r != -1 && g != -1 && b != -1 && e->x() >=0 && e->y() >= 0) 00092 if( x == -10 || y == -10 || z == -10) 00093 mainWindow->statusBar()->showMessage(QString("2D(%1,%2)Color(%3,%4,%5)").arg(e->x()).arg(e->y()).arg(r).arg(g).arg(b)); 00094 else 00095 mainWindow->statusBar()->showMessage(QString("2D(%1,%2)Color(%3,%4,%5)3D(%6,%7,%8)").arg(e->x()).arg(e->y()).arg(r).arg(g).arg(b).arg(xSt).arg(ySt).arg(zSt)); 00096 } 00097 }
|
|
paint GL
Definition at line 152 of file refimagewidget.cpp. References fileReader, FileReader::getNCol(), FileReader::getNRow(), and FileReader::imagePixels. 00153 { 00154 makeCurrent(); 00155 glClear(GL_COLOR_BUFFER_BIT); 00156 if(drawAble){ 00157 int height = fileReader->getNRow(); 00158 int width = fileReader->getNCol(); 00159 if( windowHeight - height < 0 ){ 00160 glViewport(0, windowHeight - height , (GLsizei) windowHeight, (GLsizei) windowWidth); 00161 glRasterPos2i (0, 0); 00162 }else 00163 glRasterPos2i (0, windowHeight-height ); 00164 00165 // byte array for storing 2d image pixels 00166 GLubyte pixels[height][width][3]; 00167 00168 for(int i = 0; i < height; i ++) 00169 for(int j = 0; j < width; j ++) 00170 for( int k = 0; k < 3; k ++ ) 00171 pixels[i][j][k] = fileReader->imagePixels[height-i][j][k]; 00172 00173 glDrawPixels(width, height, GL_RGB, GL_UNSIGNED_BYTE, pixels); 00174 00175 } 00176 adjustSize(); 00177 glFlush (); 00178 }
|
|
resize GL
Definition at line 215 of file refimagewidget.cpp. 00216 { 00217 glViewport(0, 0, (GLsizei) w, (GLsizei) h); 00218 windowHeight = h; 00219 windowWidth = w; 00220 myHeight = (GLint) h; 00221 glMatrixMode(GL_PROJECTION); 00222 glLoadIdentity(); 00223 gluOrtho2D(0.0, (GLdouble) w, 0.0, (GLdouble) h); 00224 glMatrixMode(GL_MODELVIEW); 00225 glLoadIdentity(); 00226 }
|
|
set drawable or not
Definition at line 196 of file refimagewidget.cpp. Referenced by updateFile().
|
|
set pointed image index
Referenced by setPointWidget(). |
|
set 3d point widget
Definition at line 205 of file refimagewidget.cpp. References setMousePoint(). Referenced by MainWidget::MainWidget(). 00205 { 00206 point3dWidget = pw; 00207 connect(this, SIGNAL(setMousePoint(int)), point3dWidget, SLOT(setMousePoint(int))); 00208 }
|
|
update file read
Definition at line 185 of file refimagewidget.cpp. References fileReader, and setDrawAble(). Referenced by MainWidget::openFile(). 00185 { 00186 fileReader = fd; 00187 setDrawAble(true); 00188 updateGL(); 00189 }
|
|
reference to file reader
Definition at line 57 of file refimagewidget.h. Referenced by paintGL(), and updateFile(). |