TimeSeriesPropertiesWidget.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/TimePropertiesWidget.cpp
22 
23  \brief A widget used to adjust a TimeSeries layer's properties
24 */
25 
26 //Terralib
27 #include "../../../dataaccess.h"
28 #include "../../../datatype/Property.h"
30 #include "ui_TimeSeriesPropertiesWidgetForm.h"
31 
32 //QT
33 #include <QWidget>
34 
36 : QWidget(parent, f),
37  m_ui(new Ui::TimeSeriesPropertiesWidgetForm)
38 {
39  m_ui->setupUi(this);
40  QString item;
41 }
42 
44  default;
45 
46 Ui::TimeSeriesPropertiesWidgetForm* te::qt::widgets::TimeSeriesPropertiesWidget::getForm()
47 {
48  return m_ui.get();
49 }
50 
52 {
53  return m_ui->m_idComboBox->currentText().toUtf8().data();
54 }
55 
57 {
58  if(m_dataType)
59  return static_cast<int>(m_dataType->getPropertyPosition(m_ui->m_idComboBox->currentText().toUtf8().data()));
60  else
61  return -1;
62 }
63 
65 {
66  return m_ui->m_valueComboBox->currentText().toUtf8().data();
67 }
68 
70 {
71  if(m_dataType)
72  return static_cast<int>(m_dataType->getPropertyPosition(m_ui->m_valueComboBox->currentText().toUtf8().data()));
73  else
74  return -1;
75 }
76 
78 {
79  return m_ui->m_locationComboBox->currentText().toUtf8().data();
80 }
81 
83 {
84  if(m_dataType)
85  return static_cast<int>(m_dataType->getPropertyPosition(m_ui->m_locationComboBox->currentText().toUtf8().data()));
86  else
87  return -1;
88 }
89 
91 {
92  QString item;
93  m_dataType = dataType;
94 
95  const std::vector<te::dt::Property*>& properties = dataType->getProperties();
96 
97  for (std::size_t i = 0; i < properties.size(); i++)
98  {
99  if(properties.at(i)->getType() == te::dt::GEOMETRY_TYPE)
100  {
101  item = QString::fromUtf8(properties.at(i)->getName().c_str());
102  m_ui->m_locationComboBox->addItem(item);
103  }
104  else if(properties.at(i)->getType() != te::dt::DATETIME_TYPE)
105  {
106  item = QString::fromUtf8(properties.at(i)->getName().c_str());
107  m_ui->m_idComboBox->addItem(item);
108  m_ui->m_valueComboBox->addItem(item);
109  }
110  }
111 }
112 
113 void
115  QString /*text*/)
116 {
117 
118 }
TimeSeriesPropertiesWidget(QWidget *parent=0, Qt::WindowFlags f=0)
Constructor.
boost::shared_ptr< DataSetType > DataSetTypePtr
Definition: DataSetType.h:653
std::unique_ptr< Ui::TimeSeriesPropertiesWidgetForm > m_ui
The widget&#39;s form.
std::string getIdPropName()
Returns the name of the property that holds the ID of each timeSeries in the dataset.
std::string getGeometryPropName()
Returns the name of the property that holds the geometry.
Ui::TimeSeriesPropertiesWidgetForm * getForm()
Returns a pointer to the widget&#39;s form.
int getValueIndex()
Returns the index of the attribute values associated to each time series in the dataset.
int getGeometryId()
Returns the index of the temporal property geometry.
void setUp(const te::da::DataSetTypePtr dataType)
Adjusts the widget&#39;s components based on the given datasettype.
A widget used to adjust a time series layer&#39;s properties.
te::da::DataSetTypePtr m_dataType
The datasetType that will be used to generate the spatio-temporal layer.
std::string getValuePropName()
Returns the name of the property that holds the attribute values associated to each time series in th...
int getIdIndex()
Returns the index of the ID of each timeSeries in the dataset.