All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TrajectoryPropertiesWidget.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/st/TrajectoryPropertiesWidget.cpp
22 
23  \brief A widget used to adjust a Trajectory layer's properties
24 */
25 
26 //Terralib
27 #include "../../../dataaccess.h"
28 #include "../../../datatype/Property.h"
30 #include "ui_TrajectoryPropertiesWidgetForm.h"
31 
32 //QT
33 #include <QWidget>
34 
36  : QWidget(parent, f),
37  m_ui(new Ui::TrajectoryPropertiesWidgetForm)
38 {
39  m_ui->setupUi(this);
40 }
41 
43 {
44 }
45 
46 Ui::TrajectoryPropertiesWidgetForm* te::qt::widgets::TrajectoryPropertiesWidget::getForm()
47 {
48  return m_ui.get();
49 }
50 
52 {
53  if(m_dataType)
54  return m_dataType->getPropertyPosition(m_ui->m_idComboBox->currentText().toStdString());
55  else
56  return -1;
57 }
58 
60 {
61  return m_ui->m_geometryComboBox->currentText().toStdString();
62 }
63 
65 {
66  QString item;
67  m_dataType = dataType;
68 
69  const std::vector<te::dt::Property*>& properties = dataType->getProperties();
70 
71  for (std::size_t i = 0; i < properties.size(); i++)
72  {
73  if(properties.at(i)->getType() == te::dt::GEOMETRY_TYPE)
74  {
75  item = QString::fromStdString(properties.at(i)->getName());
76  m_ui->m_geometryComboBox->addItem(item);
77  }
78  else if(properties.at(i)->getType() != te::dt::DATETIME_TYPE)
79  {
80  item = QString::fromStdString(properties.at(i)->getName());
81  m_ui->m_idComboBox->addItem(item);
82  }
83  }
84 }
85 
87 {
88 
89 }
boost::shared_ptr< DataSetType > DataSetTypePtr
Definition: DataSetType.h:653
Ui::TrajectoryPropertiesWidgetForm * getForm()
Returns a pointer to the widget's form.
void setUp(const te::da::DataSetTypePtr dataType)
Adjusts the widget's components based on the given datasettype.
TrajectoryPropertiesWidget(QWidget *parent=0, Qt::WindowFlags f=0)
Constructor.
A widget used to adjust a Trajectory layer's properties.
std::string getGeometryId()
Returns the name of the property that holds the temporal property geometry.
std::auto_ptr< Ui::TrajectoryPropertiesWidgetForm > m_ui
The widget's form.
int getId()
Returns the index of the temporal property id.