예제 #1
0
void ImageOverlay::dirty()
{
    {
        OpenThreads::ScopedLock< OpenThreads::Mutex > lock(_mutex);
        _dirty = true;
    }

    for( CallbackList::iterator i = _callbacks.begin(); i != _callbacks.end(); i++ )
    {
        i->get()->onOverlayChanged();
    }
}
예제 #2
0
void
Terrain::fireTileAdded( const TileKey& key, osg::Node* node )
{
    Threading::ScopedReadLock sharedLock( _callbacksMutex );

    for( CallbackList::iterator i = _callbacks.begin(); i != _callbacks.end(); )
    {       
        TerrainCallbackContext context( this );
        i->get()->onTileAdded( key, node, context );

        // if the callback set the "remove" flag, discard the callback.
        if ( !context._remove )
            ++i;
        else
            i = _callbacks.erase( i );
    }
}
예제 #3
0
void
Terrain::removeTerrainCallback( TerrainCallback* cb )
{
    Threading::ScopedWriteLock exclusiveLock( _callbacksMutex );

    for( CallbackList::iterator i = _callbacks.begin(); i != _callbacks.end(); )
    {        
        if ( i->get() == cb )
        {
            i = _callbacks.erase( i );
        }
        else
        {
            ++i;
        }
    }
}
예제 #4
0
void FutureResult::execFirstItem()
{
	CallbackList::iterator it = m_callbackList.begin();
	if(it == m_callbackList.end())
		return;

	try
	{
		if(m_lastResult.isException())
			m_lastResult = it->second(m_lastResult);
		else
			m_lastResult = it->first(m_lastResult);
	}
	catch(std::exception &e)
	{
		m_lastResult = e;
	}
	m_callbackList.erase(it);
}