Skip to content

Commit b261f57

Browse files
committedJun 24, 2014
fix browser handling of auxiliary metadata files (*.shp.xml and *.tif.xml) (#10697)
1 parent 1949fd7 commit b261f57

File tree

3 files changed

+23
-6
lines changed

3 files changed

+23
-6
lines changed
 

‎src/app/qgsbrowserdockwidget.cpp

+10-4
Original file line numberDiff line numberDiff line change
@@ -551,8 +551,11 @@ void QgsBrowserDockWidget::showProperties( )
551551
QgsRasterLayer* layer = new QgsRasterLayer( layerItem->uri(), layerItem->uri(), layerItem->providerKey() );
552552
if ( layer != NULL )
553553
{
554-
layerCrs = layer->crs();
555-
layerMetadata = layer->metadata();
554+
if ( layer->isValid() )
555+
{
556+
layerCrs = layer->crs();
557+
layerMetadata = layer->metadata();
558+
}
556559
delete layer;
557560
}
558561
}
@@ -562,8 +565,11 @@ void QgsBrowserDockWidget::showProperties( )
562565
QgsVectorLayer* layer = new QgsVectorLayer( layerItem->uri(), layerItem->name(), layerItem->providerKey() );
563566
if ( layer != NULL )
564567
{
565-
layerCrs = layer->crs();
566-
layerMetadata = layer->metadata();
568+
if ( layer->isValid() )
569+
{
570+
layerCrs = layer->crs();
571+
layerMetadata = layer->metadata();
572+
}
567573
delete layer;
568574
}
569575
}

‎src/providers/gdal/qgsgdaldataitems.cpp

+8-1
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,18 @@ QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem )
191191
QgsDebugMsgLevel( "wildcards: " + wildcards.join( " " ), 2 );
192192
}
193193

194-
// skip *.aux.xml files (GDAL auxilary metadata files)
194+
// skip *.aux.xml files (GDAL auxilary metadata files),
195+
// *.shp.xml files (ESRI metadata) and *.tif.xml files (TIFF metadata)
195196
// unless that extension is in the list (*.xml might be though)
196197
if ( thePath.endsWith( ".aux.xml", Qt::CaseInsensitive ) &&
197198
!extensions.contains( "aux.xml" ) )
198199
return 0;
200+
if ( thePath.endsWith( ".shp.xml", Qt::CaseInsensitive ) &&
201+
!extensions.contains( "shp.xml" ) )
202+
return 0;
203+
if ( thePath.endsWith( ".tif.xml", Qt::CaseInsensitive ) &&
204+
!extensions.contains( "tif.xml" ) )
205+
return 0;
199206

200207
// Filter files by extension
201208
if ( !extensions.contains( suffix ) )

‎src/providers/ogr/qgsogrdataitems.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -280,14 +280,18 @@ QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem )
280280

281281
QStringList myExtensions = fileExtensions();
282282

283-
// skip *.aux.xml files (GDAL auxilary metadata files) and .shp.xml files (ESRI metadata)
283+
// skip *.aux.xml files (GDAL auxilary metadata files),
284+
// *.shp.xml files (ESRI metadata) and *.tif.xml files (TIFF metadata)
284285
// unless that extension is in the list (*.xml might be though)
285286
if ( thePath.endsWith( ".aux.xml", Qt::CaseInsensitive ) &&
286287
!myExtensions.contains( "aux.xml" ) )
287288
return 0;
288289
if ( thePath.endsWith( ".shp.xml", Qt::CaseInsensitive ) &&
289290
!myExtensions.contains( "shp.xml" ) )
290291
return 0;
292+
if ( thePath.endsWith( ".tif.xml", Qt::CaseInsensitive ) &&
293+
!myExtensions.contains( "tif.xml" ) )
294+
return 0;
291295

292296
// We have to filter by extensions, otherwise e.g. all Shapefile files are displayed
293297
// because OGR drive can open also .dbf, .shx.

0 commit comments

Comments
 (0)
Please sign in to comment.