/usr/include/osgEarthUtil/TMS 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 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 | /* -*-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/>
*/
/**
* These classes assist in dealing with the Tile Map Service specification
* (http://wiki.osgeo.org/wiki/Tile_Map_Service_Specification)
*/
#ifndef OSGEARTH_UTIL_TMS_H
#define OSGEARTH_UTIL_TMS_H 1
#include <osgEarthUtil/Common>
#include <vector>
#include <iostream>
#include <osgEarth/Profile>
#include <osgEarth/Common>
#include <osgEarth/DateTime>
#include <osg/Referenced>
#include <osgDB/ReaderWriter>
#include <osg/Version>
#include <osgDB/Options>
namespace osgEarth
{
class TileSource;
}
namespace osgEarth { namespace Util { namespace TMS
{
/**
* TMS tile format. Specifies format information of a tile
*/
class OSGEARTHUTIL_EXPORT TileFormat
{
public:
TileFormat();
/** dtor */
virtual ~TileFormat() { }
/**
*Gets the width of a tile
*/
unsigned int getWidth() const {return _width;}
/**
*Sets the width of a tile
*/
void setWidth(unsigned int width) {_width = width;}
/**
*Gets the height of a tile
*/
unsigned int getHeight() const {return _height;}
/**
*Sets the height of a tile
*/
void setHeight(unsigned int height) {_height = height;}
/**
*Gets the mime type of a tile
*/
const std::string& getMimeType() const {return _mimeType;}
/**
*Sets the mime type of a tile
*/
void setMimeType(const std::string& mimeType) {_mimeType = mimeType;}
/**
*Gets the extension of a tile
*/
const std::string& getExtension() const {return _extension;}
/**
*Sets the extension of a tile
*/
void setExtension(const std::string& extension) {_extension = extension;}
protected:
unsigned int _width;
unsigned int _height;
std::string _mimeType;
std::string _extension;
};
/**
*TMS tile set. A collection of tiled images at a given zoom level.
*/
class OSGEARTHUTIL_EXPORT TileSet
{
public:
TileSet();
/** dtor */
virtual ~TileSet() { }
/**
*Gets the reference link for this TileSet.
*/
const std::string& getHref() const {return _href;}
/**
*Sets the reference link for this TileSet.
*/
void setHref( const std::string &href) {_href = href;}
/**
*Gets the units per pixel for this TileSet.
*/
double getUnitsPerPixel() const {return _unitsPerPixel;}
/**
*Sets the units per pixel for this TileSet.
*/
void setUnitsPerPixel(double unitsPerPixel) {_unitsPerPixel = unitsPerPixel;}
/**
*Gets the zoom level of this TileSet.
*/
unsigned int getOrder() const {return _order;}
/**
*Sets the zoom level of this TileSet.
*/
void setOrder( int order ) {_order = order;}
protected:
std::string _href;
double _unitsPerPixel;
unsigned int _order;
};
/**
*A TMS tile map
*/
class OSGEARTHUTIL_EXPORT TileMap : public osg::Referenced
{
public:
TileMap();
/** dtor */
virtual ~TileMap() { }
/**
*Gets the tile map service for this TileMap
*/
const std::string& getTileMapService() const {return _tileMapService;}
/**
*Sets the tile map service for this TileMap
*/
void setTileMapService(const std::string& tileMapService) {_tileMapService = tileMapService;}
/**
*Gets the version of this TileMap
*/
const std::string& getVersion() const {return _version;}
/**
*Sets the version of this TileMap
*/
void setVersion(const std::string& version) {_version = version;}
/**
*Gets the title of this TileMap
*/
const std::string& getTitle() const {return _title;}
/**
*Sets the title of this TileMap
*/
void setTitle(const std::string& title) {_title = title;}
/**
*Gets the abstract of this TileMap
*/
const std::string& getAbstract() const {return _abstract;}
/**
*Sets the abstract of this TileMap
*/
void setAbstract(const std::string& value) {_abstract = value;}
/**
*Gets the spatial reference of this TileMap
*/
const std::string& getSRS() const {return _srs;}
/**
*Sets the spatial reference of this TileMap
*/
void setSRS(const std::string& srs) {_srs = srs;}
/**
*Gets the vertical spatial reference of this TileMap
*/
const std::string& getVerticalSRS() const { return _vsrs; }
/**
*Sets the vertical spatial reference of this TileMap
*/
void setVerticalSRS(const std::string& vsrs) { _vsrs = vsrs; }
/**
*Gets the filename that this TileMap was loaded from
*/
const std::string& getFilename() const {return _filename;}
/**
*Sets the filename that this TileMap was loaded from
*/
void setFilename(const std::string& filename) {_filename = filename;}
/**
*Gets the minimum zoom level that this TileMap has valid data for
*/
unsigned int getMinLevel() const {return _minLevel;}
/**
*Gets the maximum level that this TileMap has valid data for
*/
unsigned int getMaxLevel() const {return _maxLevel;}
/**
*Computes the minimum and maximum levels of valid data for this TileMap
*/
void computeMinMaxLevel();
/**
*Computes the number of tiles at level 0 from the existing TileSets
*/
void computeNumTiles();
/**
*Gets the x coordinate of the origin of this TileMap
*/
double getOriginX() const {return _originX;}
/**
*Sets the x coordinate of the origin of this TileMap
*/
void setOriginX(double x) {_originX = x;}
/**
*Gets the y coordinate of the origin of this TileMap
*/
double getOriginY() const {return _originY;}
/**
*Sets the y coordinate of the origin of this TileMap
*/
void setOriginY(double y) {_originY = y;}
/**
* Sets the timestamp of the TimeMap, i.e. the last modified time
*/
void setTimeStamp(TimeStamp t) { _timestamp = t; }
/**
* Gets the timestap of the TileMap
*/
TimeStamp getTimeStamp() const { return _timestamp; }
/**
*Sets the origin of this TileMap
*
*@param x
* The origin's x coordinate
*@param y
* The origin's y coordinate
*/
void setOrigin(double x, double y);
/**
*Gets the extents of this TileMap
*@param minX
* The minimum x coordinate of the extents
*@param minY
* The minimum y coordinate of the extents
*@param maxX
* The maximum x coordinate of the extents
*@param maxY
* The maximum y coordinate of the extents
*/
void getExtents( double &minX, double &minY, double &maxX, double &maxY) const;
/**
*Sets the extents of this TileMap
*@param minX
* The minimum x coordinate of the extents
*@param minY
* The minimum y coordinate of the extents
*@param maxX
* The maximum x coordinate of the extents
*@param maxY
* The maximum y coordinate of the extents
*/
void setExtents( double minX, double minY, double maxX, double maxY);
/**
*Gets the number of tiles wide at lod 0
*/
unsigned int getNumTilesWide() const { return _numTilesWide; }
/**
*Sets the number of tiles wide at lod 0
*/
void setNumTilesWide(unsigned int w) { _numTilesWide = w; }
/**
*Gets the number of tiles high at lod 0
*/
unsigned int getNumTilesHigh() const { return _numTilesHigh; }
/**
*Sets the number of tiles high at lod 0
*/
void setNumTilesHigh(unsigned int h) {_numTilesHigh = h;}
osgEarth::Profile::ProfileType getProfileType() const {return _profile_type;}
void setProfileType( osgEarth::Profile::ProfileType type ) {_profile_type = type;}
const Profile* createProfile() const;
/** Gets the TileFormat for this TileMap */
TileFormat& getFormat() {return _format;}
/** Gets the TileFormat for this TileMap */
const TileFormat& getFormat() const {return _format;}
/** A list of TileSets */
typedef std::vector<TileSet> TileSetList;
/** Gets the TileSets for this TileMap */
TileSetList& getTileSets() {return _tileSets;}
/** Gets the TileSets for this TileMap */
const TileSetList& getTileSets() const {return _tileSets;}
DataExtentList& getDataExtents() { return _dataExtents;}
const DataExtentList& getDataExtents() const { return _dataExtents;}
/**
*Gets a URL string that can be used to retrieve the image for the given TileKey
*@param tileKey
* The TileKey to get the URL for.
*@param invertY
* If false, treat tile 0,0 as the lower left tile in the the map. If true, treat 0,0 as the top left tile in the map.
*@returns
* The URL if the data intersects the TileKey.
*/
std::string getURL(const osgEarth::TileKey& tileKey, bool invertY);
/**
*Determines whether or not the given TileKey intersects the TileMap
*/
bool intersectsKey(const osgEarth::TileKey& tileKey);
/**
*Automatically generates a number of TileSets
*/
void generateTileSets(unsigned int numLevels = 20);
/**
* Creates a TileMap corresponding to one of osgEarth's built-in profile types
*/
static TileMap* create(
const std::string& url,
const Profile* profile,
const DataExtentList& dataExtents,
const std::string& format,
int tile_width,
int tile_height );
protected:
std::string _tileMapService;
std::string _version;
std::string _title;
std::string _abstract;
std::string _srs;
std::string _vsrs;
double _originX, _originY;
double _minX, _minY, _maxX, _maxY;
TileSetList _tileSets;
TileFormat _format;
std::string _filename;
unsigned int _minLevel;
unsigned int _maxLevel;
unsigned int _numTilesWide;
unsigned int _numTilesHigh;
osgEarth::Profile::ProfileType _profile_type;
TimeStamp _timestamp;
DataExtentList _dataExtents;
};
class OSGEARTHUTIL_EXPORT TileMapReaderWriter
{
public:
static TileMap* read( const std::string &location, const osgDB::ReaderWriter::Options* options );
static TileMap* read( std::istream &in );
static TileMap* read( const Config& conf );
static void write(const TileMap* tileMap, const std::string& location);
static void write(const TileMap* tileMap, std::ostream& output);
private:
TileMapReaderWriter();
TileMapReaderWriter(const TileMapReaderWriter &tmr);
/** dtor */
virtual ~TileMapReaderWriter() { }
};
/**
* An entry in a TileMapService's list of TileMaps.
*/
struct OSGEARTHUTIL_EXPORT TileMapEntry
{
TileMapEntry( const std::string& _title, const std::string& _href, const std::string& _srs, const std::string& _profile);
std::string title;
std::string href;
std::string srs;
std::string profile;
};
typedef std::list< TileMapEntry > TileMapEntryList;
/**
* Reads a list of TileMapEntry's from a server. Useful for displaying a list of layers to the user
*/
class OSGEARTHUTIL_EXPORT TileMapServiceReader
{
public:
/**
* Reads a list of TileMapEntry's from a server
* @param location
* A URL to the TMS service URL like http://server.com/tiles/1.0.0/
*/
static bool read( const std::string &location, const osgDB::ReaderWriter::Options* options, TileMapEntryList& tileMaps );
static bool read( const Config& conf, TileMapEntryList& tileMaps);
private:
TileMapServiceReader();
TileMapServiceReader( const TileMapServiceReader& rhs );
};
} } } // namespace osgEarth::Util::TMS
#endif //OSGEARTHUTIL_TMS_H
|