-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpqTrackFilter2Panel.cxx
213 lines (170 loc) · 5.31 KB
/
pqTrackFilter2Panel.cxx
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
#include "pqTrackFilter2Panel.h"
#include "pqProxy.h"
#include "vtkSMProxy.h"
#include <QLayout>
#include "pqDoubleRangeWidget.h"
#include "pqSMAdaptor.h"
#include "vtkSMProperty.h"
#include "vtkSMPropertyHelper.h"
/*
//
#include <QMessageBox>
#include <iostream>
#include <set>
*/
pqTrackFilter2Panel::pqTrackFilter2Panel(pqProxy* proxy, QWidget* p) :
pqLoadedFormObjectPanel(":/ParaViewResources/pqTrackFilter2Panel.ui", proxy, p)
{
//pqDoubleRangeWidget * newRW;
QWidget * widget;
QComboBox * comboB;
QGridLayout *gridlayoutF = this->findChild<QGridLayout*>("filterlayout");
QGridLayout *gridlayoutR = this->findChild<QGridLayout*>("restrictionlayout");
this->RestrictionArray = this->findChild<QComboBox*>("RestrictionArray");;
this->label4 = this->findChild<QLabel*>("label_4");
this->label5 = this->findChild<QLabel*>("label_5");
// adjust GUI
widget = this->findChild<QWidget*>("Filter_0");
widget->hide();
this->FilterBounds_0 = new pqDoubleRangeWidget();
this->FilterBounds_0->setObjectName(QString::fromUtf8("FilterBounds_0"));
QObject::connect(
this->FilterBounds_0,
SIGNAL(valueEdited(double)),
this,
SLOT(lowerFChanged(double))
);
gridlayoutF->addWidget(this->FilterBounds_0,0,1,1,1);
widget = this->findChild<QWidget*>("Filter_1");
widget->hide();
this->FilterBounds_1 = new pqDoubleRangeWidget();
this->FilterBounds_1->setObjectName(QString::fromUtf8("FilterBounds_1"));
QObject::connect(
this->FilterBounds_1,
SIGNAL(valueEdited(double)),
this,
SLOT(upperFChanged(double))
);
gridlayoutF->addWidget(this->FilterBounds_1,2,1,1,1);
widget = this->findChild<QWidget*>("Restriction_0");
widget->hide();
this->RestrictionBounds_0 = new pqDoubleRangeWidget();
this->RestrictionBounds_0->setObjectName(QString::fromUtf8("RestrictionBounds_0"));
QObject::connect(
this->RestrictionBounds_0,
SIGNAL(valueEdited(double)),
this,
SLOT(lowerRChanged(double))
);
gridlayoutR->addWidget(this->RestrictionBounds_0,0,1,1,1);
widget = this->findChild<QWidget*>("Restriction_1");
widget->hide();
this->RestrictionBounds_1 = new pqDoubleRangeWidget();
this->RestrictionBounds_1->setObjectName(QString::fromUtf8("RestrictionBounds_1"));
QObject::connect(
this->RestrictionBounds_1,
SIGNAL(valueEdited(double)),
this,
SLOT(upperRChanged(double))
);
gridlayoutR->addWidget(this->RestrictionBounds_1,2,1,1,1);
comboB = this->findChild<QComboBox*>("ModeSelection");
comboB->addItem("some point on the track");
comboB->addItem("every point on the track");
comboB->addItem("the points on the track, where");
QObject::connect(
comboB,
SIGNAL(currentIndexChanged(int)),
this,
SLOT(selectionModeChanged(int))
);
comboB = this->findChild<QComboBox*>("FilterArray");
comboB->addItem("f1");
comboB->addItem("f2");
comboB->addItem("f3");
comboB = this->findChild<QComboBox*>("RestrictionArray");
comboB->addItem("r1");
comboB->addItem("r2");
comboB->addItem("r3");
vtkSMProperty* prop = this->proxy()->GetProperty("FilterArray");
double val = pqSMAdaptor::getElementProperty(prop).toDouble();
pqSMAdaptor::setElementProperty(prop,5);
//this->layout()->addWidget(new QLabel("This is from a plugin", this));
//this->layout()->addWidget(new pqDoubleRangeWidget(this));
this->linkServerManagerProperties();
}
pqTrackFilter2Panel::~pqTrackFilter2Panel()
{
}
/*void pqTrackFilter2Panel::accept()
{
Superclass::accept();
}
void pqTrackFilter2Panel::reset()
{
Superclass::reset();
}*/
void pqTrackFilter2Panel::lowerFChanged(double val)
{
// clamp the lower threshold
if(this->FilterBounds_1->value() < val)
{
this->FilterBounds_1->setValue(val);
}
}
void pqTrackFilter2Panel::upperFChanged(double val)
{
// clamp the lower threshold
if(this->FilterBounds_0->value() > val)
{
this->FilterBounds_0->setValue(val);
}
}
void pqTrackFilter2Panel::lowerRChanged(double val)
{
// clamp the lower threshold if we need to
if(this->RestrictionBounds_1->value() < val)
{
this->RestrictionBounds_1->setValue(val);
}
}
void pqTrackFilter2Panel::upperRChanged(double val)
{
// clamp the lower threshold if we need to
if(this->RestrictionBounds_0->value() > val)
{
this->RestrictionBounds_0->setValue(val);
}
}
/*
void pqTrackFilter2Panel::variableChanged()
{
// when the user changes the variable, adjust the ranges on the ThresholdBetween
vtkSMProperty* prop = this->proxy()->GetProperty("ThresholdBetween");
QList<QVariant> range = pqSMAdaptor::getElementPropertyDomain(prop);
if(range.size() == 2 && range[0].isValid() && range[1].isValid())
{
this->Filter_0->setValue(range[0].toDouble());
this->Filter_1->setValue(range[1].toDouble());
}
}
*/
void pqTrackFilter2Panel::selectionModeChanged(int selection)
{
if (selection==2)
{
this->RestrictionBounds_0->setEnabled(true);
this->RestrictionBounds_1->setEnabled(true);
this->RestrictionArray->setEnabled(true);
this->label4->setEnabled(true);
this->label5->setEnabled(true);
}
else
{
this->RestrictionBounds_0->setEnabled(false);
this->RestrictionBounds_1->setEnabled(false);
this->RestrictionArray->setEnabled(false);
this->label4->setEnabled(false);
this->label5->setEnabled(false);
}
}