examples/qt/srs/main.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 main.cpp
22 
23  \brief A list of examples for the TerraLib Widgets.
24  */
25 
26 #include "Config.h"
27 
28 // TerraLib
29 #include <terralib/common.h>
30 #include <terralib/srs.h>
31 
33 
34 // QT
35 #include <QApplication>
36 #include <qmessagebox.h>
37 
38 // STL
39 #include <exception>
40 #include <iostream>
41 
42 void SRSManagerDialogExample( int argc, char** argv )
43 {
44  QApplication app(argc,argv);
45 
46  std::pair<int, std::string> srid = te::qt::widgets::SRSManagerDialog::getSRS(0);
47  QMessageBox msgBox;
48  QString mess = QString("1) SRId: %1, Authority: %2").arg(srid.first).arg(srid.second.c_str());
49  msgBox.setText(mess);
50  msgBox.exec();
51 
53 
54  while (srsManDialog->exec() == QDialog::Accepted)
55  {
56  const std::pair<int, std::string>& srid = srsManDialog->getSelectedSRS();
57  QMessageBox msgBox;
58  QString mess = QString("2) SRId: %1, Authority: %2").arg(srid.first).arg(srid.second.c_str());
59  msgBox.setText(mess);
60  msgBox.exec();
61  }
62 
63  app.exec();
64 
65  // Getting the result
66 
67  //...
68 }
69 
70 
71 int main(int argc, char** argv)
72 {
73  try
74  {
75  // initialize Terralib support
77 
78  SRSManagerDialogExample(argc, argv);
79 
81 
82  }
83  catch(const std::exception& e)
84  {
85  std::cout << std::endl << "An exception has occurred: " << e.what() << std::endl;
86 
87  return EXIT_FAILURE;
88  }
89  catch(...)
90  {
91  std::cout << std::endl << "An unexpected exception has occurred!" << std::endl;
92 
93  return EXIT_FAILURE;
94  }
95  return EXIT_SUCCESS;
96 }
This file contains include headers for TerraLib Spatial Reference System module.
int main(int argc, char **argv)
void finalize()
It finalizes the TerraLib Platform.
static TerraLib & getInstance()
It returns a reference to the singleton instance.
void SRSManagerDialogExample(int argc, char **argv)
void initialize()
It initializes the TerraLib Platform.
This file contains include headers for the TerraLib Common Runtime module.
A dialog used to build a SRSManagerDialog element.
const std::pair< int, std::string > & getSelectedSRS() const
Returns the selected SRS in the window.
static std::pair< int, std::string > getSRS(QWidget *parent, const QString &title="")
Pops up a modal SRS selector dialog with the given window title, lets the user select a SRS...