Added preliminary ProxLayer and DataSetLayer in GDAL plugin to aid integration

of GDAL reading into osgTerrain.
This commit is contained in:
Robert Osfield
2007-08-29 10:52:03 +00:00
parent f6650dd3bf
commit 71e7a65cca
5 changed files with 149 additions and 2 deletions

View File

@@ -13,6 +13,8 @@
#include <gdal_priv.h>
#include "DataSetLayer.h"
#define SERIALIZER() OpenThreads::ScopedLock<OpenThreads::ReentrantMutex> lock(_serializerMutex)
// From easyrgb.com
@@ -35,6 +37,25 @@ class ReaderWriterGDAL : public osgDB::ReaderWriter
return osgDB::equalCaseInsensitive(extension,"gdal") || osgDB::equalCaseInsensitive(extension,"gdal");
}
virtual ReadResult readObject(const std::string& file, const osgDB::ReaderWriter::Options* options) const
{
OpenThreads::ScopedLock<OpenThreads::ReentrantMutex> lock(_serializerMutex);
osg::notify(osg::NOTICE) << "GDALPlugin : " << file << std::endl;
std::string fileName = osgDB::findDataFile( file, options );
if (fileName.empty()) return ReadResult::FILE_NOT_FOUND;
initGDAL();
// open a DataSetLayer.
osg::ref_ptr<GDALPlugin::DataSetLayer> dataset = new GDALPlugin::DataSetLayer;
if (dataset->valid()) return dataset.release();
return ReadResult::FILE_NOT_HANDLED;
}
virtual ReadResult readImage(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const
{
OpenThreads::ScopedLock<OpenThreads::ReentrantMutex> lock(_serializerMutex);
@@ -721,7 +742,7 @@ class ReaderWriterGDAL : public osgDB::ReaderWriter
}
void initGDAL()
void initGDAL() const
{
static bool s_initialized = false;
if (!s_initialized)