This file is indexed.

/usr/include/osgEarthUtil/FractalElevationLayer is in libosgearth-dev 2.9.0+dfsg-1.

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
/* -*-c++-*- */
/* osgEarth - Dynamic map generation toolkit for OpenSceneGraph
 * Copyright 2016 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_UTIL_FRACTAL_ELEVATION_LAYER
#define OSGEARTH_UTIL_FRACTAL_ELEVATION_LAYER 1

#include <osgEarthUtil/Common>
#include <osgEarth/TileSource>
#include <osgEarth/ElevationLayer>
#include <osgEarth/LayerListener>
#include <osgEarth/URI>
#include <osgEarth/LandCoverLayer>

namespace osgEarth { namespace Util
{
    using namespace osgEarth;

    struct FractalElevationLayerLandCoverMapping
    {
        std::string className;
        optional<float> amplitude;
    };

    typedef std::map<std::string, FractalElevationLayerLandCoverMapping> FractalElevationLayerLandCoverMap;


    /**
     * Serializable options to configure a FractalElevationLayer.
     */
    class OSGEARTHUTIL_EXPORT FractalElevationLayerOptions : public ElevationLayerOptions
    {

    public:
        // constructor
        FractalElevationLayerOptions(const ConfigOptions& co = ConfigOptions());

        //! Simplex noise frequency
        optional<float>& frequency() { return _frequency; }
        const optional<float>& frequency() const { return _frequency; }

        //! Simplex noise persistence
        optional<float>& persistence() { return _persistence; }
        const optional<float>& persistence() const { return _persistence; }
        
        //! Simplex noise lacunarity
        optional<float>& lacunarity() { return _lacunarity; }
        const optional<float>& lacunarity() const { return _lacunarity; }
        
        //! Reference LOD
        optional<unsigned>& baseLOD() { return _baseLOD; }
        const optional<unsigned>& baseLOD() const { return _baseLOD; }

        //! Maximum change in elevation (total)
        optional<float>& amplitude() { return _amplitude; }
        const optional<float>& amplitude() const { return _amplitude; }

        //! Mappings from land cover classes to amplitude values (optional)
        FractalElevationLayerLandCoverMap& landCoverMap() { return _lcMap; }
        const FractalElevationLayerLandCoverMap& landCoverMap() const { return _lcMap; }
        
        //! URI of a noise texture to use to augment to simplex noise
        optional<URI>& noiseImageURI() { return _noiseImageURI; }
        const optional<URI>& noiseImageURI() const { return _noiseImageURI; }

    public:
        Config getConfig() const;

    protected:
        void mergeConfig(const Config& conf) {
            ElevationLayerOptions::mergeConfig(conf);
            fromConfig(conf);
        }

        void fromConfig(const Config& conf);
        
    private:
        optional<float> _frequency;
        optional<float> _persistence;
        optional<float> _lacunarity;
        optional<unsigned> _octaves;
        optional<unsigned> _baseLOD;
        optional<float> _amplitude;
        optional<URI> _noiseImageURI;
        FractalElevationLayerLandCoverMap _lcMap;

    };


    /**
     * Elevation layer that adds fractal noise offset values.
     */
    class OSGEARTHUTIL_EXPORT FractalElevationLayer : public ElevationLayer
    {
    public:
        META_Layer(osgEarth, FractalElevationLayer, FractalElevationLayerOptions);

        //! Create a blank layer to be configurated through options().
        FractalElevationLayer();

        //! Create a layer with initial options.
        FractalElevationLayer(const FractalElevationLayerOptions& options);

    public: // ElevationLayer

        // opens the layer and returns the status
        virtual const Status& open();

        virtual void init();

    protected: // Layer

        // called by the map when this layer is added/removed
        virtual void addedToMap(const class Map*);

        virtual void removedFromMap(const class Map*);

        virtual void createImplementation(
            const TileKey& key,
            osg::ref_ptr<osg::HeightField>& out_hf,
            osg::ref_ptr<NormalMap>& out_normalMap,
            ProgressCallback* progress);

    protected:

        virtual ~FractalElevationLayer();

        osg::observer_ptr<LandCoverLayer> _landCover;
        osg::observer_ptr<LandCoverDictionary> _landCoverDict;

        bool _debug;
        osg::ref_ptr<osg::Image> _noiseImage1;
        osg::ref_ptr<osg::Image> _noiseImage2;

        const FractalElevationLayerLandCoverMapping* getMapping(const LandCoverClass*) const;
    };

} } // namespace osgEarth::Util

#endif // OSGEARTH_UTIL_FRACTAL_ELEVATION_LAYER