qt/datasource/MainWindow.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 \file MainWindow.cpp
22 
23  \brief A simple main window to show example of TerraLib Qt Datasource components.
24 */
25 
26 // Example
27 #include "MainWindow.h"
28 
29 // TerraLib
34 #include <terralib/postgis/Utils.h>
35 //#include <terralib/gdal/Utils.h>
36 //#include <terralib/ogr/Utils.h>
37 // Qt
38 #include <QAction>
39 #include <QActionGroup>
40 #include <QMessageBox>
41 #include <QStatusBar>
42 #include <QToolBar>
43 
44 // STL
45 #include <cassert>
46 
47 MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags f)
48  : QMainWindow(parent, f)
49 {
50  // Creates the tool bar
51  m_toolBar = addToolBar("Datasources");
52 
53  // Creates the status bar
54  statusBar();
55 
56  // Setups the tool actions
57  setupActions();
58 
59  // Adjusting
60  setWindowTitle(tr("TerraLib Qt DataSource Example"));
61  setMinimumSize(60, 60);
62 }
63 
65 {
66 }
67 
69 {
70  m_openGDAL = new QAction(tr("GDAL"), this);
71  m_openGDAL->setCheckable(true);
72  connect(m_openGDAL, SIGNAL(triggered()), SLOT(onOpenGDALTriggered()));
73 
74  m_openOGR = new QAction(tr("OGR"), this);
75  m_openOGR->setCheckable(true);
76  connect(m_openOGR, SIGNAL(triggered()), SLOT(onOpenOGRTriggered()));
77 
78  m_openPostGIS = new QAction(tr("POSTGIS"), this);
79  m_openPostGIS->setCheckable(true);
80  connect(m_openPostGIS, SIGNAL(triggered()), SLOT(onOpenPostGISTriggered()));
81 
82 
83  m_toolBar->addAction(m_openGDAL);
84  m_toolBar->addAction(m_openOGR);
85  m_toolBar->addAction(m_openPostGIS);
86 
87  QActionGroup* toolsGroup = new QActionGroup(this);
88  toolsGroup->addAction(m_openGDAL);
89  toolsGroup->addAction(m_openOGR);
90  toolsGroup->addAction(m_openPostGIS);
91 }
92 
93 
95 {
97 
98  if (pgisDialog->exec() == QDialog::Accepted)
99  {
100  // std::string connstr = te::pgis::MakeConnectionStr(pgisDialog->getDriver()->getConnectionInfo());
101  // QMessageBox msgBox;
102  // QString mess = QString("DS Connection string: %1").arg(connstr.c_str());
103 
104  // msgBox.setText(mess);
105  // msgBox.exec();
106 
107  }
108 }
109 
111 {
113 
114  if (ogrDialog->exec() == QDialog::Accepted)
115  {
116  //std::string conStr = te::ogr::GetOGRConnectionInfo(ogrDialog->getDriver()->getConnectionInfo());
117  //QMessageBox msgBox;
118  //QString mess = QString("DS Connection string: %1").arg(conStr.c_str());
119  //msgBox.setText(mess);
120  //msgBox.exec();
121  }
122 }
123 
125 {
127 
128  if (gdalDialog->exec() == QDialog::Accepted)
129  {
130  //std::string connstr = te::gdal::GetGDALConnectionInfo(gdalDialog->getDriver()->getConnectionInfo());
131  //QMessageBox msgBox;
132  //QString mess = QString("DS Connection string: %1").arg(connstr.c_str());
133  //msgBox.setText(mess);
134  //msgBox.exec();
135  }
136 }
An abstract class for data providers like a DBMS, Web Services or a regular file. ...
Utility functions for PostgreSQL.
A dialog window for showing the GDAL connector widget.
MainWindow(QWidget *parent=0)
Constructor.
A dialog window for showing the OGR connector widget.
A dialog window for showing the OGR connector widget.
A dialog window for showing the GDAL connector widget.
A dialog window for showing the PostGIS connector widget.
A dialog window for showing the PostGIS connector widget.