Skip to content
Permalink
Browse files

fix browser handling of auxiliary metadata files (*.shp.xml and *.tif…

….xml) (#10697)
  • Loading branch information
etiennesky committed Jun 24, 2014
1 parent 1949fd7 commit b261f57d0629851d6017b8973a5d637ea9e199b2
@@ -551,8 +551,11 @@ void QgsBrowserDockWidget::showProperties( )
QgsRasterLayer* layer = new QgsRasterLayer( layerItem->uri(), layerItem->uri(), layerItem->providerKey() );
if ( layer != NULL )
{
layerCrs = layer->crs();
layerMetadata = layer->metadata();
if ( layer->isValid() )
{
layerCrs = layer->crs();
layerMetadata = layer->metadata();
}
delete layer;
}
}
@@ -562,8 +565,11 @@ void QgsBrowserDockWidget::showProperties( )
QgsVectorLayer* layer = new QgsVectorLayer( layerItem->uri(), layerItem->name(), layerItem->providerKey() );
if ( layer != NULL )
{
layerCrs = layer->crs();
layerMetadata = layer->metadata();
if ( layer->isValid() )
{
layerCrs = layer->crs();
layerMetadata = layer->metadata();
}
delete layer;
}
}
@@ -191,11 +191,18 @@ QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem )
QgsDebugMsgLevel( "wildcards: " + wildcards.join( " " ), 2 );
}

// skip *.aux.xml files (GDAL auxilary metadata files)
// skip *.aux.xml files (GDAL auxilary metadata files),
// *.shp.xml files (ESRI metadata) and *.tif.xml files (TIFF metadata)
// unless that extension is in the list (*.xml might be though)
if ( thePath.endsWith( ".aux.xml", Qt::CaseInsensitive ) &&
!extensions.contains( "aux.xml" ) )
return 0;
if ( thePath.endsWith( ".shp.xml", Qt::CaseInsensitive ) &&
!extensions.contains( "shp.xml" ) )
return 0;
if ( thePath.endsWith( ".tif.xml", Qt::CaseInsensitive ) &&
!extensions.contains( "tif.xml" ) )
return 0;

// Filter files by extension
if ( !extensions.contains( suffix ) )
@@ -280,14 +280,18 @@ QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem )

QStringList myExtensions = fileExtensions();

// skip *.aux.xml files (GDAL auxilary metadata files) and .shp.xml files (ESRI metadata)
// skip *.aux.xml files (GDAL auxilary metadata files),
// *.shp.xml files (ESRI metadata) and *.tif.xml files (TIFF metadata)
// unless that extension is in the list (*.xml might be though)
if ( thePath.endsWith( ".aux.xml", Qt::CaseInsensitive ) &&
!myExtensions.contains( "aux.xml" ) )
return 0;
if ( thePath.endsWith( ".shp.xml", Qt::CaseInsensitive ) &&
!myExtensions.contains( "shp.xml" ) )
return 0;
if ( thePath.endsWith( ".tif.xml", Qt::CaseInsensitive ) &&
!myExtensions.contains( "tif.xml" ) )
return 0;

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

0 comments on commit b261f57

Please sign in to comment.
You can’t perform that action at this time.