示例#1
0
std::string getLibraryName     (UInt32 Index)
{
    if(osgLibraryVersions == NULL ||
       Index > getNumLibraries())
    {
        return "";
    }

    LibVersionMap::const_iterator SearchItor(osgLibraryVersions->begin());
    std::advance(SearchItor, Index);
    return SearchItor->first;
}
void LuaActivity::removeLuaCallback(FieldContainerRefPtr producerObject,
                       std::string funcName,
                       UInt32 producedEventId)
{
    LuaFuncGroup TheFuncGroup(producerObject, funcName, producedEventId);
    FuncMap::iterator SearchItor(_GlobalLuaActivities.find(TheFuncGroup));
    if(SearchItor != _GlobalLuaActivities.end())
    {
        (*SearchItor).second.second.disconnect();
        _GlobalLuaActivities.erase(SearchItor);
    }
}
void ColorChooser::addChooserPanel(AbstractColorChooserPanelRefPtr panel)
{
	MFInternalChooserPanelsType::iterator
        SearchItor(editMFInternalChooserPanels()->find(panel));

	if(SearchItor == editMFInternalChooserPanels()->end())
	{
		panel->installChooserPanel(this);

        pushToInternalChooserPanels(panel);

		//updateChildren();
        
		//panel->updateChooser();
	}
}
示例#4
0
std::string getLibraryRevision  (const std::string& szName)
{
    if(osgLibraryVersions == NULL)
    {
        return "";
    }

    LibVersionMap::const_iterator SearchItor(osgLibraryVersions->find(szName));
    if(SearchItor != osgLibraryVersions->end())
    {
        return SearchItor->second.second;
    }
    else
    {
        return "";
    }
}
AbstractColorChooserPanelRefPtr ColorChooser::removeChooserPanel(AbstractColorChooserPanelRefPtr panel)
{
	MFInternalChooserPanelsType::iterator
        SearchItor(editMFInternalChooserPanels()->find(panel));

	if(SearchItor == editMFInternalChooserPanels()->end())
	{
		panel->uninstallChooserPanel(this);

        removeObjFromInternalChooserPanels(panel);

		return panel;
	}
	else
	{
		return NULL;
	}
}
示例#6
0
/*! Add a string to the version output. 
    Mainly used by the libraries to publicise the svn revision they were
    built from.
*/
void addLibraryVersion         (const std::string& szName,
                                const std::string& szVersion,
                                const std::string& szRevision)
{
    if(osgLibraryVersions == NULL)
    {
        osgLibraryVersions = new LibVersionMap();
    }

    LibVersionMap::const_iterator SearchItor(osgLibraryVersions->find(szName));
    if(SearchItor != osgLibraryVersions->end())
    {
        SFATAL << "OpenSG Library by name "          << szName
               << " cannot be added more than once." << std::endl;
    }

    (*osgLibraryVersions)[szName] = std::pair<std::string,std::string>(szVersion,szRevision);
}
SpringLayoutConstraintsRefPtr SpringLayout::getConstraint(ComponentUnrecPtr TheComponent) const
{
    FieldContainerMap::const_iterator
        SearchItor(getConstraints().find(static_cast<FieldContainerMap::key_type>(TheComponent->getId())));

    if(SearchItor == getConstraints().end())
    {
        SpringLayoutConstraintsUnrecPtr TempConstraints(SpringLayoutConstraintsBase::create());

        SpringLayoutConstraintsRefPtr NewConstraints = applyDefaults(TheComponent, TempConstraints);

        const_cast<SpringLayout*>(this)->editConstraints()[static_cast<FieldContainerMap::key_type>(TheComponent->getId())] = NewConstraints;

        return NewConstraints;
    }
    else
    {
        return dynamic_pointer_cast<SpringLayoutConstraints>((*SearchItor).second);
    }
}
示例#8
0
TableFileTypeP TableFileHandlerBase::getFileType(const std::string& FileExtension, UInt32 Flags)
{
	FileTypeMap::const_iterator SearchItor(_SuffixTypeMap.find(FileExtension));

	if(SearchItor != _SuffixTypeMap.end())
	{
		for(FileTypeVector::const_iterator VecItor(SearchItor->second.begin()) ; VecItor != SearchItor->second.end() ; ++VecItor)
		{
			if((*VecItor)->getFlags() & Flags)
			{
				return (*VecItor);
			}
		}
		return NULL;
	}
	else
	{
		return NULL;
	}
}
void MainApplication::updateRecentProject(const BoostPath& ProjectFile)
{
    getSettings().put<BoostPath>("basic.last_opened_project",ProjectFile);

    //Update Recent Projects
    std::vector<BoostPath> RecentProjects;
    
    try
    {
        RecentProjects = getSettings().get_vec<BoostPath>("basic.recent_projects.files");
    }
    catch(boost::property_tree::ptree_bad_path&)
    {
    }

    std::vector<BoostPath>::iterator SearchItor(RecentProjects.begin());
    for( ; SearchItor!=RecentProjects.end() ; ++SearchItor)
    {
        if(boost::filesystem::equivalent((*SearchItor),ProjectFile))
        {
            break;
        }
    }
    if(SearchItor != RecentProjects.end())
    {
        RecentProjects.erase(SearchItor);
    }
    RecentProjects.insert(RecentProjects.begin(), ProjectFile);

    //Resize
    UInt32 MaxRecProj(getSettings().get<UInt32>("basic.recent_projects.max"));
    if(RecentProjects.size() > MaxRecProj)
    {
        //Pop off the front
        RecentProjects.resize(MaxRecProj);
    }


    getSettings().put_vec("basic.recent_projects.files.file", RecentProjects);

}
示例#10
0
IconSetPtr IconManager::getIconSet(const std::string& IconSetName)
{
	IconSetMap::const_iterator SearchItor(_IconSetMap.find(IconSetName));

	if(SearchItor == _IconSetMap.end())
	{
		//Attempt to create it
		IconSetPtr NewSet = createIconSet(IconSetName);

		if(NewSet != NULL)
		{
			_IconSetMap[IconSetName] = NewSet;
		}

		return NewSet;
	}
	else
	{
		return SearchItor->second;
	}
}
boost::signals2::connection LuaActivity::addLuaCallback(FieldContainerRefPtr producerObject, std::string funcName, UInt32 producedEventId)
{
    if(producerObject->isEventProducer())
    {
        if(funcName.empty())
        {
            SWARNING << "LuaActivity::addLuaCallback(): Attempt to attach an empty function name." << std::endl;
            return boost::signals2::connection();
        }

        //Find an attached LuaActivity with the same
        //       ProducerObject
        //       Function
        //       ProducedMethodID
        LuaFuncGroup TheFuncGroup(producerObject, funcName, producedEventId);
        FuncMap::iterator SearchItor(_GlobalLuaActivities.find(TheFuncGroup));
        if(SearchItor != _GlobalLuaActivities.end() &&
           (*SearchItor).second.second.connected())
        {
            SWARNING << "Lua function: " << funcName << " is already attached to this produced method." << std::endl;
            return (*SearchItor).second.second;
        }

        LuaActivityUnrecPtr TheLuaActivity = LuaActivity::create();
        TheLuaActivity->setEntryFunction(funcName);
        commitChanges();

        boost::signals2::connection TheConnection(producerObject->attachActivity(producedEventId, TheLuaActivity));
        //BUG: Need to add ref count to keep it from being deleted,
        //but who has responsibility for deleting it?
        _GlobalLuaActivities[TheFuncGroup] = ActivityConnectionPair(TheLuaActivity, TheConnection);
        return TheConnection;
    }
    else
    {
        SWARNING << "LuaActivity::addLuaCallback(): Producer object is not an event producer." << std::endl;
        return boost::signals2::connection();
    }
}
FCFileTypeP FCFileHandlerBase::getFileType(const std::string& FileExtension, UInt32 Flags)
{
    //Check if this is a FileName or just the file extension
    std::string FileExtensionLowerCase(FileExtension);
    boost::algorithm::to_lower(FileExtensionLowerCase);

	FileTypeMap::const_iterator SearchItor(_SuffixTypeMap.find(FileExtensionLowerCase));

	if(SearchItor != _SuffixTypeMap.end())
	{
		for(FileTypeVector::const_iterator VecItor(SearchItor->second.begin()) ; VecItor != SearchItor->second.end() ; ++VecItor)
		{
			if((*VecItor)->getFlags() & Flags)
			{
				return (*VecItor);
			}
		}
		return NULL;
	}
	else
	{
		return NULL;
	}
}