00001 /*************************************************************************** 00002 qgsgenericprojectionselector.cpp 00003 Set user defined CRS using projection selector widget 00004 ------------------- 00005 begin : May 28, 2004 00006 copyright : (C) 2004 by Gary E.Sherman 00007 email : sherman at mrcc.com 00008 ***************************************************************************/ 00009 00010 /*************************************************************************** 00011 * * 00012 * This program is free software; you can redistribute it and/or modify * 00013 * it under the terms of the GNU General Public License as published by * 00014 * the Free Software Foundation; either version 2 of the License, or * 00015 * (at your option) any later version. * 00016 * * 00017 ***************************************************************************/ 00018 /* $Id$ */ 00019 #include <qgsgenericprojectionselector.h> 00020 #include <QApplication> 00021 00026 QgsGenericProjectionSelector::QgsGenericProjectionSelector( QWidget *parent, 00027 Qt::WFlags fl ) 00028 : QDialog( parent, fl ) 00029 { 00030 setupUi( this ); 00031 //we will show this only when a message is set 00032 textEdit->hide(); 00033 } 00034 00035 void QgsGenericProjectionSelector::setMessage( QString theMessage ) 00036 { 00037 //short term kludge to make the layer selector default to showing 00038 //a layer projection selection message. If you want the selector 00039 if ( theMessage.isEmpty() ) 00040 { 00041 // Set up text edit pane 00042 QString format( "<h2>%1</h2>%2 %3" ); 00043 QString header = tr( "Define this layer's coordinate reference system:" ); 00044 QString sentence1 = tr( "This layer appears to have no projection specification." ); 00045 QString sentence2 = tr( "By default, this layer will now have its projection set to that of the project, " 00046 "but you may override this by selecting a different projection below." ); 00047 textEdit->setHtml( format.arg( header ).arg( sentence1 ) 00048 .arg( sentence2 ) ); 00049 } 00050 else 00051 { 00052 textEdit->setHtml( theMessage ); 00053 } 00054 textEdit->show(); 00055 00056 } 00058 QgsGenericProjectionSelector::~QgsGenericProjectionSelector() 00059 {} 00060 00061 void QgsGenericProjectionSelector::setSelectedEpsg( long theId ) 00062 { 00063 projectionSelector->setSelectedEpsg( theId ); 00064 } 00065 00066 void QgsGenericProjectionSelector::setSelectedCrsName( QString theName ) 00067 { 00068 projectionSelector->setSelectedCrsName( theName ); 00069 } 00070 00071 void QgsGenericProjectionSelector::setSelectedCrsId( long theID ) 00072 { 00073 projectionSelector->setSelectedCrsId( theID ); 00074 } 00075 00076 void QgsGenericProjectionSelector::setSelectedAuthId( QString theID ) 00077 { 00078 projectionSelector->setSelectedAuthId( theID ); 00079 } 00080 00081 QString QgsGenericProjectionSelector::selectedProj4String() 00082 { 00083 //@note don't use getSelectedWkt as that just returns the name part! 00084 return projectionSelector->selectedProj4String(); 00085 } 00086 00087 long QgsGenericProjectionSelector::selectedCrsId() 00088 { 00089 //@note don't use getSelectedWkt as that just returns the name part! 00090 return projectionSelector->selectedCrsId(); 00091 } 00092 00093 long QgsGenericProjectionSelector::selectedEpsg() 00094 { 00095 return projectionSelector->selectedEpsg(); 00096 } 00097 00098 QString QgsGenericProjectionSelector::selectedAuthId() 00099 { 00100 return projectionSelector->selectedAuthId(); 00101 } 00102 00103 void QgsGenericProjectionSelector::setOgcWmsCrsFilter( QSet<QString> crsFilter ) 00104 { 00105 projectionSelector->setOgcWmsCrsFilter( crsFilter ); 00106 }