GOFIGURE2
0.9.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
Code
GUI
lib
QGoTrackViewDockWidget.cxx
Go to the documentation of this file.
1
/*=========================================================================
2
Authors: The GoFigure Dev. Team.
3
at Megason Lab, Systems biology, Harvard Medical school, 2009-11
4
5
Copyright (c) 2009-11, President and Fellows of Harvard College.
6
All rights reserved.
7
8
Redistribution and use in source and binary forms, with or without
9
modification, are permitted provided that the following conditions are met:
10
11
Redistributions of source code must retain the above copyright notice,
12
this list of conditions and the following disclaimer.
13
Redistributions in binary form must reproduce the above copyright notice,
14
this list of conditions and the following disclaimer in the documentation
15
and/or other materials provided with the distribution.
16
Neither the name of the President and Fellows of Harvard College
17
nor the names of its contributors may be used to endorse or promote
18
products derived from this software without specific prior written
19
permission.
20
21
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
25
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
26
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
27
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
28
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
30
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
33
=========================================================================*/
34
#include "
QGoTrackViewDockWidget.h
"
35
36
#include "
ctkDoubleRangeSlider.h
"
37
38
#include <iostream>
39
#include <QVBoxLayout>
40
#include <QGridLayout>
41
#include <QAction>
42
#include <QLabel>
43
44
//-------------------------------------------------------------------------
45
QGoTrackViewDockWidget::QGoTrackViewDockWidget
(
46
QWidget
*iParent) :
QGoDockWidget
(iParent)
47
{
48
this->
SetUpUi
();
49
QIcon
trackicon;
50
trackicon.
addPixmap
(
QPixmap
(
QString::fromUtf8
(
":/fig/TrackView.png"
) ),
51
QIcon::Normal, QIcon::Off);
52
this->
m_ToggleAction
->
setIcon
(trackicon);
53
this->
m_ToggleAction
->
setToolTip
(
"Track View"
);
54
this->
setWindowTitle
(
"Track View"
);
55
// appearance
56
QObject::connect
( this->
m_linewidthSpinBox
, SIGNAL( valueChanged(
double
)),
57
this
, SLOT(
lineWidthValueChanged
(
double
)) );
58
59
QObject::connect
( this->
m_glyph
, SIGNAL( toggled(
bool
) ),
60
this
, SLOT(
Glyphs
(
bool
) ) );
61
QObject::connect
( this->
m_glyphSpinBox
, SIGNAL( valueChanged(
double
) ),
62
this
, SLOT(
glyphValueChanged
(
double
) ) );
63
64
QObject::connect
( this->
m_tube
, SIGNAL( toggled(
bool
) ),
65
this
, SLOT(
Tubes
(
bool
) ) );
66
QObject::connect
( this->
m_tubeSpinBox
, SIGNAL( valueChanged(
double
) ),
67
this
, SLOT(
tubeValueChanged
(
double
) ) );
68
69
// color code
70
QObject::connect
( this->
m_time
, SIGNAL( toggled(
bool
) ),
71
this
, SLOT(
ColorCodeTracksByTime
(
bool
) ) );
72
QObject::connect
( this->
m_speed
, SIGNAL( toggled(
bool
) ),
73
this
, SLOT(
ColorCodeTracksBySpeed
(
bool
) ) );
74
QObject::connect
( this->
m_real
, SIGNAL( toggled(
bool
) ),
75
this
, SLOT(
ColorCodeTracksByOriginalColor
(
bool
) ) );
76
77
/*
78
// double slider
79
ctkDoubleRangeSlider *rangeSlider =
80
new ctkDoubleRangeSlider(Qt::Horizontal , this->dockWidgetContents);
81
gridLayout->addWidget(rangeSlider, 2, 0, 1, 1);
82
*/
83
}
84
85
//-------------------------------------------------------------------------
86
87
//-------------------------------------------------------------------------
88
QGoTrackViewDockWidget::
89
~QGoTrackViewDockWidget
()
90
{
91
}
92
93
//-------------------------------------------------------------------------
94
95
//-------------------------------------------------------------------------
96
void
97
QGoTrackViewDockWidget::lineWidthValueChanged
(
double
iValue)
98
{
99
if
( !this->
m_tube
->
isChecked
() )
100
{
101
emit
UpdateTracksRepresentation
( 0, 0, iValue );
102
}
103
}
104
//-------------------------------------------------------------------------
105
106
//-------------------------------------------------------------------------
107
void
108
QGoTrackViewDockWidget::glyphValueChanged
(
double
)
109
{
110
//to avoid useless update
111
if
( this->
m_glyph
->
isChecked
() )
112
{
113
Glyphs
(
true
);
114
}
115
}
116
117
//-------------------------------------------------------------------------
118
119
//-------------------------------------------------------------------------
120
void
121
QGoTrackViewDockWidget::Glyphs
(
bool
iActivated)
122
{
123
if
( iActivated )
124
{
125
emit
UpdateTracksRepresentation
( this->
m_glyphSpinBox
->
value
(),
126
this->
m_tubeSpinBox
->
value
() * this->
m_tube
->
isChecked
(),
127
this->
m_linewidthSpinBox
->
value
() );
128
}
129
else
130
{
131
emit
UpdateTracksRepresentation
( 0,
132
this->
m_tubeSpinBox
->
value
() * this->
m_tube
->
isChecked
(),
133
this->
m_linewidthSpinBox
->
value
() );
134
}
135
}
136
137
//-------------------------------------------------------------------------
138
139
//-------------------------------------------------------------------------
140
void
141
QGoTrackViewDockWidget::tubeValueChanged
(
double
)
142
{
143
//to avoid useless update
144
if
( this->
m_tube
->
isChecked
() )
145
{
146
Tubes
(
true
);
147
}
148
}
149
150
//-------------------------------------------------------------------------
151
152
//-------------------------------------------------------------------------
153
void
154
QGoTrackViewDockWidget::Tubes
(
bool
iActivated)
155
{
156
if
( iActivated )
157
{
158
emit
UpdateTracksRepresentation
( this->
m_glyphSpinBox
->
value
() * this->
m_glyph
->
isChecked
(),
159
this->
m_tubeSpinBox
->
value
(),
160
this->
m_linewidthSpinBox
->
value
() );
161
}
162
else
163
{
164
emit
UpdateTracksRepresentation
(this->
m_glyphSpinBox
->
value
() * this->
m_glyph
->
isChecked
(),
165
0,
166
this->
m_linewidthSpinBox
->
value
() );
167
}
168
}
169
170
//-------------------------------------------------------------------------
171
172
//-------------------------------------------------------------------------
173
void
174
QGoTrackViewDockWidget::ColorCodeTracksByTime
(
bool
iChecked)
175
{
176
if
( iChecked )
177
{
178
emit
ChangeColorCode
(
"TemporalInformation"
);
179
}
180
}
181
182
//-------------------------------------------------------------------------
183
184
//-------------------------------------------------------------------------
185
void
186
QGoTrackViewDockWidget::ColorCodeTracksBySpeed
(
bool
iChecked)
187
{
188
if
( iChecked )
189
{
190
emit
ChangeColorCode
(
"SpeedInformation"
);
191
}
192
}
193
194
//-------------------------------------------------------------------------
195
196
//-------------------------------------------------------------------------
197
void
198
QGoTrackViewDockWidget::ColorCodeTracksByOriginalColor
(
bool
iChecked)
199
{
200
if
( iChecked )
201
{
202
emit
ChangeColorCode
(
"Original"
);
203
}
204
}
205
206
//-------------------------------------------------------------------------
207
void
QGoTrackViewDockWidget::SetUpUi
()
208
{
209
QWidget
* TrackViewWidget =
new
QWidget
;
210
211
this->
m_glyph
=
new
QCheckBox
(
tr
(
"Glyphs"
),
this
);
212
this->
m_tube
=
new
QCheckBox
(
tr
(
"Tubes"
),
this
);
213
this->
m_glyphSpinBox
=
new
QDoubleSpinBox
(
this
);
214
this->
m_tubeSpinBox
=
new
QDoubleSpinBox
(
this
);
215
this->
m_linewidthSpinBox
=
new
QDoubleSpinBox
(
this
);
216
this->
SetDoubleSpinBox
(this->
m_glyphSpinBox
, 0., 99., 3. );
217
this->
SetDoubleSpinBox
(this->
m_tubeSpinBox
, 0., 99., 3. );
218
this->
SetDoubleSpinBox
(this->
m_linewidthSpinBox
, 0., 10., 1. );
219
220
QVBoxLayout
* Vlayout =
new
QVBoxLayout
;
221
QLabel
* linewidthLabel =
new
QLabel
(
tr
(
"Line Width"
),
this
);
222
QLabel
* Element =
new
QLabel
(
tr
(
"Element:"
),
this
);
223
QLabel
* Radius =
new
QLabel
(
tr
(
"Radius:"
),
this
);
224
225
QGridLayout
* GridLayout =
new
QGridLayout
;
226
GridLayout->
addWidget
(Element, 0, 0);
227
GridLayout->
addWidget
(Radius, 0, 1);
228
GridLayout->
addWidget
(linewidthLabel, 1, 0 );
229
GridLayout->
addWidget
(this->
m_linewidthSpinBox
, 1, 1 );
230
GridLayout->
addWidget
(this->
m_glyph
, 2, 0);
231
GridLayout->
addWidget
(this->
m_glyphSpinBox
, 2, 1);
232
GridLayout->
addWidget
(this->
m_tube
, 3, 0);
233
GridLayout->
addWidget
(this->
m_tubeSpinBox
, 3, 1);
234
235
Vlayout->
addLayout
(GridLayout);
236
QLabel
* Blank =
new
QLabel
(
tr
(
" "
) );
237
Vlayout->
addWidget
(Blank);
238
239
this->
m_real
=
new
QRadioButton
(
tr
(
"Original Color"
) );
240
this->
m_time
=
new
QRadioButton
(
tr
(
"Time Color Code"
) );
241
this->
m_speed
=
new
QRadioButton
(
tr
(
"Speed Color Code"
) );
242
this->
m_real
->
setChecked
(
true
);
243
244
QVBoxLayout
* VColorCodeLayout =
new
QVBoxLayout
;
245
VColorCodeLayout->
addWidget
(this->
m_real
);
246
VColorCodeLayout->
addWidget
(this->
m_time
);
247
VColorCodeLayout->
addWidget
(this->
m_speed
);
248
Vlayout->
addLayout
(VColorCodeLayout, 1);
249
250
TrackViewWidget->
setLayout
(Vlayout);
251
this->
setWidget
(TrackViewWidget);
252
TrackViewWidget->
setSizePolicy
(
253
QSizePolicy::Expanding, QSizePolicy::Fixed);
254
}
255
//-------------------------------------------------------------------------
256
257
//-------------------------------------------------------------------------
258
void
259
QGoTrackViewDockWidget::SetDoubleSpinBox
(
QDoubleSpinBox
* iSpinBox,
260
double
Min,
double
Max,
double
Value )
261
{
262
iSpinBox->
setDecimals
(2);
263
iSpinBox->
setMaximum
(Max);
264
iSpinBox->
setMinimum
(Min);
265
iSpinBox->
setValue
(Value);
266
}
267
//-------------------------------------------------------------------------
268
269
//-------------------------------------------------------------------------
Generated on Mon May 27 2013 08:47:30 for GOFIGURE2 by
1.8.1.2