The following commit has been merged in the master branch: commit a2b80be89b1d183cfeb69bc019e6fcaddb4bb404 Author: Etienne Tourigny <etourigny....@gmail.com> Date: Fri Mar 9 12:13:00 2012 -0300
fixes for browser (GDAL rasters) : skip *.aux.xml files ; add suffix to raster file names in browser ; add HDF4 file suffix (.hdf) in buildSupportedRasterFileFilterAndExtensions() diff --git a/src/core/qgsdataitem.cpp b/src/core/qgsdataitem.cpp index f3ac63e..6cd9ed9 100644 --- a/src/core/qgsdataitem.cpp +++ b/src/core/qgsdataitem.cpp @@ -194,7 +194,8 @@ bool QgsDataItem::hasChildren() void QgsDataItem::addChildItem( QgsDataItem * child, bool refresh ) { - QgsDebugMsg( "mName = " + child->mName ); + QgsDebugMsg( QString( "add child #%1 - %2" ).arg( mChildren.size() ).arg( child->mName ) ); + int i; for ( i = 0; i < mChildren.size(); i++ ) { diff --git a/src/providers/gdal/qgsgdaldataitems.cpp b/src/providers/gdal/qgsgdaldataitems.cpp index f2901c6..146f80d 100644 --- a/src/providers/gdal/qgsgdaldataitems.cpp +++ b/src/providers/gdal/qgsgdaldataitems.cpp @@ -79,6 +79,12 @@ QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem ) QgsDebugMsg( "extensions: " + extensions.join( " " ) ); QgsDebugMsg( "wildcards: " + wildcards.join( " " ) ); } + // skip *.aux.xml files (GDAL auxilary metadata files) + // unless that extension is in the list (*.xml might be though) + if ( thePath.right( 8 ) == ".aux.xml" && + extensions.indexOf( "aux.xml" ) < 0 ) + return 0; + if ( extensions.indexOf( info.suffix().toLower() ) < 0 ) { bool matches = false; @@ -107,7 +113,8 @@ QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem ) QgsDebugMsg( "GdalDataset opened " + thePath ); - QString name = info.completeBaseName(); + //extract basename with extension + QString name = info.completeBaseName() + "." + QFileInfo( thePath ).suffix(); QString uri = thePath; QgsLayerItem * item = new QgsGdalLayerItem( parentItem, name, thePath, uri ); @@ -124,11 +131,10 @@ QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem ) if ( hChildDS ) { GDALClose( hChildDS ); - QgsDebugMsg( QString( "add child #%1 - %2" ).arg( i ).arg( sublayers[i] ) ); QString name = sublayers[i]; - name.replace( thePath, QFileInfo( thePath ).completeBaseName() ); - + //replace full path with basename+extension + name.replace( thePath, QFileInfo( thePath ).completeBaseName() + "." + QFileInfo( thePath ).suffix() ); childItem = new QgsGdalLayerItem( item, name, thePath + "/" + name, sublayers[i] ); if ( childItem ) item->addChildItem( childItem ); diff --git a/src/providers/gdal/qgsgdalprovider.cpp b/src/providers/gdal/qgsgdalprovider.cpp index a23b82f..d8f3b24 100644 --- a/src/providers/gdal/qgsgdalprovider.cpp +++ b/src/providers/gdal/qgsgdalprovider.cpp @@ -1267,7 +1267,10 @@ QStringList QgsGdalProvider::subLayers( GDALDatasetH dataset ) } } - QgsDebugMsg( "sublayers:\n " + subLayers.join( "\n " ) ); + if ( subLayers.size() > 0 ) + { + QgsDebugMsg( "sublayers:\n " + subLayers.join( "\n " ) ); + } return subLayers; } @@ -1801,6 +1804,13 @@ void buildSupportedRasterFileFilterAndExtensions( QString & theFileFiltersString theFileFiltersString += ";;[GDAL] " + myGdalDriverLongName + " (" + glob.toLower() + " " + glob.toUpper() + ")"; theWildcards << "hdr.adf"; } + else if ( myGdalDriverDescription == "HDF4" ) + { + // HDF4 extension missing in driver metadata + QString glob = "*.hdf"; + theFileFiltersString += ";;[GDAL] " + myGdalDriverLongName + " (" + glob.toLower() + " " + glob.toUpper() + ")"; + theExtensions << "hdf"; + } else { catchallFilter << QString( GDALGetDescription( myGdalDriver ) ); -- The Quantum GIS in Debian project _______________________________________________ Pkg-grass-devel mailing list Pkg-grass-devel@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-grass-devel