TarzaNN
TarzaNN neural network simulator
C:/Users/albertlr/projects/TarzaNN/TarzaNN/GL3DViewer.h
Go to the documentation of this file.
00001 /****************************************************************************
00002  **
00003  ** Copyright C 2002-2012 Laboratory for Active and Attentive Vision (LAAV), Department of Computer Science and Engineering, York University, Toronto, ON, Canada.
00004  ** All rights reserved.
00005  **
00006  ** This file is part of the TarzaNN Neural Network Simulator.
00007  **
00008  ** This file may be distributed and/or modified under the terms of the
00009  ** GNU General Public License version 2 as published by the Free Software
00010  ** Foundation and appearing in the file LICENSE.GPL included in the
00011  ** packaging of this file.
00012  **
00013  ** See http://www.tarzann.org/gpl/ for GPL licensing information.
00014  **
00015  ** Contact info@tarzann.org if any conditions of this licensing are
00016  ** not clear to you.
00017  **
00018  ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00019  ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00020  **
00021  ****************************************************************************/
00022 
00023 #ifndef GL3DVIEWER_H
00024 #define GL3DVIEWER_H
00025 
00026 #include <QGLWidget>
00027 #include <QVariant>
00028 #include <QEvent>
00029 #include <QMouseEvent>
00030 #include <QKeyEvent>
00031 #include <QPaintEvent>
00032 #include "Network.h"
00033 #include "UI_Widget.h"
00034 
00035 class UI_3DViewer;
00036 
00037 #define SQUARE_SIZE 20
00038 
00039 typedef struct image_t{
00040     void *data;
00041     uint32_t height;
00042     uint32_t width;
00043     uint32_t size;
00044     bool changed;
00045 }image_t;
00046 
00048 class GL3DViewer : public QGLWidget, public Observer, UI_Widget{
00049         
00050 public:
00051     GL3DViewer( UI_3DViewer* parent, const char* name, Network* nn );
00052     ~GL3DViewer();
00053     QSize minimumSizeHint() const;
00054     QSize maximumSizeHint() const;
00055 
00056     QSize sizeHint() const;
00057         void updateNN(Observer* sourceFP, bool functional);
00058         virtual void paintEvent( QPaintEvent *e );
00059         bool flag;
00060         void keyPressEvent ( QKeyEvent * e );
00061                 
00062 protected:
00063         void initializeGL();
00064         void paintGL();
00065         void resizeGL( uint32_t w, uint32_t h );
00066         void mouseMoveEvent ( QMouseEvent * e );
00067         void mouseReleaseEvent ( QMouseEvent * event );
00068         
00069 private:
00070 
00071         void draw();
00072         void drawFP(float x, float y, float z, float dx, float dy);
00073         void drawSTMLines(FeaturePlaneAbstract *p, bool inputLayer);
00074         void drawStructureLines(FeaturePlaneAbstract *p);
00075         void drawImage(image_t i, int index, float x, float y, float z, float dx, float dy);
00076         void drawSTMImage(FeaturePlaneAbstract *p, Matrix *m, int index, float x, float y, float z, float dx, float dy);
00077         int zoom;
00078         GLfloat spinx;
00079         GLfloat spiny;
00080         int xo;
00081         int yo;
00082         GLuint texName;
00083         GLuint* textures;
00084         image_t* image;
00085         Network* NN;
00086         bool labels;
00087         bool redLines;
00088         bool greenLines;
00089         bool drawSTM;
00090         bool drawStructure;
00091 
00092         UI_3DViewer* ui3DViewer;
00093 
00094         void customEvent( QCustomEvent * e );
00095     
00096         QMutex localAccess;
00097 };
00098 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines