Added ProxyLayer support into osgTerrain plugin
This commit is contained in:
@@ -300,7 +300,7 @@ class OSGTERRAIN_EXPORT ProxyLayer : public Layer
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~ProxyLayer() {}
|
||||
virtual ~ProxyLayer();
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -46,15 +46,13 @@ class ReaderWriterGDAL : public osgDB::ReaderWriter
|
||||
|
||||
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;
|
||||
osg::ref_ptr<GDALPlugin::DataSetLayer> dataset = new GDALPlugin::DataSetLayer(fileName);
|
||||
|
||||
if (dataset->valid()) return dataset.release();
|
||||
|
||||
|
||||
@@ -63,6 +63,23 @@ osgTerrain::Layer* readLayer(osgDB::Input& fr)
|
||||
|
||||
}
|
||||
|
||||
if (fr.matchSequence("ProxyLayer %w") || fr.matchSequence("ProxyLayer %w"))
|
||||
{
|
||||
osg::ref_ptr<osg::Object> image = osgDB::readObjectFile(std::string(fr[1].getStr())+".gdal");
|
||||
osgTerrain::ProxyLayer* proxyLayer = dynamic_cast<osgTerrain::ProxyLayer*>(image.get());
|
||||
if (proxyLayer)
|
||||
{
|
||||
layer = proxyLayer;
|
||||
}
|
||||
else
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<"Warning: Failed to create ProxyLayer "<<fr[1].getStr()<<std::endl;
|
||||
}
|
||||
|
||||
fr += 2;
|
||||
itrAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("Images {") || fr.matchSequence("images {"))
|
||||
{
|
||||
osg::ref_ptr<osgTerrain::CompositeLayer> cl = new osgTerrain::CompositeLayer;
|
||||
|
||||
@@ -326,7 +326,7 @@ unsigned int HeightFieldLayer::getModifiedCount() const
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// HieghtFieldLayer
|
||||
// CompositeLayer
|
||||
//
|
||||
CompositeLayer::CompositeLayer()
|
||||
{
|
||||
@@ -342,3 +342,21 @@ void CompositeLayer::clear()
|
||||
{
|
||||
_layers.clear();
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// ProxyLayer
|
||||
//
|
||||
ProxyLayer::ProxyLayer()
|
||||
{
|
||||
}
|
||||
|
||||
ProxyLayer::ProxyLayer(const ProxyLayer& proxyLayer,const osg::CopyOp& copyop):
|
||||
Layer(proxyLayer,copyop)
|
||||
{
|
||||
}
|
||||
|
||||
ProxyLayer::~ProxyLayer()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -557,3 +557,40 @@ BEGIN_OBJECT_REFLECTOR(osgTerrain::Layer)
|
||||
__void__setValidDataOperator__ValidDataOperator_P1);
|
||||
END_REFLECTOR
|
||||
|
||||
BEGIN_OBJECT_REFLECTOR(osgTerrain::ProxyLayer)
|
||||
I_DeclaringFile("osgTerrain/Layer");
|
||||
I_BaseType(osgTerrain::Layer);
|
||||
I_Constructor0(____ProxyLayer,
|
||||
"",
|
||||
"");
|
||||
I_ConstructorWithDefaults2(IN, const osgTerrain::ProxyLayer &, proxyLayer, , IN, const osg::CopyOp &, copyop, osg::CopyOp::SHALLOW_COPY,
|
||||
____ProxyLayer__C5_ProxyLayer_R1__C5_osg_CopyOp_R1,
|
||||
"Copy constructor using CopyOp to manage deep vs shallow copy. ",
|
||||
"");
|
||||
I_Method0(osg::Object *, cloneType,
|
||||
Properties::VIRTUAL,
|
||||
__osg_Object_P1__cloneType,
|
||||
"Clone the type of an object, with Object* return type. ",
|
||||
"Must be defined by derived classes. ");
|
||||
I_Method1(osg::Object *, clone, IN, const osg::CopyOp &, copyop,
|
||||
Properties::VIRTUAL,
|
||||
__osg_Object_P1__clone__C5_osg_CopyOp_R1,
|
||||
"Clone an object, with Object* return type. ",
|
||||
"Must be defined by derived classes. ");
|
||||
I_Method1(bool, isSameKindAs, IN, const osg::Object *, obj,
|
||||
Properties::VIRTUAL,
|
||||
__bool__isSameKindAs__C5_osg_Object_P1,
|
||||
"",
|
||||
"");
|
||||
I_Method0(const char *, libraryName,
|
||||
Properties::VIRTUAL,
|
||||
__C5_char_P1__libraryName,
|
||||
"return the name of the object's library. ",
|
||||
"Must be defined by derived classes. The OpenSceneGraph convention is that the namespace of a library is the same as the library name. ");
|
||||
I_Method0(const char *, className,
|
||||
Properties::VIRTUAL,
|
||||
__C5_char_P1__className,
|
||||
"return the name of the object's class type. ",
|
||||
"Must be defined by derived classes. ");
|
||||
END_REFLECTOR
|
||||
|
||||
|
||||
Reference in New Issue
Block a user