SpikeStream Application Library
0.2
|
00001 #ifndef NETWORKVIEWER_H 00002 #define NETWORKVIEWER_H 00003 00004 //SpikeStream includes 00005 #include "Box.h" 00006 00007 //Qt includes 00008 #include <qgl.h> 00009 #include <QHash> 00010 00011 namespace spikestream { 00012 00014 class NetworkViewer : public QGLWidget { 00015 Q_OBJECT 00016 00017 public: 00018 NetworkViewer(QWidget* parent); 00019 ~NetworkViewer(); 00020 00021 00022 public slots: 00023 void refresh(); 00024 void reset(); 00025 00026 00027 protected: 00028 //Methods inherited from QGLWidget 00029 void initializeGL(); 00030 void paintGL(); 00031 void resizeGL(int width, int height); 00032 00033 //Methods inherited from QWidget 00034 void mouseDoubleClickEvent (QMouseEvent * event ); 00035 00036 00037 private slots: 00038 void moveBackward(); 00039 void moveForward(); 00040 void moveUp(); 00041 void moveDown(); 00042 void moveLeft(); 00043 void moveRight(); 00044 void refreshConnections(); 00045 void refreshNeurons(); 00046 void resetView(); 00047 void rotateUp(); 00048 void rotateDown(); 00049 void rotateLeft(); 00050 void rotateRight(); 00051 void viewClippingVolume_Horizontal(Box& clipVolume); 00052 void viewClippingVolume_Vertical(Box& clipVolume); 00053 00054 00055 private: 00056 //======================= VARIABLES ======================== 00058 GLuint axesDisplayList; 00059 00061 bool useAxesDisplayList; 00062 00064 GLuint neuronsDisplayList; 00065 00067 GLuint useNeuronsDisplayList; 00068 00070 GLuint connectionsDisplayList; 00071 00073 GLuint useConnectionsDisplayList; 00074 00076 GLuint sphereDisplayList; 00077 00079 bool cancelRender; 00080 00085 bool paintGLSkipped; 00086 00091 bool resizeGLSkipped; 00092 00094 GLfloat perspective_angle; 00095 00097 GLfloat perspective_near; 00098 00100 GLfloat perspective_far; 00101 00103 GLfloat sceneRotateX; 00104 00106 GLfloat sceneRotateZ; 00107 00109 GLfloat cameraMatrix [16]; 00110 00112 GLfloat rotationMatrix [16]; 00113 00115 Box defaultClippingVol; 00116 00119 int newTempScreenWidth; 00120 00123 int newTempScreenHeight; 00124 00126 GLUquadricObj* gluSphereObj; 00127 00129 GLUquadricObj* gluConeObj; 00130 00132 float weightRadiusFactor; 00133 00135 float minimumConnectionRadius; 00136 00138 unsigned connectionQuality; 00139 00142 QHash<unsigned, float> connectedNeuronMap; 00143 00144 00145 //====================== METHODS =========================== 00146 void checkOpenGLErrors(); 00147 void disableFullRender(); 00148 void drawAxes(); 00149 void drawConnections(); 00150 void drawNeurons(); 00151 void drawSphere(float xPos, float yPos, float zPos); 00152 void drawWeightedConnection(float x1, float y1, float z1, float x2, float y2, float z2, float weight); 00153 void fillRotationMatrix(float angle, float x, float y, float z); 00154 unsigned int getSelectedNeuron(GLuint selectBuffer[], int hitCount, int bufferSize); 00155 void initialiseCameraParameters(); 00156 void initialiseFullRender(); 00157 void loadDefaultClippingVolume(); 00158 void positionCamera(); 00159 void rotateVector(GLfloat x, GLfloat y, GLfloat z, GLfloat result[]); 00160 void rotateXAxis(float angle); 00161 void rotateZAxis(float angle); 00162 void setZoomLevel(); 00163 void zoomDefaultView(); 00164 void zoomAboveNeuronGroup(unsigned int neuronGroupID); 00165 void zoomToNeuronGroup(unsigned int neuronGroupID); 00166 }; 00167 00168 } 00169 00170 #endif//NETWORKVIEWER_H