QSharedPointer<Plant> PlantMgr::addPlant(const QString& theKind, const QString& theID, SysError& theErr){ if(getPlant(theID).isNull()) { QSharedPointer<Plant> thePlantRef = createPlant(theKind, theErr); thePlantRef->setID(theID); m_plantList.insert(theID, thePlantRef); return(thePlantRef); } else { qWarning()<<"Error attempt to add a plant with an already present ID: "<< theID; return(QSharedPointer<Plant>()); } }
//============================================================================ //============================================================================ virtual ReadResult readNode(const std::string& file, const osgDB::ReaderWriter::Options* options) const { std::string ext = osgDB::getLowerCaseFileExtension(file); if (!acceptsExtension(ext)) return ReadResult::FILE_NOT_HANDLED; NgpFileName fileName(file); std::string foundPath = osgDB::findDataFile( fileName.settings().filePath, options ); if (foundPath.size() <= 0) { OSG_WARN << "Unable to find plant file: " << fileName.settings().filePath << std::endl; return NULL; } fileName.setFilePath(foundPath); osg::Geode *node = createPlant( fileName ); return node; }