This file is indexed.

/usr/include/osgEarthUtil/TMSPackager is in libosgearth-dev 2.4.0+dfsg-6.

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
/* -*-c++-*- */
/* osgEarth - Dynamic map generation toolkit for OpenSceneGraph
 * Copyright 2008-2013 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 OSGEARTHUTIL_TMS_PACKAGER_H
#define OSGEARTHUTIL_TMS_PACKAGER_H

#include <osgEarthUtil/Common>
#include <osgEarth/ImageLayer>
#include <osgEarth/ElevationLayer>
#include <osgEarth/Profile>

namespace osgEarth { namespace Util
{
    /**
     * Utility that reads tiles from an ImageLayer or ElevationLayer and stores
     * the resulting data in a disk-based TMS (Tile Map Service) repository.
     *
     * See: http://wiki.osgeo.org/wiki/Tile_Map_Service_Specification
     */
    class OSGEARTHUTIL_EXPORT TMSPackager
    {
    public:
        /**
         * Constructs a new packager.
         * @param profile    Profile of packaged tile data (required)
         */
        TMSPackager( const Profile* outProfile, osgDB::Options* imageWriteOptions);

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

        /**
         * Whether to dump out progress messages 
         * default = false
         */
        void setVerbose( bool value ) { _verbose = value; }
        bool getVerbose() const { return _verbose; }

        /**
         * Whether to abort if a tile writing error is encountered
         * default = true
         */
        void setAbortOnError( bool value ) { _abortOnError = value; }
        bool getAbortOnError() const { return _abortOnError; }

        /**
         * Maximum level of detail of tiles to package
         */
        void setMaxLevel( unsigned value ) { _maxLevel = value; }
        unsigned getMaxLevel() const { return _maxLevel; }

        /**
         * Whether to overwrite files that already exist in the repo
         * default = false
         */
        void setOverwrite( bool value ) { _overwrite = value; }
        bool getOverwrite() const { return _overwrite; }

        /**
         * Whether to package empty image tiles. An empty tile is a tile
         * that is fully transparent. By default, the packager discards
         * them and does not subdivide past them.
         * default = false
         */
        void setKeepEmptyImageTiles( bool value ) { _keepEmptyImageTiles = value; }
        bool getKeepEmptyImageTiles() const { return _keepEmptyImageTiles; }

        /**
         * Whether to subdivide single color image tiles. An single color tile is a tile
         * that is filled with a single color. By default, the packager does not subdivide past them.
         * default = false
         */
        void setSubdivideSingleColorImageTiles( bool value ) { _subdivideSingleColorImageTiles = value; }
        bool getSubdivideSingleColorImageTiles() const { return _subdivideSingleColorImageTiles; }

        /**
         * Bounding box to package
         */
        void addExtent( const GeoExtent& value );

        /**
         * Result structure for method calls
         */
        struct Result {
            Result() : ok(true) { }
            Result(const std::string& m) : message(m), ok(false) { }
            operator bool() const { return ok; }
            bool ok;
            std::string message;
        };

        /**
         * Packages an image layer as a TMS repository.
         * @param layer          Image layer to export
         * @param rootFolder     Root output folder of TMS repo
         * @param imageExtension (optional) Force an image type extension (e.g., "jpg")
         */
        Result package(
            ImageLayer*        layer,
            const std::string& rootFolder,
            const std::string& imageExtension ="png" );

        /**
         * Packages an elevation layer as a TMS repository.
         * @param layer          Image layer to 
         * @param rootFolder     Root output folder of TMS repo
         */
        Result package( 
            ElevationLayer*    layer,
            const std::string& rootFolder );

    protected:

        Result packageImageTile(
            ImageLayer*          layer,
            const TileKey&       key,
            const std::string&   rootDir,
            const std::string&   extension,
            unsigned&            out_maxLevel );

        Result packageElevationTile(
            ElevationLayer*      layer,
            const TileKey&       key,
            const std::string&   rootDir,
            const std::string&   extension,
            unsigned&            out_maxLevel );

        bool shouldPackageKey( 
            const TileKey&     key ) const;

    protected:

        bool                        _verbose;
        bool                        _abortOnError;
        bool                        _overwrite;
        bool                        _keepEmptyImageTiles;
        bool                        _subdivideSingleColorImageTiles;
        unsigned                    _maxLevel;
        std::vector<GeoExtent>      _extents;
        osg::ref_ptr<const Profile> _outProfile;
        osg::ref_ptr<osgDB::Options>    _imageWriteOptions;
    };

} } // namespace osgEarth::Util

#endif // OSGEARTHUTIL_TMS_PACKAGER_H