osgEarth 2.1.1
|
00001 /* -*-c++-*- */ 00002 /* osgEarth - Dynamic map generation toolkit for OpenSceneGraph 00003 * Copyright 2008-2010 Pelican Mapping 00004 * http://osgearth.org 00005 * 00006 * osgEarth is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU Lesser General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public License 00017 * along with this program. If not, see <http://www.gnu.org/licenses/> 00018 */ 00019 00020 #ifndef OSGEARTH_CACHE_SEED_H 00021 #define OSGEARTH_CACHE_SEED_H 1 00022 00023 #include <osgEarth/Common> 00024 #include <osgEarth/Map> 00025 #include <osgEarth/TileKey> 00026 #include <osgEarth/Progress> 00027 00028 namespace osgEarth 00029 { 00033 class OSGEARTH_EXPORT CacheSeed 00034 { 00035 public: 00036 CacheSeed(): 00037 _minLevel(0), 00038 _maxLevel(12), 00039 _bounds(-180, -90, 180, 90) { } 00040 00044 void setMinLevel(const unsigned int& minLevel) {_minLevel = minLevel;} 00045 00049 const unsigned int getMinLevel() const {return _minLevel;} 00050 00054 void setMaxLevel(const unsigned int& maxLevel) {_maxLevel = maxLevel;} 00055 00059 const unsigned int getMaxLevel() const {return _maxLevel;} 00060 00064 const Bounds& getBounds() const { return _bounds; } 00065 00069 void setBounds(const Bounds& bounds) { _bounds = bounds; } 00070 00074 void setBounds(const double& minLon, const double& minLat, const double& maxLon, const double& maxLat) { _bounds = Bounds(minLon, minLat, maxLon, maxLat); } 00075 00079 void setProgressCallback(osgEarth::ProgressCallback* progress) { _progress = progress? progress : new ProgressCallback; } 00080 00084 void seed( Map* map ); 00085 00086 protected: 00087 unsigned int _minLevel; 00088 unsigned int _maxLevel; 00089 Bounds _bounds; 00090 osg::ref_ptr<ProgressCallback> _progress; 00091 00092 void processKey( const MapFrame& mapf, const TileKey& key ) const; 00093 void cacheTile( const MapFrame& mapf, const TileKey& key ) const; 00094 }; 00095 } 00096 00097 #endif //OSGEARTH_CACHE_SEED_H