Main Page
Modules
Namespaces
Classes
Files
File List
File Members
FieldsWizardPage.cpp
Go to the documentation of this file.
1
/* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2
3
This file is part of the TerraLib - a Framework for building GIS enabled applications.
4
5
TerraLib is free software: you can redistribute it and/or modify
6
it under the terms of the GNU Lesser General Public License as published by
7
the Free Software Foundation, either version 3 of the License,
8
or (at your option) any later version.
9
10
TerraLib is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU Lesser General Public License for more details.
14
15
You should have received a copy of the GNU Lesser General Public License
16
along with TerraLib. See COPYING. If not, write to
17
TerraLib Team at <terralib-team@terralib.org>.
18
*/
19
20
/*!
21
\file terralib/qt/widgets/query/FieldsWizardPage.cpp
22
23
\brief This file has the FieldsWizardPage class.
24
*/
25
26
// TerraLib
27
#include "../../../dataaccess/query/Field.h"
28
#include "../../../dataaccess/query/PropertyName.h"
29
#include "../utils/DoubleListWidget.h"
30
#include "
FieldsWizardPage.h
"
31
#include "ui_DoubleListWidgetForm.h"
32
33
// Qt
34
#include <QGridLayout>
35
36
37
te::qt::widgets::FieldsWizardPage::FieldsWizardPage
(
QWidget
* parent)
38
:
QWizardPage
(parent)
39
{
40
m_widget
.reset(
new
DoubleListWidget
(
this
));
41
42
QGridLayout* layout =
new
QGridLayout(
this
);
43
44
layout->addWidget(
m_widget
.get());
45
46
//configure page
47
this->setTitle(tr(
"Attribute Selection"
));
48
this->setSubTitle(tr(
"Select the attributes to be listed."
));
49
50
m_widget
->getForm()->m_leftItemsLabel->setText(tr(
"Available Properties"
));
51
m_widget
->getForm()->m_rightItemsLabel->setText(tr(
"Used Properties"
));
52
53
//connect slots
54
connect(
m_widget
.get(), SIGNAL(itemChanged()),
this
, SLOT(
onItemChanged
()));
55
}
56
57
te::qt::widgets::FieldsWizardPage::~FieldsWizardPage
() =
default
;
58
59
bool
te::qt::widgets::FieldsWizardPage::isComplete
()
const
60
{
61
if
(
m_widget
->getOutputValues().empty())
62
return
false
;
63
64
return
true
;
65
}
66
67
te::qt::widgets::DoubleListWidget
*
te::qt::widgets::FieldsWizardPage::getWidget
()
const
68
{
69
return
m_widget
.get();
70
}
71
72
te::da::Fields
*
te::qt::widgets::FieldsWizardPage::getFields
()
73
{
74
te::da::Fields
* fields =
new
te::da::Fields
;
75
76
std::vector<std::string> values =
m_widget
->getOutputValues();
77
78
for
(
size_t
t = 0; t < values.size(); ++t)
79
{
80
te::da::Field
* f =
new
te::da::Field
(
new
te::da::PropertyName
(values[t]));
81
82
fields->push_back(f);
83
}
84
85
return
fields;
86
}
87
88
void
te::qt::widgets::FieldsWizardPage::setFields
(
const
te::da::Fields
* fields)
89
{
90
std::vector<std::string> values;
91
92
for
(std::size_t i = 0; i < fields->size(); ++i)
93
{
94
te::da::Field
f = fields->at(i);
95
96
te::da::PropertyName
*
p
=
dynamic_cast<
te::da::PropertyName
*
>
(f.
getExpression
());
97
98
values.push_back(p->
getName
());
99
}
100
101
m_widget
->setOutputValues(values);
102
}
103
104
void
te::qt::widgets::FieldsWizardPage::onItemChanged
()
105
{
106
emit completeChanged();
107
}
te::da::PropertyName::getName
const std::string & getName() const
It returns the property name.
Definition:
dataaccess/query/PropertyName.h:80
te::da::Field
The Field class can be used to model an expression that takes part of the output items of a SELECT...
Definition:
src/terralib/dataaccess/query/Field.h:50
te::qt::widgets::FieldsWizardPage::getWidget
DoubleListWidget * getWidget() const
Definition:
FieldsWizardPage.cpp:67
QWizardPage
te::qt::widgets::DoubleListWidget
...
Definition:
DoubleListWidget.h:53
te::qt::widgets::FieldsWizardPage::isComplete
bool isComplete() const
Definition:
FieldsWizardPage.cpp:59
te::da::PropertyName
A class that models the name of any property of an object.
Definition:
dataaccess/query/PropertyName.h:50
te::da::Field::getExpression
Expression * getExpression() const
It returns the expression set for an output select query.
Definition:
src/terralib/dataaccess/query/Field.cpp:76
QWidget
FieldsWizardPage.h
This file has the FieldsWizardPage class.
te::qt::widgets::FieldsWizardPage::getFields
te::da::Fields * getFields()
Definition:
FieldsWizardPage.cpp:72
te::qt::widgets::FieldsWizardPage::onItemChanged
void onItemChanged()
Definition:
FieldsWizardPage.cpp:104
te::da::Fields
boost::ptr_vector< Field > Fields
Fields is just a boost::ptr_vector of Field pointers.
Definition:
Fields.h:37
p
te::gm::Polygon * p
Definition:
examples/geometry/main.cpp:52
te::qt::widgets::FieldsWizardPage::m_widget
std::unique_ptr< DoubleListWidget > m_widget
Definition:
FieldsWizardPage.h:80
te::qt::widgets::FieldsWizardPage::FieldsWizardPage
FieldsWizardPage(QWidget *parent=0)
Definition:
FieldsWizardPage.cpp:37
te::qt::widgets::FieldsWizardPage::setFields
void setFields(const te::da::Fields *fields)
Definition:
FieldsWizardPage.cpp:88
te::qt::widgets::FieldsWizardPage::~FieldsWizardPage
virtual ~FieldsWizardPage()
terralib5_src
src
terralib
qt
widgets
query
FieldsWizardPage.cpp
Generated on Wed Jun 6 2018 12:16:08 for TerraLib by
1.8.11