osgEarth 2.1.1
Public Member Functions | Static Public Member Functions | Private Types | Private Attributes

osgEarth::TileBlacklist Class Reference

Inheritance diagram for osgEarth::TileBlacklist:
Collaboration diagram for osgEarth::TileBlacklist:

List of all members.

Public Member Functions

 TileBlacklist ()
void add (const osgTerrain::TileID &tile)
void remove (const osgTerrain::TileID &tile)
void clear ()
bool contains (const osgTerrain::TileID &tile) const
unsigned int size () const
void write (std::ostream &output) const
void write (const std::string &filename) const

Static Public Member Functions

static TileBlacklistread (std::istream &in)
static TileBlacklistread (const std::string &filename)

Private Types

typedef std::set
< osgTerrain::TileID > 
BlacklistedTiles

Private Attributes

BlacklistedTiles _tiles
osgEarth::Threading::ReadWriteMutex _mutex

Detailed Description

A collection of tiles that should be considered blacklisted

Definition at line 144 of file TileSource.


Member Typedef Documentation

typedef std::set< osgTerrain::TileID > osgEarth::TileBlacklist::BlacklistedTiles [private]

Definition at line 198 of file TileSource.


Constructor & Destructor Documentation

TileBlacklist::TileBlacklist ( )

Creates a new TileBlacklist

Definition at line 38 of file TileSource.cpp.

{
    //NOP
}

Here is the caller graph for this function:


Member Function Documentation

void TileBlacklist::add ( const osgTerrain::TileID &  tile)

Adds the given tile to the blacklist

Definition at line 44 of file TileSource.cpp.

{
    Threading::ScopedWriteLock lock(_mutex);
    _tiles.insert(tile);
    OE_DEBUG << "Added " << tile.level << " (" << tile.x << ", " << tile.y << ") to blacklist" << std::endl;
}

Here is the caller graph for this function:

void TileBlacklist::clear ( )

Removes all tiles from the blacklist

Definition at line 60 of file TileSource.cpp.

{
    Threading::ScopedWriteLock lock(_mutex);
    _tiles.clear();
    OE_DEBUG << "Cleared blacklist" << std::endl;
}
bool TileBlacklist::contains ( const osgTerrain::TileID &  tile) const

Returns whether the given tile is in the blacklist

Definition at line 68 of file TileSource.cpp.

{
    Threading::ScopedReadLock lock(const_cast<TileBlacklist*>(this)->_mutex);
    return _tiles.find(tile) != _tiles.end();
}

Here is the caller graph for this function:

TileBlacklist * TileBlacklist::read ( const std::string &  filename) [static]

Reads a TileBlacklist from the given filename

Definition at line 106 of file TileSource.cpp.

{
    if (osgDB::fileExists(filename) && (osgDB::fileType(filename) == osgDB::REGULAR_FILE))
    {
        std::ifstream in( filename.c_str() );
        return read( in );
    }
    return NULL;
}

Here is the call graph for this function:

TileBlacklist * TileBlacklist::read ( std::istream &  in) [static]

Reads a TileBlacklist from the given istream

Definition at line 82 of file TileSource.cpp.

{
    osg::ref_ptr< TileBlacklist > result = new TileBlacklist();


    while (!in.eof())
    {
        std::string line;
        std::getline(in, line);
        if (!line.empty())
        {
            int z, x, y;
            if (sscanf(line.c_str(), "%d %d %d", &z, &x, &y) == 3)
            {
                result->add(osgTerrain::TileID(z, x, y ));
            }

        }
    }

    return result.release();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void TileBlacklist::remove ( const osgTerrain::TileID &  tile)

Removes the given tile from the blacklist

Definition at line 52 of file TileSource.cpp.

{
    Threading::ScopedWriteLock lock(_mutex);
    _tiles.erase(tile);
    OE_DEBUG << "Removed " << tile.level << " (" << tile.x << ", " << tile.y << ") from blacklist" << std::endl;
}
unsigned int TileBlacklist::size ( ) const

Returns the size of the blacklist

Definition at line 75 of file TileSource.cpp.

{
    Threading::ScopedReadLock lock(const_cast<TileBlacklist*>(this)->_mutex);
    return _tiles.size();
}
void TileBlacklist::write ( const std::string &  filename) const

Writes this TileBlacklist to the given filename

Definition at line 117 of file TileSource.cpp.

{ 
    std::string path = osgDB::getFilePath(filename);
    if (!path.empty() && !osgDB::fileExists(path) && !osgDB::makeDirectory(path))
    {
        OE_NOTICE << "Couldn't create path " << path << std::endl;
        return;
    }
    std::ofstream out(filename.c_str());
    write(out);
}

Here is the call graph for this function:

void TileBlacklist::write ( std::ostream &  output) const

Writes this TileBlacklist to the given ostream

Definition at line 130 of file TileSource.cpp.

{
    Threading::ScopedReadLock lock(const_cast<TileBlacklist*>(this)->_mutex);
    for (BlacklistedTiles::const_iterator itr = _tiles.begin(); itr != _tiles.end(); ++itr)
    {
        output << itr->level << " " << itr->x << " " << itr->y << std::endl;
    }
}

Here is the caller graph for this function:


Member Data Documentation

Definition at line 200 of file TileSource.

Definition at line 199 of file TileSource.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines