This file is indexed.

/usr/include/osgEarthUtil/MGRSFormatter 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
/* -*-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_MGRS_FORMATTER_H
#define OSGEARTH_UTIL_MGRS_FORMATTER_H

#include <osgEarthUtil/Formatter>
#include <osgEarth/StringUtils>
#include <osgEarth/Units>

namespace osgEarth { namespace Util
{
    using namespace osgEarth;

    /**
     * Represents an MGRS coordinate in its parts 
     */
    struct MGRSCoord
    {
        std::string gzd;
        std::string sqid;
        unsigned    x;
        unsigned    y;
    };

    /**
     * Formats coordinate data as MGRS.
     *
     * NOTE: This class does not yet handle the special UTM zone exceptions for
     *       southwest Norway (zone 32V) and Svalbard (31X, 33X, 35X, 37X).. 
     *       mainly because I have not found sufficient documentation on them
     *
     * See: http://en.wikipedia.org/wiki/Military_grid_reference_system
     */
    class OSGEARTHUTIL_EXPORT MGRSFormatter : public Formatter
    {
    public:
        enum Precision
        {
            PRECISION_100000M = 100000,     // i.e., omit the numerical offsets altogether
            PRECISION_10000M  = 10000,
            PRECISION_1000M   = 1000,
            PRECISION_100M    = 100,
            PRECISION_10M     = 10,
            PRECISION_1M      = 1
        };

        enum Options
        {
            USE_SPACES        = 1 << 0,     // insert spaces between MGRS elements
            FORCE_AA_SCHEME   = 1 << 1,     // use the AA row lettering scheme regardless of ellipsoid
            FORCE_AL_SCHEME   = 1 << 2      // use the AL row lettering scheme regardless of ellipsoid
        };

    public:
        /**
         * Initialized an MGRS formatter. 
         *
         * @param precision Precision with which to print the MGRS string (see Precision above)
         * @param refSRS    Reference geographic SRS for MGRS encoding. Older datums
         *                  (Clark and Bessel) change the row lettering scheme. Default=WGS84.
         * @param options   Formatting options (see Options above)
         */
        MGRSFormatter(
            Precision               precision =PRECISION_1M,
            const SpatialReference* refSRS    =0L,
            unsigned                options   =0);

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

        /**
         * Transforms input coords into MGRS.
         */
        bool transform( const GeoPoint& input, MGRSCoord& out_mgrs ) const;


    public: // Formatter

        virtual std::string format( const GeoPoint& coords ) const;


    private:
        osg::ref_ptr<const SpatialReference> _refSRS;
        bool                                 _useAL;
        Precision                            _precision;
        unsigned                             _options;

        std::map< std::string, osg::ref_ptr<const SpatialReference> > _srsCache;
    };

} } // namespace osgEarth::Util

#endif // OSGEARTH_UTIL_MGRS_FORMATTER_H