This commit is contained in:
Juergen E. Fischer 2012-12-29 22:16:48 +01:00
parent e2f7adf2fb
commit ce6aab704f
5 changed files with 20 additions and 14 deletions

View File

@ -139,6 +139,10 @@ class Dialog( QDialog, Ui_Dialog ):
baseDir = self.leInputDir.text()
# look for shapes with specified geometry type
self.inputFiles = ftools_utils.getShapesByGeometryType( baseDir, self.inputFiles, self.cmbGeometry.currentIndex() )
if self.inputFiles is None:
QMessageBox.warning( self, self.tr( "No shapefiles found" ),
self.tr( "There are no shapefiles with the given geometry type. Please select an available geometry type." ) )
return
self.progressFiles.setRange( 0, self.inputFiles.count() )
outFile = QFile( self.outFileName )

View File

@ -344,12 +344,12 @@ static QgsMessageOutput *messageOutputViewer_()
return new QgsMessageOutputConsole();
}
static void customSrsValidation_( QgsCoordinateReferenceSystem* srs )
static void customSrsValidation_( QgsCoordinateReferenceSystem &srs )
{
QgisApp::instance()->emitCustomSrsValidation( srs );
}
void QgisApp::emitCustomSrsValidation( QgsCoordinateReferenceSystem* srs )
void QgisApp::emitCustomSrsValidation( QgsCoordinateReferenceSystem &srs )
{
emit customSrsValidation( srs );
}
@ -361,7 +361,7 @@ void QgisApp::emitCustomSrsValidation( QgsCoordinateReferenceSystem* srs )
* - use project's CRS
* - use predefined global CRS
*/
void QgisApp::validateSrs( QgsCoordinateReferenceSystem* srs )
void QgisApp::validateSrs( QgsCoordinateReferenceSystem &srs )
{
static QString authid = QString::null;
QSettings mySettings;
@ -372,9 +372,10 @@ void QgisApp::validateSrs( QgsCoordinateReferenceSystem* srs )
//it in the ctor of the layer projection selector
QgsGenericProjectionSelector *mySelector = new QgsGenericProjectionSelector();
mySelector->setMessage( srs->validationHint() ); //shows a generic message, if not specified
mySelector->setMessage( srs.validationHint() ); //shows a generic message, if not specified
if ( authid.isNull() )
authid = QgisApp::instance()->mapCanvas()->mapRenderer()->destinationCrs().authid();
QgsCoordinateReferenceSystem defaultCrs;
if ( defaultCrs.createFromOgcWmsCrs( authid ) )
{
@ -389,7 +390,7 @@ void QgisApp::validateSrs( QgsCoordinateReferenceSystem* srs )
{
QgsDebugMsg( "Layer srs set from dialog: " + QString::number( mySelector->selectedCrsId() ) );
authid = mySelector->selectedAuthId();
srs->createFromOgcWmsCrs( mySelector->selectedAuthId() );
srs.createFromOgcWmsCrs( mySelector->selectedAuthId() );
}
//QApplication::restoreOverrideCursor();
@ -402,12 +403,12 @@ void QgisApp::validateSrs( QgsCoordinateReferenceSystem* srs )
authid = QgisApp::instance()->mapCanvas()->mapRenderer()->destinationCrs().authid();
QgsDebugMsg( "Layer srs set from project: " + authid );
QgisApp::instance()->statusBar()->showMessage( QObject::tr( "CRS undefined - defaulting to project CRS" ) );
srs->createFromOgcWmsCrs( authid );
srs.createFromOgcWmsCrs( authid );
}
else ///Projections/defaultBehaviour==useGlobal
{
authid = mySettings.value( "/Projections/layerDefaultCrs", GEO_EPSG_CRS_AUTHID ).toString();
srs->createFromOgcWmsCrs( authid );
srs.createFromOgcWmsCrs( authid );
QgisApp::instance()->statusBar()->showMessage( QObject::tr( "CRS undefined - defaulting to default CRS: %1" ).arg( authid ) );
}
}
@ -566,8 +567,8 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
QgsMessageLog::logMessage( tr( "QGIS starting..." ) );
// set QGIS specific srs validation
connect( this, SIGNAL( customSrsValidation( QgsCoordinateReferenceSystem * ) ),
this, SLOT( validateSrs( QgsCoordinateReferenceSystem * ) ) );
connect( this, SIGNAL( customSrsValidation( QgsCoordinateReferenceSystem& ) ),
this, SLOT( validateSrs( QgsCoordinateReferenceSystem& ) ) );
QgsCoordinateReferenceSystem::setCustomSrsValidation( customSrsValidation_ );
// set graphical message output
@ -7020,6 +7021,7 @@ void QgisApp::markDirty()
// notify the project that there was a change
QgsProject::instance()->dirty( true );
}
//changed from layerWasAdded to layersWereAdded in 1.8
void QgisApp::layersWereAdded( QList<QgsMapLayer *> theLayers )
{

View File

@ -404,7 +404,7 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
//! @note added in 1.6
void completeInitialization();
void emitCustomSrsValidation( QgsCoordinateReferenceSystem *crs );
void emitCustomSrsValidation( QgsCoordinateReferenceSystem &crs );
QList<QgsDecorationItem*> decorationItems() { return mDecorationItems; }
void addDecorationItem( QgsDecorationItem* item ) { mDecorationItems.append( item ); }
@ -533,7 +533,7 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
private slots:
//! validate a SRS
void validateSrs( QgsCoordinateReferenceSystem *crs );
void validateSrs( QgsCoordinateReferenceSystem &crs );
//! QGis Sponsors
void sponsors();
@ -1008,7 +1008,7 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
@note added in version 1.6*/
void initializationCompleted();
void customSrsValidation( QgsCoordinateReferenceSystem *crs );
void customSrsValidation( QgsCoordinateReferenceSystem &crs );
private:
/** This method will open a dialog so the user can select GDAL sublayers to load

View File

@ -283,7 +283,7 @@ void QgsCoordinateReferenceSystem::validate()
// try to validate using custom validation routines
if ( mCustomSrsValidation )
mCustomSrsValidation( this );
mCustomSrsValidation( *this );
if ( !mIsValidFlag )
{

View File

@ -42,7 +42,7 @@ typedef void *OGRSpatialReferenceH;
#endif
class QgsCoordinateReferenceSystem;
typedef void ( *CUSTOM_CRS_VALIDATION )( QgsCoordinateReferenceSystem* );
typedef void ( *CUSTOM_CRS_VALIDATION )( QgsCoordinateReferenceSystem& );
/** \ingroup core
* Class for storing a coordinate reference system (CRS)