/usr/include/osgEarth/TileVisitor is in libosgearth-dev 2.9.0+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | /* -*-c++-*- */
/* osgEarth - Dynamic map generation toolkit for OpenSceneGraph
* Copyright 2016 Pelican Mapping
* http://osgearth.org
*
* osgEarth is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
#ifndef OSGEARTH_TILEVISITOR_H
#define OSGEARTH_TILEVISITOR_H 1
#include <osgEarth/Common>
#include <osgEarth/TileHandler>
#include <osgEarth/Profile>
#include <osgEarth/TaskService>
namespace osgEarth
{
/**
* Utility class that traverses a Profile and emits TileKey's based on a collection of extents and min/max levels
*/
class OSGEARTH_EXPORT TileVisitor : public osg::Referenced
{
public:
TileVisitor();
TileVisitor(TileHandler* handler);
/**
* Sets the minimum level to visit
*/
void setMinLevel(const unsigned int& minLevel) {_minLevel = minLevel;}
/**
* Gets the minimum level to visit
*/
const unsigned int getMinLevel() const {return _minLevel;}
/**
* Sets the maximum level to visit
*/
void setMaxLevel(const unsigned int& maxLevel) {_maxLevel = maxLevel;}
/**
* Gets the maximum level to visit
*/
const unsigned int getMaxLevel() const {return _maxLevel;}
/**
* Extents to visit
*/
void addExtent( const GeoExtent& extent );
const std::vector< GeoExtent >& getExtents() const { return _extents; }
virtual void run(const Profile* mapProfile);
bool intersects( const GeoExtent& extent );
void setTileHandler( TileHandler* handler );
void setProgressCallback( ProgressCallback* progress );
void incrementProgress( unsigned int progress );
void resetProgress();
protected:
void estimate();
virtual bool handleTile( const TileKey& key );
void processKey( const TileKey& key );
unsigned int _minLevel;
unsigned int _maxLevel;
std::vector< GeoExtent > _extents;
osg::ref_ptr< TileHandler > _tileHandler;
osg::ref_ptr< ProgressCallback > _progress;
osg::ref_ptr< const Profile > _profile;
OpenThreads::Mutex _progressMutex;
unsigned int _total;
unsigned int _processed;
};
/**
* A TileVisitor that pushes all of it's generated keys onto a TaskService queue and handles them in background threads.
*/
class OSGEARTH_EXPORT MultithreadedTileVisitor: public TileVisitor
{
public:
MultithreadedTileVisitor();
MultithreadedTileVisitor( TileHandler* handler );
unsigned int getNumThreads() const;
void setNumThreads( unsigned int numThreads);
virtual void run(const Profile* mapProfile);
protected:
virtual bool handleTile( const TileKey& key );
unsigned int _numThreads;
// The work queue to pass seed operations to
osg::ref_ptr<osgEarth::TaskService> _taskService;
};
typedef std::vector< TileKey > TileKeyList;
/**
* A list of TileKeys that you can serialize to a file
*/
class OSGEARTH_EXPORT TaskList
{
public:
TaskList(const Profile* profile);
/**
* Loads the tiles from the given file.
*/
bool load( const std::string &filename);
/**
* Saves the tiles to the given file.
*/
void save( const std::string& filename);
/**
* Gets the list of keys
*/
TileKeyList& getKeys();
const TileKeyList& getKeys() const;
protected:
TileKeyList _keys;
osg::ref_ptr< const Profile > _profile;
};
/**
* A TileVisitor that launches an external process to process tiles.
*/
class OSGEARTH_EXPORT MultiprocessTileVisitor: public TileVisitor
{
public:
MultiprocessTileVisitor();
MultiprocessTileVisitor( TileHandler* handler );
unsigned int getNumProcesses() const;
void setNumProcesses( unsigned int numProcesses);
unsigned int getBatchSize() const;
void setBatchSize( unsigned int batchSize );
virtual void run(const Profile* mapProfile);
const std::string& getEarthFile() const;
void setEarthFile( const std::string& earthFile );
protected:
virtual bool handleTile( const TileKey& key );
void processBatch();
TileKeyList _batch;
unsigned int _batchSize;
unsigned int _numProcesses;
std::string _earthFile;
// The work queue to pass seed operations to
osg::ref_ptr<osgEarth::TaskService> _taskService;
};
/**
* A TileVisitor that simply emits keys from a list. Useful for running a list of tasks.
*/
class OSGEARTH_EXPORT TileKeyListVisitor : public TileVisitor
{
public:
TileKeyListVisitor();
void setKeys(const TileKeyList& keys);
virtual void run(const Profile* mapProfile);
protected:
TileKeyList _keys;
};
} // namespace osgEarth
#endif // OSGEARTH_TRAVERSAL_DATA_H
|