CreateLayerDialog.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/CreateLayerDialog.cpp
22 
23 \brief This interface is used to create new layer operation.
24 */
25 
26 // TerraLib
27 
28 
29 #include "CreateLayerDialog.h"
30 #include "CreateLayerWidget.h"
31 #include "ui_CreateLayerDialogForm.h"
32 
33 // Qt
34 #include <QMessageBox>
35 
36 
38  : QDialog(parent, f),
39  m_ui(new Ui::CreateLayerDialogForm)
40 {
41  // add controls
42  m_ui->setupUi(this);
43  m_ui->m_imgLabel->setPixmap(QIcon::fromTheme("layer-new").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 
50 
51  layout->addWidget(m_createLayerWidget);
52 
53  //connects
54  connect(m_ui->m_okPushButton, SIGNAL(clicked()), this, SLOT(onOkPushButtonClicked()));
55 }
56 
58 
60 {
61  return m_createLayerWidget->getLayer();
62 }
63 
65 {
66  std::string errorMessage;
67 
68  bool res = m_createLayerWidget->createLayer(errorMessage);
69 
70  if (!res)
71  {
72  QMessageBox::warning(this, tr("Warning"), errorMessage.c_str());
73  return;
74  }
75 
76  QMessageBox::information(this, tr("Warning"), tr("Layer Created"));
77 
78  accept();
79 }
80 
81 void te::qt::widgets::CreateLayerDialog::setReferenceLayers(std::list<te::map::AbstractLayerPtr> refLayers)
82 {
84 }
This interface is used to create new layer operation.
te::qt::widgets::CreateLayerWidget * m_createLayerWidget
std::unique_ptr< Ui::CreateLayerDialogForm > m_ui
te::map::AbstractLayerPtr getLayer()
void setReferenceLayers(std::list< te::map::AbstractLayerPtr > refLayers)
bool createLayer(std::string &errorMessage)
void setReferenceLayers(std::list< te::map::AbstractLayerPtr > refLayers)
This interface is used to create new layer operation.
te::map::AbstractLayerPtr getLayer()
This interface is used to create new layer operation.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
CreateLayerDialog(QWidget *parent=0, Qt::WindowFlags f=0)