osgEarth 2.1.1

/home/cube/sources/osgearth/src/osgEarth/ElevationQuery

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 OSGEARTH_ELEVATION_QUERY_H
00020 #define OSGEARTH_ELEVATION_QUERY_H 1
00021 
00022 #include <osgEarth/Map>
00023 #include <osgEarth/MapNode>
00024 #include <osgEarth/Utils>
00025 
00026 namespace osgEarth
00027 {
00050     class OSGEARTH_EXPORT ElevationQuery
00051     {
00052     public:
00054         enum Technique
00055         {
00058             TECHNIQUE_GEOMETRIC,
00059 
00061             TECHNIQUE_PARAMETRIC
00062         };
00063 
00064     public:
00075         ElevationQuery( const Map* map );
00076         ElevationQuery( const MapFrame& mapFrame );
00077 
00096         bool getElevation(
00097             const osg::Vec3d&       point,
00098             const SpatialReference* pointSRS,
00099             double&                 out_elevation,
00100             double                  desiredResolution    =0.0,
00101             double*                 out_actualResolution =0L );
00102 
00108         bool getElevations(
00109             std::vector<osg::Vec3d>& points,
00110             const SpatialReference*  pointsSRS,
00111             bool                     ignoreZ = true,
00112             double                   desiredResolution =0.0 );
00113 
00118         bool getElevations(
00119             const std::vector<osg::Vec3d>& points,
00120             const SpatialReference*        pointsSRS,
00121             std::vector<double>&           out_elevations,
00122             double                         desiredResolution = 0.0 );
00123 
00128         void setTechnique( Technique technique );
00129 
00134         Technique getTechnique() const;
00135 
00139         void setMaxTilesToCache( int value );
00140 
00144         int getMaxTilesToCache() const;
00145 
00149         void setInterpolation( ElevationInterpolation interp );
00150 
00154         ElevationInterpolation getElevationInterpolation() const;
00155 
00160         void setMaxLevelOverride(int maxLevelOverride);
00161 
00165         int getMaxLevelOverride() const;
00166 
00167     private:
00168         MapFrame _mapf;
00169         unsigned _maxCacheSize;
00170         int _tileSize;
00171         unsigned int _maxDataLevel;
00172         int _maxLevelOverride;
00173         Technique _technique;
00174         ElevationInterpolation _interpolation;
00175 
00176         typedef LRUCache< TileKey, osg::ref_ptr<osgTerrain::TerrainTile> > TileCache;
00177         TileCache _tileCache;
00178 
00179 
00180     private:
00181         void postCTOR();
00182         void sync();
00183 
00184         bool getElevationImpl(
00185             const osg::Vec3d&       point,
00186             const SpatialReference* pointSRS,
00187             double&                 out_elevation,
00188             double                  desiredResolution,
00189             double*                 out_actualResolution =0L );
00190     };
00191 
00192 } // namespace osgEarth
00193 
00194 #endif // OSGEARTH_ELEVATION_QUERY_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines