osgEarth 2.1.1

/home/cube/sources/osgearth/src/osgEarthUtil/ElevationManager

Go to the documentation of this file.
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 #ifndef OSGEARTHUTIL_ELEVATION_MANAGER_H
00020 #define OSGEARTHUTIL_ELEVATION_MANAGER_H
00021 
00022 #include <osgEarthUtil/Common>
00023 #include <osgEarth/Map>
00024 #include <osgEarth/MapNode>
00025 
00026 namespace osgEarth { namespace Util
00027 {
00028     using namespace osgEarth;
00029 
00050     class OSGEARTHUTIL_EXPORT ElevationManager : public osg::Referenced
00051     {
00052     public:
00054         enum Technique
00055         {
00058             TECHNIQUE_GEOMETRIC,
00059 
00061             TECHNIQUE_PARAMETRIC
00062         };
00063 
00064     public:
00075         ElevationManager( Map* map );
00076 
00095         bool getElevation(
00096             double x, double y,
00097             double resolution,
00098             const SpatialReference* srs,
00099             double& out_elevation,
00100             double& out_resolution);
00101 
00110         bool getPlacementMatrix(
00111             double x, double y, double z,
00112             double resolution,
00113             const SpatialReference* srs,
00114             osg::Matrixd& out_matrix,
00115             double& out_elevation,
00116             double& out_resolution);
00117 
00122         void setTechnique( Technique technique );
00123 
00128         Technique getTechnique() const;
00129 
00133         void setMaxTilesToCache( int value );
00134 
00138         int getMaxTilesToCache() const;
00139 
00143         void setInterpolation( ElevationInterpolation interp );
00144 
00148         ElevationInterpolation getElevationInterpolation() const;
00149 
00154         void setMaxLevelOverride(int maxLevelOverride);
00155 
00159         int getMaxLevelOverride() const;
00160 
00161     private:
00162         MapFrame _mapf;
00163         typedef std::map< osgTerrain::TileID, osg::ref_ptr<osgTerrain::TerrainTile> > TileTable;
00164         TileTable _tileCache;
00165         typedef std::list< osgTerrain::TileID > TileIdList;
00166         TileIdList _tileCacheFIFO;
00167         int _maxCacheSize;
00168         int _tileSize;
00169         unsigned int _maxDataLevel;
00170         int _maxLevelOverride;
00171         Technique _technique;
00172         ElevationInterpolation _interpolation;
00173 
00174     private:
00175         void postCTOR();
00176         void sync();
00177 
00178         bool getElevationImpl(
00179             double x, double y,
00180             double resolution,
00181             const SpatialReference* srs,
00182             double& out_elevation,
00183             double& out_resolution);
00184     };
00185 
00186 } } // namespace osgEarth::Util
00187 
00188 #endif // OSGEARTHUTIL_ELEVATION_MANAGER_H
00189 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines