This file is indexed.

/usr/include/osgEarth/ElevationQuery is in libosgearth-dev 2.7.0+dfsg-2+b3.

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
/* -*-c++-*- */
/* osgEarth - Dynamic map generation toolkit for OpenSceneGraph
 * Copyright 2015 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.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * 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_ELEVATION_QUERY_H
#define OSGEARTH_ELEVATION_QUERY_H 1

#include <osgEarth/MapFrame>
#include <osgEarth/Containers>
#include <osgEarth/DPLineSegmentIntersector>

namespace osgEarth
{
    class OSGEARTH_EXPORT ElevationQueryCacheReadCallback : public osgUtil::IntersectionVisitor::ReadCallback
    {
        public:
            ElevationQueryCacheReadCallback();

            void setMaximumNumOfFilesToCache(unsigned int maxNumFilesToCache) { _maxNumFilesToCache = maxNumFilesToCache; }
            unsigned int  getMaximumNumOfFilesToCache() const { return _maxNumFilesToCache; }

            void clearDatabaseCache();

            void pruneUnusedDatabaseCache();

            virtual osg::Node* readNodeFile(const std::string& filename);

        protected:

            typedef std::map<std::string, osg::ref_ptr<osg::Node> > FileNameSceneMap;

            unsigned int _maxNumFilesToCache;
            OpenThreads::Mutex  _mutex;
            FileNameSceneMap    _filenameSceneMap;
    };


    /**
     * ElevationQuery (EQ) lets you query the elevation at any point on a map.
     * 
     * Rather than intersecting with a loaded scene graph, EQ uses the osgEarth
     * engine to directly access the best terrain tile for elevation query. You
     * give it the DEM resolution at which you want an elevation point, and it will
     * access the necessary tile and sample it.
     *
     * NOTE: EQ does NOT take into account rendering properties like vertical scale or
     * skirts. If you need a vertical scale, for example, simply scale the resulting
     * elevation value.
     *
     * ElevationQuery is not thread-safe. So not use the same instance of ElevationQuery
     * from multiple threads without mutexing.
     */
    class OSGEARTH_EXPORT ElevationQuery
    {
    public:
        /**
         * Constructs a new elevation manager.
         *
         * @param map
         *      Map against which to perform elevation queries.
         */
        ElevationQuery( const Map* map );
        
        /**
         * Constructs a new elevation manager.
         *
         * @param mapFrame
         *      Map frame against which to perform elevation queries.
         */
        ElevationQuery( const MapFrame& mapFrame );

        /** dtor */
        virtual ~ElevationQuery() { }

        /**
         * Gets the terrain elevation at a point, given a terrain resolution.
         *
         * @param point
         *      Coordinates for which to query elevation.
         * @param out_elevation
         *      Stores the elevation result in this variable upon success.
         * @param desiredResolution
         *      Optimal resolution of elevation data to use for the query (if available).
         *      Pass in 0 (zero) to use the best available resolution.
         * @param out_resolution
         *      Resolution of the resulting elevation value (if the method returns true).
         * 
         * @return True if the query succeeded, false upon failure.
         */
        bool getElevation(
            const GeoPoint& point,
            double&         out_elevation,
            double          desiredResolution    =0.0,
            double*         out_actualResolution =0L );      

        /** 
         * Gets elevations for a whole array of points, storing the result in the
         * "z" element. If "ignoreZ" is false, the new Z value will be offset by
         * the original Z value.
         */
        bool getElevations(
            std::vector<osg::Vec3d>& points,
            const SpatialReference*  pointsSRS,
            bool                     ignoreZ = true,
            double                   desiredResolution =0.0 );

        /**
         * Gets elevations for a whole array of points, storing the results in the
         * "out_elevations" vector.
         */
        bool getElevations(
            const std::vector<osg::Vec3d>& points,
            const SpatialReference*        pointsSRS,
            std::vector<double>&           out_elevations,
            double                         desiredResolution = 0.0 );

        /**
         * Whether a query should fall back on lower resolution data if no results
         * are available at the requested resolution. Default is true.
         */
        void setFallBackOnNoData(bool value) { _fallBackOnNoData = value; }
        bool getFallBackOnNoData() const { return _fallBackOnNoData; }

        /**
         * Sets the maximum cache size for elevation tiles.
         */
        void setMaxTilesToCache( int value );

        /**
         * Gets the maximum cache size for elevation tiles.
         */
        int getMaxTilesToCache() const;
        
        /**
        * Sets the maximum level override for elevation queries.
        * A value of -1 turns off the override.
        */
        void setMaxLevelOverride(int maxLevelOverride);

        /**
        * Gets the maximum level override for elevation queries.
        */
        int getMaxLevelOverride() const;

        /**
         * Gets the average time per query
         */
        double getAverageQueryTime() const { return _queries > 0.0 ? _totalTime/_queries : 0.0; }

        /**
         * Gets the maximum level of data available at the given point.  If the layers have DataExtents provided they
         * will be queried.  This allows certain areas on the earth to have higher levels of detail
         * than others and avoids unnecessary queries where there isn't high resolution data available.
         * Negative return value means there was no data available at the location.
         */
        int getMaxLevel(double x, double y, const SpatialReference* srs, const Profile* profile, unsigned tileSize) const;

        /** Clear the database cache.*/
        void clearDatabaseCache() { if (_eqcrc.valid()) _eqcrc->clearDatabaseCache(); }

        /** Set the ReadCallback that does the reading of external PagedLOD models, and caching of loaded subgraphs.
          * Note, if you have multiple LineOfSight or HeightAboveTerrain objects in use at one time then you should share a single
          * DatabaseCacheReadCallback between all of them. */
        void setElevationQueryCacheReadCallback(ElevationQueryCacheReadCallback* eqcrc);

        /** Get the ReadCallback that does the reading of external PagedLOD models, and caching of loaded subgraphs.*/
        ElevationQueryCacheReadCallback* getElevationQueryCacheReadCallback() { return _eqcrc.get(); }

    private:
        MapFrame     _mapf;
        unsigned     _maxCacheSize;
        int          _tileSize;        
        int          _maxLevelOverride;
        bool         _fallBackOnNoData;

        typedef LRUCache< TileKey, GeoHeightField > TileCache;
        TileCache _cache;
        double _queries;
        double _totalTime;
        std::vector<ModelLayer*> _patchLayers;
        osg::ref_ptr<DPLineSegmentIntersector> _patchLayersLSI;

        osg::ref_ptr<ElevationQueryCacheReadCallback> _eqcrc;

    private:
        void postCTOR();
        void sync();
        void gatherPatchLayers();

        bool getElevationImpl(            
            const GeoPoint& point,
            double&         out_elevation,
            double          desiredResolution,
            double*         out_actualResolution =0L );
    };

} // namespace osgEarth

#endif // OSGEARTH_ELEVATION_QUERY_H