All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ShadedReliefWidget.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/ShadedReliefWidget.cpp
22 
23  \brief A dialog used to build a ShadedRelief element.
24 */
25 
26 // TerraLib
27 #include "../../../common/STLUtils.h"
28 #include "../../../se/ShadedRelief.h"
29 #include "ShadedReliefWidget.h"
30 #include "ui_ShadedReliefWidgetForm.h"
31 
32 // Qt
33 
34 
35 // STL
36 #include <cassert>
37 
38 
40  : QWidget(parent, f),
41  m_ui(new Ui::ShadedReliefWidgetForm),
42  m_sr(new te::se::ShadedRelief)
43 {
44  m_ui->setupUi(this);
45 
46  initialize();
47 
48  // Signals & slots
49  connect(m_ui->m_brightnessCheckBox, SIGNAL(toggled(bool)), SLOT(onBrightnessToggled(bool)));
50  connect(m_ui->m_reliefFactorDoubleSpinBox, SIGNAL(valueChanged(double)), SLOT(onFactorChanged(double)));
51 }
52 
54 {
55  delete m_sr;
56 }
57 
59 {
60  assert(sr);
61 
62  delete m_sr;
63 
64  m_sr = sr->clone();
65 
66  updateUi();
67 }
68 
70 {
71  return m_sr->clone();
72 }
73 
75 {
76  m_sr->setBrightnessOnly(m_ui->m_brightnessCheckBox->isChecked());
77  m_sr->setReliefFactor(m_ui->m_reliefFactorDoubleSpinBox->value());
78 }
79 
81 {
82  m_ui->m_brightnessCheckBox->setChecked(m_sr->isBrightnessOnly());
83  m_ui->m_reliefFactorDoubleSpinBox->setValue(m_sr->getReliefFactor());
84 }
85 
87 {
88  m_sr->setBrightnessOnly(flag);
89 }
90 
92 {
93  m_sr->setReliefFactor(value);
94 }
void setShadedRelief(const te::se::ShadedRelief *sr)
ShadedRelief * clone() const
It creates a new copy of this object.
void updateUi()
Updates the widget form based on internal fill element.
ShadedReliefWidget(QWidget *parent=0, Qt::WindowFlags f=0)
Constructs a ShadedReliefWidget dialog which is a child of parent, with widget flags set to f...
te::se::ShadedRelief * getShadedRelief() const
A widget used to build.
std::auto_ptr< Ui::ShadedReliefWidgetForm > m_ui
Dialog form.
ShadedRelief specifies the application of relief shading (or "hill shading") to a DEM raster to give ...
Definition: ShadedRelief.h:58
void initialize()
Internal method to initialize the widget (e.g.: color, combos, icons, etc.)