forked from SpineML/SpineCreator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SC_network_3d_visualiser_panel.h
164 lines (148 loc) · 5.34 KB
/
SC_network_3d_visualiser_panel.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
/***************************************************************************
** **
** This file is part of SpineCreator, an easy to use GUI for **
** describing spiking neural network models. **
** Copyright (C) 2013-2014 Alex Cope, Paul Richmond, Seb James **
** **
** This program is free software: you can redistribute it and/or modify **
** it under the terms of the GNU General Public License as published by **
** the Free Software Foundation, either version 3 of the License, or **
** (at your option) any later version. **
** **
** This program is distributed in the hope that it will be useful, **
** but WITHOUT ANY WARRANTY; without even the implied warranty of **
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the **
** GNU General Public License for more details. **
** **
** You should have received a copy of the GNU General Public License **
** along with this program. If not, see http://www.gnu.org/licenses/. **
** **
****************************************************************************
** Author: Alex Cope **
** Website/Contact: http://bimpa.group.shef.ac.uk/ **
****************************************************************************/
#ifndef GLCONNECTIONWIDGET_H
#define GLCONNECTIONWIDGET_H
#include "globalHeader.h"
#include "SC_logged_data.h"
class RNG
{
public:
RNG() {a_RNG = 1103515245; c_RNG = 12345;}
void setSeed(int seedIn) {seed = seedIn;}
float value() {
seed = abs(seed*a_RNG+c_RNG);
float seed2 = seed/2147483648.0;
return seed2;
}
private:
int seed;
int a_RNG;
int c_RNG;
};
struct popLocs {
QVector < loc > locations;
QString name;
float x;
float y;
float z;
};
struct loc3f {
float x;
float y;
float z;
};
class glConnectionWidget : public QGLWidget
{
Q_OBJECT
public:
explicit glConnectionWidget(nl_rootdata * data, QWidget *parent = 0);
QVector <QSharedPointer <population> > selectedPops;
QVector < popLocs> pops;
QVector <QSharedPointer<systemObject> > selectedConns;
QVector < QVector < loc > > locations; // temp readded
QVector < QColor > cols;
QVector < QVector < conn > > connections;
void setConnectionsModel(QAbstractTableModel *);
QAbstractTableModel * getConnectionsModel();
void getConnections();
void setConnType(connectionType cType);
float prob;
int seed;
bool popIndicesShown;
void clear();
QPixmap renderImage(int, int);
void addLogs(QVector<logData *> *logs);
void refreshAll();
private:
void drawNeuron(GLfloat, int, int, QColor);
void setupView();
QString currentObjectName;
QAbstractTableModel * model;
QAbstractItemModel * sysModel;
QModelIndexList selection;
float zoomFactor;
QPointF pos;
QPointF rot;
QPointF origPos;
QPointF origRot;
Qt::MouseButton button;
connectionType currProjectionType;
RNG random;
nl_rootdata * data;
loc3f loc3Offset;
QSharedPointer<systemObject> selectedObject;
int selectedIndex;
int selectedType;
QString last_distance_based_equation;
QMutex * connGenerationMutex;
bool imageSaveMode;
int imageSaveWidth;
int imageSaveHeight;
QVector < QVector < QColor > > popColours;
QVector < logData * > popLogs;
int currentLogTime;
int newLogTime;
QTimer timer;
bool orthoView;
bool repaintAllowed;
#if QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
QImage renderQImage(int w, int h);
#endif
signals:
void currElement(int type, int index);
//void reDraw(QPainter*, float, float, float, int, int);
void getNeuronLocationsSrc(QVector < QVector <loc> > *, QVector < QColor > *, QString name = "");
void updatePanel(QString);
void setSelectionbyName(QString);
public slots:
void redraw();
void redraw(int);
void selectionChanged(QItemSelection top, QItemSelection);
void parsChangedPopulation(double);
void parsChangedPopulation(int);
void parsChangedPopulation();
void parsChangedProjection();
void parsChangedProjections();
void typeChanged(int);
void drawLocations(QVector <loc> locs);
void clearLocations();
void connectionDataChanged(QModelIndex, QModelIndex);
void connectionSelectionChanged(QItemSelection,QItemSelection);
void sysSelectionChanged(QModelIndex, QModelIndex);
void setPopIndicesShown(bool);
void selectedNrnChanged(int);
void updateLogDataTime(int index);
void updateLogData();
void toggleOrthoView(bool);
void allowRepaint();
protected:
void initializeGL();
void paintEvent(QPaintEvent *);
void resizeGL(int width, int height);
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *);
void mouseMoveEvent(QMouseEvent *event);
void wheelEvent(QWheelEvent *event);
};
#endif // GLCONNECTIONWIDGET_H