RasterConfigWidget.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 RasterConfigWidget.cpp
22 
23  \brief A frame for setting raster processing options.
24 */
25 
26 // TerraLib
27 #include "../../../common/SystemApplicationSettings.h"
28 #include "../../../common/UserApplicationSettings.h"
29 #include "../../../core/utils/Platform.h"
30 #include "../../../srs/Config.h"
31 #include "../../../raster/Raster.h"
32 #include "../../af/ApplicationController.h"
33 #include "../../af/Utils.h"
34 #include "RasterConfigWidget.h"
35 #include "ui_RasterConfigWidgetForm.h"
36 
37 
39  : AbstractSettingWidget(parent),
40  m_ui(new Ui::RasterConfigWidgetForm)
41 {
42  m_resumeText = tr("Changes the raster processing configurations of the application.");
43 
44  m_ui->setupUi(this);
45 
47 
48  initialize();
49 
50  if(!m_ui->m_questionCheckBox->isChecked() && !m_ui->m_defaultCheckBox->isChecked())
51  m_ui->m_defaultCheckBox->setEnabled(false);
52 }
53 
55 
57 {
58  QSettings settings(QSettings::IniFormat, QSettings::UserScope, qApp->organizationName(), qApp->applicationName());
59 
60  settings.setValue("raster_config/default_interpolator", m_ui->m_interpolatorComboBox->itemData(m_ui->m_interpolatorComboBox->currentIndex()).toInt());
61  settings.setValue("raster_config/default_level", m_ui->m_levelSpinBox->value());
62  settings.setValue("raster_config/default_question", m_ui->m_questionCheckBox->isChecked());
63  settings.setValue("raster_config/default_option", m_ui->m_defaultCheckBox->isChecked());
64 
66 }
67 
69 {
70 }
71 
73 {
74  ns = "dpi.inpe.br.apf";
75  helpFile = "";
76 }
77 
79 {
80  QSettings set(QSettings::IniFormat, QSettings::UserScope, qApp->organizationName(), qApp->applicationName());
81 
82  set.beginGroup("raster_config");
83  set.endGroup();
84 
85  // Get user settings
86  QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::instance()->organizationName(), QApplication::instance()->applicationName());
87 
88  int interpolator = settings.value("raster_config/default_interpolator", te::common::SystemApplicationSettings::getInstance().getValue("Application.rasterConfigDefaultInterpolator").c_str()).toInt();
89  int level = settings.value("raster_config/default_level", te::common::SystemApplicationSettings::getInstance().getValue("Application.rasterConfigDefaultLevel").c_str()).toInt();
90  bool question = settings.value("raster_config/default_question", te::common::SystemApplicationSettings::getInstance().getValue("Application.rasterConfigDefaultQuestion").c_str()).toBool();
91  bool option = settings.value("raster_config/default_option", te::common::SystemApplicationSettings::getInstance().getValue("Application.rasterConfigDefaultOption").c_str()).toBool();
92 
93  m_ui->m_interpolatorComboBox->setCurrentIndex(m_ui->m_interpolatorComboBox->findData(interpolator));
94  m_ui->m_levelSpinBox->setValue(level);
95  m_ui->m_questionCheckBox->setChecked(question);
96  m_ui->m_defaultCheckBox->setChecked(option);
97 
98  // Signals & slots
99  connect(m_ui->m_interpolatorComboBox, SIGNAL(currentIndexChanged(int)), SLOT(onInterpolatorComboBoxChanged(int)));
100  connect(m_ui->m_levelSpinBox, SIGNAL(valueChanged(int)), SLOT(onLevelChanged(int)));
101  connect(m_ui->m_questionCheckBox, SIGNAL(toggled(bool)), SLOT(onQuestionChecked(bool)));
102  connect(m_ui->m_defaultCheckBox, SIGNAL(toggled(bool)), SLOT(onSetMultiResolutionDefaultChecked(bool)));
103 }
104 
106 {
107  m_ui->m_interpolatorComboBox->clear();
108 
109  m_ui->m_interpolatorComboBox->addItem(tr("Nearest Neighbor"), te::rst::NearestNeighbor);
110  m_ui->m_interpolatorComboBox->addItem(tr("Bilinear"), te::rst::Bilinear);
111  m_ui->m_interpolatorComboBox->addItem(tr("Bicubic"), te::rst::Bicubic);
112 }
113 
115  int /*index*/)
116 {
118 }
119 
121 {
123 }
124 
126 {
127  if(checked)
128  {
129  m_ui->m_defaultCheckBox->setEnabled(true);
130  m_ui->m_defaultCheckBox->setChecked(false);
131  }
132  else if(!m_ui->m_defaultCheckBox->isChecked())
133  m_ui->m_defaultCheckBox->setEnabled(false);
134 
136 }
137 
139 {
140  if(checked)
141  m_ui->m_questionCheckBox->setChecked(false);
142  else if(!m_ui->m_questionCheckBox->isChecked())
143  m_ui->m_defaultCheckBox->setEnabled(false);
144 
146 }
Near neighborhood interpolation method.
A frame for setting raster processing options.
static T & getInstance()
It returns a reference to the singleton instance.
Definition: Singleton.h:126
std::unique_ptr< Ui::RasterConfigWidgetForm > m_ui
Bicubic interpolation method.
void getHelpInformations(QString &ns, QString &helpFile)
Bilinear interpolation method.
virtual void changeApplyButtonState(const bool &state)
Indicates that there&#39;s unsaved information. Use this method after each change in informations of the ...