Quantum GIS API Documentation  1.7.5-Wroclaw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
qgsgenericprojectionselector.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsgenericprojectionselector.cpp
3  Set user defined CRS using projection selector widget
4  -------------------
5  begin : May 28, 2004
6  copyright : (C) 2004 by Gary E.Sherman
7  email : sherman at mrcc.com
8  ***************************************************************************/
9 
10 /***************************************************************************
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * *
17  ***************************************************************************/
18 /* $Id$ */
20 #include <QApplication>
21 
27  Qt::WFlags fl )
28  : QDialog( parent, fl )
29 {
30  setupUi( this );
31  //we will show this only when a message is set
32  textEdit->hide();
33 }
34 
35 void QgsGenericProjectionSelector::setMessage( QString theMessage )
36 {
37  //short term kludge to make the layer selector default to showing
38  //a layer projection selection message. If you want the selector
39  if ( theMessage.isEmpty() )
40  {
41  // Set up text edit pane
42  QString format( "<h2>%1</h2>%2 %3" );
43  QString header = tr( "Define this layer's coordinate reference system:" );
44  QString sentence1 = tr( "This layer appears to have no projection specification." );
45  QString sentence2 = tr( "By default, this layer will now have its projection set to that of the project, "
46  "but you may override this by selecting a different projection below." );
47  textEdit->setHtml( format.arg( header ).arg( sentence1 )
48  .arg( sentence2 ) );
49  }
50  else
51  {
52  textEdit->setHtml( theMessage );
53  }
54  textEdit->show();
55 
56 }
59 {}
60 
62 {
63  projectionSelector->setSelectedAuthId( QString( "EPSG:%1" ).arg( theId ) );
64 }
65 
67 {
68  projectionSelector->setSelectedCrsName( theName );
69 }
70 
72 {
73  projectionSelector->setSelectedCrsId( theID );
74 }
75 
77 {
78  projectionSelector->setSelectedAuthId( theID );
79 }
80 
82 {
83  //@note don't use getSelectedWkt as that just returns the name part!
84  return projectionSelector->selectedProj4String();
85 }
86 
88 {
89  //@note don't use getSelectedWkt as that just returns the name part!
90  return projectionSelector->selectedCrsId();
91 }
92 
94 {
95  QString authid = projectionSelector->selectedAuthId();
96  if ( authid.startsWith( "EPSG:", Qt::CaseInsensitive ) )
97  return authid.mid( 5 ).toLong();
98  else
99  return 0;
100 }
101 
103 {
104  return projectionSelector->selectedAuthId();
105 }
106 
108 {
109  projectionSelector->setOgcWmsCrsFilter( crsFilter );
110 }