All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GeometricOpWizardPage.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/vp/qt/GeometricOpWizardPage.cpp
22 
23  \brief This file defines a class for a Geometric Operation Wizard Page.
24 */
25 
26 // TerraLib
27 #include "../../common/StringUtils.h"
28 #include "../../dataaccess/dataset/DataSet.h"
29 #include "../../dataaccess/dataset/DataSetType.h"
30 #include "../../dataaccess/utils/Utils.h"
31 #include "../../maptools/AbstractLayer.h"
32 #include "../../qt/widgets/utils/DoubleListWidget.h"
33 #include "GeometricOpWizardPage.h"
34 #include "ui_GeometricOpWizardPageForm.h"
35 
36 // Qt
37 #include <QGridLayout>
38 #include <QIntValidator>
39 #include <QMessageBox>
40 
41 // STL
42 #include <memory>
43 
44 
46  : QWizardPage(parent),
47  m_ui(new Ui::GeometricOpWizardPageForm),
48  m_layer(0)
49 {
50 // setup controls
51  m_ui->setupUi(this);
52 
53  m_widget.reset(new te::qt::widgets::DoubleListWidget(m_ui->m_widget));
54 
55  QGridLayout* displayLayout = new QGridLayout(m_ui->m_widget);
56  displayLayout->addWidget(m_widget.get());
57 
58 // configure page
59  this->setTitle(tr("Output Layer Attributes"));
60  this->setSubTitle(tr("Choose the attributes that compose the output layer."));
61 
62  m_widget->setLeftLabel("Available Properties");
63  m_widget->setRightLabel("Used Properties");
64 
65 }
66 
68 {
69 }
70 
72 {
73  m_layer = layer;
74 
75 // load attributes of the selected layer in the left list widget.
76  loadAttributes();
77 }
78 
80 {
81  return m_layer;
82 }
83 
85 {
86  return m_widget->getOutputValues();
87 }
88 
90 {
91  std::auto_ptr<te::da::DataSetType> dsType = m_layer->getSchema();
92  std::vector<te::dt::Property*> vecProps = dsType->getProperties();
93  std::vector<std::string> propsAux;
94 
95  for(std::size_t i = 0; i < vecProps.size(); ++i)
96  {
97  if(vecProps[i]->getType() != te::dt::GEOMETRY_TYPE)
98  propsAux.push_back(vecProps[i]->getName());
99  }
100 
101  if(propsAux != m_props)
102  {
103  m_props = propsAux;
104 
105  m_widget->clearInputValues();
106  m_widget->clearOutputValues();
107  m_widget->setInputValues(m_props);
108  }
109 }
110 
std::vector< std::string > getSelectedProps()
std::auto_ptr< Ui::GeometricOpWizardPageForm > m_ui
void setLayer(te::map::AbstractLayerPtr layer)
This method is used to set the selected layer for segmenter operation.
std::auto_ptr< te::qt::widgets::DoubleListWidget > m_widget
te::map::AbstractLayerPtr getLayer()
This file defines a class for Basic Geometric Operation Wizard Page.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr