DYT/Tool/OpenSceneGraph-3.6.5/include/osgEarth/TileEstimator

118 lines
3.8 KiB
Plaintext
Raw Normal View History

2024-12-24 23:49:36 +00:00
/* -*-c++-*- */
/* osgEarth - Geospatial SDK for OpenSceneGraph
* Copyright 2020 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_TileEstimator_H
#define OSGEARTH_TileEstimator_H 1
#include <osgEarth/Common>
#include <osgEarth/Profile>
namespace osgEarth { namespace Util
{
using namespace osgEarth;
/**
* Utility for estimating the size of a tiling operation.
* This provides a ROUGH estimate that you can use for progress reporting
* or disk use projections.
*/
class OSGEARTH_EXPORT TileEstimator
{
public:
TileEstimator();
/**
* Sets the minimum level to seed to
*/
void setMinLevel(const unsigned int& minLevel) {_minLevel = minLevel;}
/**
* Gets the minimum level to seed to.
*/
const unsigned int getMinLevel() const {return _minLevel;}
/**
* Sets the maximum level to seed to
*/
void setMaxLevel(const unsigned int& maxLevel) {_maxLevel = maxLevel;}
/**
* Gets the maximum level to cache to.
*/
const unsigned int getMaxLevel() const {return _maxLevel;}
/**
*Adds an extent to cache
*/
void addExtent( const GeoExtent& value );
/**
* Gets or sets the Profile used for this Cache. Defaults to a global-geodetic profile
*/
const osgEarth::Profile* getProfile() const { return _profile.get(); }
void setProfile( const osgEarth::Profile* profile ) { _profile = profile; }
/**
* Gets or sets the approximate size in MB for each tile
*/
double getSizeInMBPerTile() const { return _sizeInMBPerTile;}
void setSizeInMBPerTile( double sizeInMBPerTile ) { _sizeInMBPerTile = sizeInMBPerTile; }
/**
* Gets or sets the approximate amount of processing time in seconds it will take for each tile
*/
double getTimeInSecondsPerTile() const { return _timeInSecondsPerTile;}
void setTimeInSecondsPerTile( double timeInSecondsPerTile ) { _timeInSecondsPerTile = timeInSecondsPerTile; }
/**
* Gets the estimated total number of tiles that will be cached
*/
unsigned int getNumTiles() const;
/**
* Get the estimated size of the output cache in MB.
* This is a ROUGH estimate based on the _sizeInMBPerTile setting.
*/
double getSizeInMB() const;
/**
* Get an estimate on the amount of time it will take to process the cache.
* This is a ROUGH estimate based on the _timeInSecondsPerTile setting
*/
double getTotalTimeInSeconds() const;
protected:
osg::ref_ptr< const osgEarth::Profile > _profile;
unsigned int _minLevel;
unsigned int _maxLevel;
std::vector< GeoExtent > _extents;
double _sizeInMBPerTile;
double _timeInSecondsPerTile;
};
} }
#endif // OSGEARTH_BOUNDS_H