Added support for post fixing filenames with .gdal to force use of gdal plugin.

This commit is contained in:
Robert Osfield
2007-08-29 11:51:22 +00:00
parent 71e7a65cca
commit 63c283ad03
2 changed files with 16 additions and 0 deletions

View File

@@ -10,6 +10,7 @@ SET(TARGET_H
)
SET(TARGET_LIBRARIES_VARS GDAL_LIBRARY )
SET(TARGET_ADDED_LIBRARIES osgTerrain )
#### end var setup ###
SETUP_PLUGIN(gdal)

View File

@@ -39,6 +39,11 @@ class ReaderWriterGDAL : public osgDB::ReaderWriter
virtual ReadResult readObject(const std::string& file, const osgDB::ReaderWriter::Options* options) const
{
if (osgDB::equalCaseInsensitive(osgDB::getFileExtension(file),"gdal"))
{
return readObject(osgDB::getNameLessExtension(file),options);
}
OpenThreads::ScopedLock<OpenThreads::ReentrantMutex> lock(_serializerMutex);
osg::notify(osg::NOTICE) << "GDALPlugin : " << file << std::endl;
@@ -58,12 +63,22 @@ class ReaderWriterGDAL : public osgDB::ReaderWriter
virtual ReadResult readImage(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const
{
if (osgDB::equalCaseInsensitive(osgDB::getFileExtension(fileName),"gdal"))
{
return readImage(osgDB::getNameLessExtension(fileName),options);
}
OpenThreads::ScopedLock<OpenThreads::ReentrantMutex> lock(_serializerMutex);
return const_cast<ReaderWriterGDAL*>(this)->local_readImage(fileName, options);
}
virtual ReadResult readHeightField(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const
{
if (osgDB::equalCaseInsensitive(osgDB::getFileExtension(fileName),"gdal"))
{
return readHeightField(osgDB::getNameLessExtension(fileName),options);
}
OpenThreads::ScopedLock<OpenThreads::ReentrantMutex> lock(_serializerMutex);
return const_cast<ReaderWriterGDAL*>(this)->local_readHeightField(fileName, options);
}