All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
OverlapBehaviorWidget.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/se/OverlapBehaviorWidget.cpp
22 
23  \brief A dialog used to build a OverlapBehavior element.
24 */
25 
26 // TerraLib
27 #include "../../../common/STLUtils.h"
28 #include "OverlapBehaviorWidget.h"
29 #include "ui_OverlapBehaviorWidgetForm.h"
30 #include "../../../se.h"
31 
32 // Qt
33 
34 
35 // STL
36 
37 
39  : QWidget(parent, f),
40  m_ui(new Ui::OverlapBehaviorWidgetForm)
41 {
42  m_ui->setupUi(this);
43 
44  initialize();
45 
46  // Signals & slots
47  connect(m_ui->m_comboBox, SIGNAL(activated(QString)), SLOT(onValueChanged(QString)));
48 }
49 
51 {
52  m_obNames.clear();
53 }
54 
56 {
57  m_ob = value;
58 
59  updateUi();
60 }
61 
63 {
64  return m_ob;
65 }
66 
68 {
69  //define the Overlap Behavior names
70  m_obNames.clear();
71 
72  m_obNames.insert(std::map<te::se::RasterSymbolizer::OverlapBehavior, QString>::value_type
73  (te::se::RasterSymbolizer::LATEST_ON_TOP, tr("Latest on Top")));
74  m_obNames.insert(std::map<te::se::RasterSymbolizer::OverlapBehavior, QString>::value_type
75  (te::se::RasterSymbolizer::EARLIEST_ON_TOP, tr("Earliest on Top")));
76  m_obNames.insert(std::map<te::se::RasterSymbolizer::OverlapBehavior, QString>::value_type
77  (te::se::RasterSymbolizer::AVERAGE, tr("Average")));
78  m_obNames.insert(std::map<te::se::RasterSymbolizer::OverlapBehavior, QString>::value_type
79  (te::se::RasterSymbolizer::RANDOM, tr("Random")));
80  m_obNames.insert(std::map<te::se::RasterSymbolizer::OverlapBehavior, QString>::value_type
81  (te::se::RasterSymbolizer::NO_BEHAVIOR, tr("No Behavior")));
82 
83 
84  //fill the combo box with this names
85  std::map<te::se::RasterSymbolizer::OverlapBehavior, QString>::iterator it = m_obNames.begin();
86 
87  while(it != m_obNames.end())
88  {
89  m_ui->m_comboBox->addItem(it->second);
90 
91  ++it;
92  }
93 
94  //set default value
96 
97  updateUi();
98 }
99 
101 {
102  m_ui->m_comboBox->setCurrentIndex(m_ui->m_comboBox->findText(m_obNames[m_ob]));
103 }
104 
106 {
107  std::map<te::se::RasterSymbolizer::OverlapBehavior, QString>::iterator it = m_obNames.begin();
108 
109  while(it != m_obNames.end())
110  {
111  if(it->second == value)
112  {
113  m_ob = it->first;
114  break;
115  }
116 
117  ++it;
118  }
119 }
OverlapBehaviorWidget(QWidget *parent=0, Qt::WindowFlags f=0)
Constructs a OverlapBehaviorWidget dialog which is a child of parent, with widget flags set to f...
void initialize()
Internal method to initialize the widget (e.g.: color, combos, icons, etc.)
A widget used to build OverlapBehavior element.
std::auto_ptr< Ui::OverlapBehaviorWidgetForm > m_ui
Dialog form.
OverlapBehavior
OverlapBehavior tells a system how to behave when multiple raster images in a layer overlap each othe...
void setOverlapBehavior(te::se::RasterSymbolizer::OverlapBehavior value)
te::se::RasterSymbolizer::OverlapBehavior getOverlapBehavior() const
void updateUi()
Updates the widget form based on internal element.