-
Notifications
You must be signed in to change notification settings - Fork 49
/
PDatasetTransformWidget.cpp
47 lines (39 loc) · 1.59 KB
/
PDatasetTransformWidget.cpp
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
#include "PDatasetTransformWidget.h"
#include <vapor/ControlExecutive.h>
#include <vapor/STLUtils.h>
#include "GUIStateParams.h"
#include "VSection.h"
#include "PStringDropdown.h"
#include "PTransformWidget.h"
using namespace VAPoR;
const std::string PDatasetTransformWidget::SelectedDatasetTag = "transformWidgetDatasetTag";
PDatasetTransformWidget::PDatasetTransformWidget(VAPoR::ControlExec *ce)
: PWidget("", _section = new VSectionGroup("Transform",
{
_twDataset = new PStringDropdown(SelectedDatasetTag, {}, "Dataset"),
_tw = new PTransformWidget,
})),
_ce(ce)
{
}
void PDatasetTransformWidget::updateGUI() const
{
ParamsMgr * pm = _ce->GetParamsMgr();
auto stateParams = ((GUIStateParams *)pm->GetParams(GUIStateParams::GetClassType()));
auto activeViz = stateParams->GetActiveVizName();
ViewpointParams *vp = pm->GetViewpointParams(activeViz);
DataStatus * dataStatus = _ce->GetDataStatus();
vector<string> datasets = dataStatus->GetDataMgrNames();
if (datasets.empty()) {
_section->setEnabled(false);
return;
} else {
_section->setEnabled(true);
}
_twDataset->SetItems(datasets);
_twDataset->Update(vp);
string dataset = vp->GetValueString(SelectedDatasetTag, datasets[0]);
if (!STLUtils::Contains(datasets, dataset)) dataset = datasets[0];
Transform *transform = vp->GetTransform(dataset);
_tw->Update(transform);
}