Skip to content

Commit

Permalink
Dont artificially limit the raster types available. Note if you have …
Browse files Browse the repository at this point in the history
…a lot of gdal file types supported the file filter is very long. We need to find a sensible way to manage that.

git-svn-id: http://svn.osgeo.org/qgis/trunk@8462 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed May 19, 2008
1 parent 9522dd4 commit 172c20e
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 74 deletions.
1 change: 0 additions & 1 deletion python/core/qgsrasterlayer.sip
Expand Up @@ -19,7 +19,6 @@ public:
// Static methods:
//
static void buildSupportedRasterFileFilter(QString & fileFilters);
static bool isSupportedRasterDriver(const QString & driverName);
static void registerGdalDrivers();

/** This helper checks to see whether the filename appears to be a valid
Expand Down
73 changes: 1 addition & 72 deletions src/core/raster/qgsrasterlayer.cpp
Expand Up @@ -75,44 +75,13 @@ email : tim at linfiniti.com
// Static Methods and members first....
//
/////////////////////////////////////////////////////////
/**
Static member variable storing the subset of GDAL formats
that we currently support.
@note
Some day this won't be necessary as there'll be a time when
theoretically we'll support everything that GDAL can throw at us.
These are GDAL driver description strings.
*/
static const char *const mSupportedRasterFormats[] =
{
"AAIGrid",
"AIG",
"DTED",
"ECW",
"GRASS",
"GTiff",
"HFA",
"JP2ECW",
"JP2KAK",
"JP2MrSID",
"JPEG2000",
"MrSID",
"SDTS",
"USGSDEM",
"" // used to indicate end of list
};


/**
Builds the list of file filter strings to later be used by
QgisApp::addRasterLayer()
We query GDAL for a list of supported raster formats; we then build
a list of file filter strings from that list. We return a string
that contains this list that is suitable for use in a a
that contains this list that is suitable for use in a
QFileDialog::getOpenFileNames() call.
*/
Expand Down Expand Up @@ -166,12 +135,6 @@ void QgsRasterLayer::buildSupportedRasterFileFilter(QString & theFileFiltersStri

myGdalDriverDescription = GDALGetDescription(myGdalDriver);

if (!isSupportedRasterDriver(myGdalDriverDescription))
{
// not supported, therefore skip
QgsDebugMsg("skipping unsupported driver " + QString(GDALGetDescription(myGdalDriver)));
continue;
}
// std::cerr << "got driver string " << myGdalDriver->GetDescription() << "\n";

myGdalDriverMetadata = GDALGetMetadata(myGdalDriver,NULL);
Expand Down Expand Up @@ -290,39 +253,6 @@ void QgsRasterLayer::registerGdalDrivers()
GDALAllRegister();
}

/**
returns true if the given raster driver name is one currently
supported, otherwise it returns false
@param theDriverName GDAL driver description string
*/
bool QgsRasterLayer::isSupportedRasterDriver(QString const &theDriverName)
{
size_t i = 0;

while (mSupportedRasterFormats[i][0]) // while not end of string list
{
// If we've got a case-insensitive match for a GDAL aware driver
// description, then we've got a match. Why case-insensitive?
// I'm just being paranoid in that I can envision a situation
// whereby GDAL slightly changes driver description string case,
// in which case we'd catch it here. Not that that would likely
// happen, but if it does, we'll already compensate.
// GS - At Qt 3.1.2, the case sensitive argument. So we change the
// driverName to lower case before testing
QString format = mSupportedRasterFormats[i];
if (theDriverName.lower().startsWith(format.lower()))
{
return true;
}

i++;
}

return false;
} // isSupportedRasterDriver



/** This helper checks to see whether the filename appears to be a valid raster file name */
bool QgsRasterLayer::isValidRasterFileName(QString const & theFileNameQString)
Expand Down Expand Up @@ -377,7 +307,6 @@ QgsRasterLayer::QgsRasterLayer(
QString const & baseName,
bool loadDefaultStyleFlag)
: QgsMapLayer(RASTER, baseName, path),
// XXX where is this? popMenu(0), //popMenu is the contextmenu obtained by right clicking on the legend
mRasterXDim( std::numeric_limits<int>::max() ),
mRasterYDim( std::numeric_limits<int>::max() ),
mDebugOverlayFlag(false),
Expand Down
1 change: 0 additions & 1 deletion src/core/raster/qgsrasterlayer.h
Expand Up @@ -186,7 +186,6 @@ class CORE_EXPORT QgsRasterLayer : public QgsMapLayer
// Static methods:
//
static void buildSupportedRasterFileFilter(QString & fileFilters);
static bool isSupportedRasterDriver(const QString & driverName);
static void registerGdalDrivers();

/** This helper checks to see whether the filename appears to be a valid
Expand Down

0 comments on commit 172c20e

Please sign in to comment.