From 63c283ad032c68865d3de6db5cb7ce34a572fe48 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 29 Aug 2007 11:51:22 +0000 Subject: [PATCH] Added support for post fixing filenames with .gdal to force use of gdal plugin. --- src/osgPlugins/gdal/CMakeLists.txt | 1 + src/osgPlugins/gdal/ReaderWriterGDAL.cpp | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/osgPlugins/gdal/CMakeLists.txt b/src/osgPlugins/gdal/CMakeLists.txt index e3abf527b..73947a1bd 100644 --- a/src/osgPlugins/gdal/CMakeLists.txt +++ b/src/osgPlugins/gdal/CMakeLists.txt @@ -10,6 +10,7 @@ SET(TARGET_H ) SET(TARGET_LIBRARIES_VARS GDAL_LIBRARY ) +SET(TARGET_ADDED_LIBRARIES osgTerrain ) #### end var setup ### SETUP_PLUGIN(gdal) diff --git a/src/osgPlugins/gdal/ReaderWriterGDAL.cpp b/src/osgPlugins/gdal/ReaderWriterGDAL.cpp index 81fd34e0b..26c22a4a5 100644 --- a/src/osgPlugins/gdal/ReaderWriterGDAL.cpp +++ b/src/osgPlugins/gdal/ReaderWriterGDAL.cpp @@ -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 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 lock(_serializerMutex); return const_cast(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 lock(_serializerMutex); return const_cast(this)->local_readHeightField(fileName, options); }