SaveSelectedObjectsDialog.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2011-2012 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/layer/utils/SaveSelectedObjectsDialog.cpp
22 
23 \brief This interface is used to create a new layer based on a layer with selected objects.
24 */
25 
26 // TerraLib
29 #include "ui_SaveSelectedObjectsDialogForm.h"
30 
31 // Qt
32 #include <QGridLayout>
33 #include <QMessageBox>
34 
35 
37  : QDialog(parent, f),
38  m_ui(new Ui::SaveSelectedObjectsDialogForm),
39  m_saveSelectedObjectsWidget(nullptr)
40 {
41  // add controls
42  m_ui->setupUi(this);
43  m_ui->m_imgLabel->setPixmap(QIcon::fromTheme("layer-save-selected-obj").pixmap(50, 50));
44 
45  //add new property widget
46  QGridLayout* layout = new QGridLayout(m_ui->m_widget);
47  layout->setContentsMargins(0, 0, 0, 0);
48 
49  //Fill Widget
51 
52  layout->addWidget(m_saveSelectedObjectsWidget);
53 
54  //connects
55  connect(m_ui->m_okPushButton, SIGNAL(clicked()), this, SLOT(onOkPushButtonClicked()));
56  connect(m_ui->m_cancelPushButton, SIGNAL(clicked()), this, SLOT(onCancelPushButtonClicked()));
57 
58 }
59 
61  default;
62 
64 {
65  return m_layerResult;
66 }
67 
69 {
70  std::unique_ptr<te::map::LayerSchema> dsType(layer->getSchema());
71 
74 }
75 
77 {
78  std::string errorMessage;
79 
80  this->setCursor(Qt::WaitCursor);
81 
82  bool res = m_saveSelectedObjectsWidget->execute(errorMessage);
83 
84  this->setCursor(Qt::ArrowCursor);
85 
86  if (!res)
87  {
88  QMessageBox::warning(this, tr("Warning"), errorMessage.c_str());
89  return;
90  }
91 
93 
94  QMessageBox::information(this, tr("Warning"), tr("Layer was saved."));
95 
96  accept();
97 }
98 
100 {
101  reject();
102 }
std::unique_ptr< Ui::SaveSelectedObjectsDialogForm > m_ui
This interface is used to create a new layer based on a layer with selected objects.
SaveSelectedObjectsDialog(QWidget *parent=0, Qt::WindowFlags f=0)
This interface is used to create a new layer based on a layer with selected objects.
void setParameters(te::map::AbstractLayerPtr layer)
Set parameters.
void updateWindowComponents()
Update components with imput data.
void setParameters(te::map::AbstractLayerPtr layer)
Set a layer.
te::qt::widgets::SaveSelectedObjectsWidget * m_saveSelectedObjectsWidget
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr