Skip to content
Permalink
Browse files

fix buildSupportedRasterFileFilter for sip api v2

  • Loading branch information
etiennesky committed Jun 4, 2013
1 parent ae3abcc commit 097536c30c8ea24898e2c26f18406dc8260fd838
@@ -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,
@@ -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
@@ -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
*/
@@ -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,

0 comments on commit 097536c

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