of the previous one.
Modified Files:
model/SGReaderWriterXML.cxx model/SGReaderWriterXML.hxx
tgdb/ReaderWriterSTG.cxx tgdb/ReaderWriterSTG.hxx
tgdb/SGReaderWriterBTG.cxx tgdb/SGReaderWriterBTG.hxx
osg::Node *(*load_panel)(SGPropertyNode *) = 0,
SGPropertyNode *overlay = 0);
-const char* SGReaderWriterXML::className() const
+
+SGReaderWriterXML::SGReaderWriterXML()
+{
+ supportsExtension("xml", "SimGear xml database format");
+}
+
+SGReaderWriterXML::~SGReaderWriterXML()
{
- return "XML database reader";
}
-bool SGReaderWriterXML::acceptsExtension(const std::string& extension) const
+const char* SGReaderWriterXML::className() const
{
- return (osgDB::equalCaseInsensitive(extension, "xml"));
+ return "XML database reader";
}
osgDB::ReaderWriter::ReadResult
{
// SG_LOG(SG_GENERAL, SG_ALERT, "SGReaderWriterXML::readNode(" << fileName << ")");
- std::string ext = osgDB::getLowerCaseFileExtension(fileName);
- if (!acceptsExtension(ext))
- return ReadResult::FILE_NOT_HANDLED;
-
const SGReaderWriterXMLOptions* xmlOptions
= dynamic_cast<const SGReaderWriterXMLOptions*>(options);
class SGReaderWriterXML : public osgDB::ReaderWriter
{
public:
- virtual const char* className() const;
+ SGReaderWriterXML();
+ virtual ~SGReaderWriterXML();
- virtual bool acceptsExtension(const std::string& extension) const;
+ virtual const char* className() const;
virtual ReadResult readNode(const std::string& fileName,
const osgDB::ReaderWriter::Options* options)
using namespace simgear;
-const char* ReaderWriterSTG::className() const
+ReaderWriterSTG::ReaderWriterSTG()
+{
+ supportsExtension("stg", "SimGear stg database format");
+}
+
+ReaderWriterSTG::~ReaderWriterSTG()
{
- return "STG Database reader";
}
-bool ReaderWriterSTG::acceptsExtension(const std::string& extension) const
+const char* ReaderWriterSTG::className() const
{
- return (osgDB::equalCaseInsensitive(extension, "gz")
- || osgDB::equalCaseInsensitive(extension, "stg"));
+ return "STG Database reader";
}
//#define SLOW_PAGER 1
ReaderWriterSTG::readNode(const std::string& fileName,
const osgDB::ReaderWriter::Options* options) const
{
- std::string ext = osgDB::getLowerCaseFileExtension(fileName);
- if(!acceptsExtension(ext))
- return ReadResult::FILE_NOT_HANDLED;
- std::string stgFileName;
- if (osgDB::equalCaseInsensitive(ext, "gz")) {
- stgFileName = osgDB::getNameLessExtension(fileName);
- if (!acceptsExtension(
- osgDB::getLowerCaseFileExtension(stgFileName))) {
- return ReadResult::FILE_NOT_HANDLED;
- }
- } else {
- stgFileName = fileName;
- }
- osg::Node* result
- = TileEntry::loadTileByName(osgDB::getNameLessExtension(stgFileName),
- options);
+ std::string tileName = osgDB::getNameLessExtension(fileName);
+ osg::Node* result = TileEntry::loadTileByName(tileName, options);
// For debugging race conditions
#ifdef SLOW_PAGER
sleep(5);
class ReaderWriterSTG : public osgDB::ReaderWriter {
public:
- virtual const char* className() const;
+ ReaderWriterSTG();
+ virtual ~ReaderWriterSTG();
- virtual bool acceptsExtension(const std::string& extension) const;
+ virtual const char* className() const;
virtual ReadResult readNode(const std::string& fileName,
const osgDB::ReaderWriter::Options* options)
std::string SGReaderWriterBTGOptions::defaultOptions;
-const char* SGReaderWriterBTG::className() const
+SGReaderWriterBTG::SGReaderWriterBTG()
{
- return "BTG Database reader";
+ supportsExtension("btg", "SimGear btg database format");
}
-bool SGReaderWriterBTG::acceptsExtension(const std::string& extension) const
+SGReaderWriterBTG::~SGReaderWriterBTG()
{
- return (osgDB::equalCaseInsensitive(extension, "gz")
- || osgDB::equalCaseInsensitive(extension, "btg"));
+}
+
+const char* SGReaderWriterBTG::className() const
+{
+ return "BTG Database reader";
}
osgDB::ReaderWriter::ReadResult
SGReaderWriterBTG::readNode(const std::string& fileName,
const osgDB::ReaderWriter::Options* options) const
{
- std::string ext = osgDB::getLowerCaseFileExtension(fileName);
- if(!acceptsExtension(ext))
- return ReadResult::FILE_NOT_HANDLED;
- if (osgDB::equalCaseInsensitive(ext, "gz")) {
- std::string btgFileName = osgDB::getNameLessExtension(fileName);
- if (!acceptsExtension(
- osgDB::getLowerCaseFileExtension(btgFileName))) {
- return ReadResult::FILE_NOT_HANDLED;
- }
- }
SGMaterialLib* matlib = 0;
bool calcLights = false;
bool useRandomObjects = false;
class SGReaderWriterBTG : public osgDB::ReaderWriter {
public:
+ SGReaderWriterBTG();
+ virtual ~SGReaderWriterBTG();
+
virtual const char* className() const;
- virtual bool acceptsExtension(const std::string& extension) const;
-
virtual ReadResult readNode(const std::string& fileName,
const osgDB::ReaderWriter::Options* options)
const;