Skip to content

Commit

Permalink
fix buildSupportedRasterFileFilter for sip api v2
Browse files Browse the repository at this point in the history
  • Loading branch information
etiennesky committed Jun 4, 2013
1 parent ae3abcc commit 097536c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions python/core/raster/qgsrasterlayer.sip
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class QgsRasterLayer : QgsMapLayer
// Static methods:
//
static void buildSupportedRasterFileFilter( QString & fileFilters );
static QString buildSupportedRasterFileFilter2(); /* for sip api v2 */

/** This helper checks to see whether the file name appears to be a valid
* raster file name. If the file name looks like it could be valid,
Expand Down
3 changes: 1 addition & 2 deletions python/plugins/GdalTools/tools/GdalTools_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,8 +429,7 @@ def setFilter(self, typeName, aFilter):
@classmethod
def allRastersFilter(self):
if self.rastersFilter == '':
# TODO fix this, does not work
QgsRasterLayer.buildSupportedRasterFileFilter(self.rastersFilter)
self.rastersFilter = QgsRasterLayer.buildSupportedRasterFileFilter2()

# workaround for QGis < 1.5 (see #2376)
# removed as this is a core plugin QGis >= 1.9
Expand Down
9 changes: 8 additions & 1 deletion src/core/raster/qgsrasterlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,20 @@ void QgsRasterLayer::buildSupportedRasterFileFilter( QString & theFileFiltersStr
buildsupportedrasterfilefilter_t *pBuild = ( buildsupportedrasterfilefilter_t * ) cast_to_fptr( QgsProviderRegistry::instance()->function( "gdal", "buildSupportedRasterFileFilter" ) );
if ( ! pBuild )
{
QgsDebugMsg( "Could get buildSupportedRasterFileFilter in gdal provider library" );
QgsDebugMsg( "Could not get buildSupportedRasterFileFilter in gdal provider library" );
return;
}

pBuild( theFileFiltersString );
}

QString QgsRasterLayer::buildSupportedRasterFileFilter2( )

This comment has been minimized.

Copy link
@brushtyler

brushtyler Jun 5, 2013

Contributor

Why do not put it into the QgsProviderRegistry class, like the fileVectorFilters()?
It is difficult to find similar things in completely different classes...

Anyway, if QgsRasterLayer is the right place where to put it, why do not keep the old name i.e. buildSupportedRasterFileFilter or, better, rename it according to the fileVectorFilter method?

This comment has been minimized.

Copy link
@etiennesky

etiennesky Jun 14, 2013

Author Contributor

I was trying to be as little invasive as possible... these methods need some improvement IMHO but I'm not sure we can do this now with feature freeze.
I could add a function QgsProviderRegistry::fileRasterFilter if you like. feature freeze probably doesn't mean api freeze right?

I didn't keep the old name because the signature is different.

This comment has been minimized.

Copy link
@etiennesky

etiennesky Jun 14, 2013

Author Contributor

I am cleaning this up and will set buildSupportedRasterFileFilter as deprecated for now

This comment has been minimized.

Copy link
@etiennesky

etiennesky Jun 14, 2013

Author Contributor

just commited 7cceaaf "replace QgsRasterLayer::buildSupportedRasterFileFilter() with QgsProviderRegistry::instance()->fileRasterFilters()"

{
QString theFileFiltersString;
buildSupportedRasterFileFilter( theFileFiltersString );
return theFileFiltersString;
}

/**
* This helper checks to see whether the file name appears to be a valid raster file name
*/
Expand Down
1 change: 1 addition & 0 deletions src/core/raster/qgsrasterlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ class CORE_EXPORT QgsRasterLayer : public QgsMapLayer
};

static void buildSupportedRasterFileFilter( QString & fileFilters );
static QString buildSupportedRasterFileFilter2(); /* for sip api v2 */

/** This helper checks to see whether the file name appears to be a valid
* raster file name. If the file name looks like it could be valid,
Expand Down

0 comments on commit 097536c

Please sign in to comment.