This file is indexed.

/usr/include/osgEarth/Cube is in libosgearth-dev 2.5.0+dfsg-8build1.

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
/* -*-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 OSGEARTH_CUBE_H
#define OSGEARTH_CUBE_H 1

#include <osgEarth/Common>
#include <osgEarth/Profile>
#include <osgEarth/TileKey>
#include <osgEarth/Locators>

namespace osgEarth
{
    /**
     * Utilities for working with cube and cubeface coordinates.
     */
    class OSGEARTH_EXPORT CubeUtils
    {
    public:
        /**
         * Converts lat/long into face coordinates. You can optionally supply a "face hint"
         * if you already know which face the result will be in. This is handy for resolving
         * border ambiguities (i.e. a lat/lon that falls on the border of two faces).
         */
        static bool latLonToFaceCoords(
            double lat_deg, double lon_deg,
            double& out_x, double& out_y, int& out_face,
            int faceHint = -1 );

        /**
         * Converts face coordinates into lat/long.
         */
        static bool faceCoordsToLatLon(
            double x, double y, int face,
            double& out_lat_deg, double& out_lon_deg );

        /**
         * Get the face # containing a TileKey.
         */
        static int getFace( const TileKey& key );
        
        /**
         * Converts cube coordinates (0,0=>6,1) to face coordinates (0,0=>1,1,F).
         * WARNING. If the cube coordinate lies on a face boundary, this method will
         * always return the lower-numbered face. The "extent" version of this 
         * method (below) is better b/c it's unambiguous.
         */
        static bool cubeToFace( 
            double& in_out_x, 
            double& in_out_y, 
            int&    out_face );

        /**
         * Converts cube coordinates (0,0=>6,1) to face coordinates (0,0=>1,1,F). This
         * version takes an extent, which is better than the non-extent version since it
         * can resolve face-border ambiguity.
         */
        static bool cubeToFace( 
            double& in_out_xmin, double& in_out_ymin, 
            double& in_out_xmax, double& in_out_ymax, 
            int&    out_face );

        /**
         * Converts face coordinates (0,0=>1,1 +F) to cube coordinates (0,0=>6,1).
         */
        static bool faceToCube(
            double& in_out_x, double& in_out_y, 
            int     face );
    };

    /**
     * osgTerrain locator for positioning data on the terrain using a cube-face
     * coordinate system.
     */
    class OSGEARTH_EXPORT CubeFaceLocator : public GeoLocator
    {
    public:
        CubeFaceLocator(unsigned int face);

        /** dtor */
        virtual ~CubeFaceLocator();

        // This method will generate geocentric vertex coordinates, given local tile
        // coordinates (0=>1).
        bool convertLocalToModel(const osg::Vec3d& local, osg::Vec3d& world) const;

        // This method will generate the texture coordinates for a given location on
        // the globe.
        bool convertModelToLocal(const osg::Vec3d& world, osg::Vec3d& local) const;

    private:
        unsigned int _face;
    };

    /**
     * The "Cube" SRS represents a 6-face cube, each face being in unit coordinates (0,0=>1,1).
     * the cube as whole lays out all six faces side by side, resulting in a space 
     * measuring (0,0=>6,1). The face number corresponds to the x-axis ordinal.
     */
    class OSGEARTH_EXPORT CubeSpatialReference : public SpatialReference
    {
    public:
        CubeSpatialReference(void* handle);

        /** dtor */
        virtual ~CubeSpatialReference();

        virtual GeoLocator* createLocator(
            double xmin, double ymin, double xmax, double ymax,
            bool plate_carre =false) const;

        // CUBE is a projected coordinate system.
        virtual bool isGeographic() const { return false; }
        virtual bool isProjected() const { return true; }

        // This SRS uses a WGS84 lat/long SRS under the hood for reprojection. So we need the
        // pre/post transforms to move from cube to latlong and back.
        virtual bool preTransform ( std::vector<osg::Vec3d>& points ) const;
        virtual bool postTransform( std::vector<osg::Vec3d>& points ) const;

        virtual bool transformExtentToMBR(
            const SpatialReference* to_srs,
            double&                 in_out_xmin,
            double&                 in_out_ymin,
            double&                 in_out_xmax,
            double&                 in_out_ymax ) const;

    protected: // SpatialReference overrides

        void _init();

    };

    /**
     * Custom profile for the unified cube tile layout.
     *
     * This is a whole-earth profile consisting of 6 cube faces. The first 4 faces
     * represent the equatorial regions between -45 and 45 degrees latitude. The lat
     * 2 faces represent the polar regions. 
     *
     * The face extents in lat/long are: (lat,lon min => lat,lon max)
     *
     *  Face 0 : (-180, -45 => -90, 45)
     *  Face 1 : (-90, -45 => 0, 45)
     *  Face 2 : (0, -45 => 90, 45)
     *  Face 3 : (90, -45 => 180, 45 )
     *  Face 4 : (-180, 45 => 180, 90)
     *  Face 5 : (-180, -90 => 180, -45)
     *
     * Each face was a local unit coordinate system of (0.0, 0.0 => 1.0, 1.0). The
     * profile lays the 6 faces out in a row, making a cube coordinate system
     * of (0.0, 0.0 => 6.0, 1.0).
     *
     * NOTE! This profile is non-contiguous and cannot be created as a single
     * rectangular domain.
     */
    class OSGEARTH_EXPORT UnifiedCubeProfile : public Profile
    {
    public:
        UnifiedCubeProfile();

        virtual ~UnifiedCubeProfile();

    public: // utilities

        /**
         * Gets the cube face associated with a tile key (in cube srs).
         */
        static int getFace( const TileKey& key );

    public: // Profile

        virtual void getIntersectingTiles(
            const GeoExtent& extent,
            std::vector< TileKey >& out_intersectingKeys ) const;

    private:

        GeoExtent _faceExtent_gcs[6];
        
        GeoExtent transformGcsExtentOnFace( const GeoExtent& gcsExtent, int face ) const;
    };
}

#endif // OSGEARTH_CUBE_H