All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GroupByWizardPage.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/GroupByWizardPage.cpp
22 
23  \brief This file has the GroupByWizardPage class.
24 */
25 
26 // TerraLib
27 #include "../../../dataaccess/query/GroupByItem.h"
28 #include "../../../dataaccess/query/PropertyName.h"
29 #include "../utils/DoubleListWidget.h"
30 #include "GroupByWizardPage.h"
31 #include "ui_DoubleListWidgetForm.h"
32 
33 // Qt
34 #include <QGridLayout>
35 
36 
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("Group By Definition"));
48  this->setSubTitle(tr("Choose the attributes to be grouped."));
49 
50  m_widget->getForm()->m_leftItemsLabel->setText(tr("Available Properties"));
51  m_widget->getForm()->m_rightItemsLabel->setText(tr("Used Properties"));
52 }
53 
55 {
56 }
57 
59 {
60  return true;
61 }
62 
64 {
65  return m_widget.get();
66 }
67 
69 {
70  std::vector<std::string> values = m_widget->getOutputValues();
71 
72  if(values.empty())
73  return 0;
74 
75 
76  te::da::GroupBy* groupBy = new te::da::GroupBy;
77 
78  for(size_t t = 0; t < values.size(); ++t)
79  {
81 
82  groupBy->push_back(gi);
83  }
84 
85  return groupBy;
86 }
boost::ptr_vector< GroupByItem > GroupBy
A class that can be used to model a GROUP BY clause.
Definition: GroupBy.h:37
A class that can be used in a GROUP BY clause.
Definition: GroupByItem.h:50
A class that models the name of any property of an object.
Definition: PropertyName.h:50
This file has the GroupByWizardPage class.
DoubleListWidget * getWidget() const
std::auto_ptr< DoubleListWidget > m_widget