This file is indexed.

/usr/include/osgEarth/ScreenSpaceLayout 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
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
214
215
216
/* -*-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.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*
* 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_SCREEN_SPACE_LAYOUT_H
#define OSGEARTH_SCREEN_SPACE_LAYOUT_H 1

#include <osgEarth/Common>
#include <osgEarth/Config>
#include <osg/Drawable>
#include <osgUtil/RenderLeaf>
#include <limits.h>

#define OSGEARTH_SCREEN_SPACE_LAYOUT_BIN "osgearth_ScreenSpaceLayoutBin"

namespace osgEarth
{
    /**
     * Interface that exposes layout information.
     */
    class ScreenSpaceLayoutData : public osg::Referenced
    {
    public:
        /** Install and return a LayoutData on a drawable. */
        static ScreenSpaceLayoutData* getOrCreate(osg::Drawable* drawable) {
            if (!drawable) return 0L;
            ScreenSpaceLayoutData* ld = dynamic_cast<ScreenSpaceLayoutData*>(drawable->getUserData());
            if (!ld) {
                ld = new ScreenSpaceLayoutData();
                drawable->setUserData(ld);
            }
            return ld;
        }

        /** Constructor */
        ScreenSpaceLayoutData() :
            _priority(0.0f),
            _pixelOffset(0, 0) { }

        /** Decluttering priority - FLT_MAX means don't declutter */
        void setPriority(float value) { _priority = value; }
        float getPriority() const     { return _priority; }

        /** Offset from geoposition in screen pixels */
        void setPixelOffset(const osg::Vec2s& value) { _pixelOffset = value; }
        const osg::Vec2s& getPixelOffset() const     { return _pixelOffset; }

        /** World point for label rotation reference */
        void setAnchorPoint(const osg::Vec3d& value) { _anchorPoint = value; }
        const osg::Vec3d& getAnchorPoint() const { return _anchorPoint; }

        /** Reference point for label rotation reference */
        void setProjPoint(const osg::Vec3d& value) { _refPoint = value; }
        const osg::Vec3d& getProjPoint() const { return _refPoint; }

    public:
        float      _priority;
        osg::Vec2s _pixelOffset;
        osg::Vec3d _anchorPoint, _refPoint;

    public:
        virtual ~ScreenSpaceLayoutData() { }
    };

    /**
     * Custom functor that compares two RenderLeaf's and returns TRUE if the left-hand one
     * is higher priority, otherwise FALSE. You can call setDeclutterPriorityFunctor()
     * to set a custom priority-sorting functor.
     */
    struct DeclutterSortFunctor : public osg::Referenced
    {
        virtual bool operator() ( const osgUtil::RenderLeaf* lhs, const osgUtil::RenderLeaf* rhs ) const =0;
        virtual ~DeclutterSortFunctor() { }
    };

    /**
     * Options to control the annotation decluttering engine.
     */
    class OSGEARTH_EXPORT ScreenSpaceLayoutOptions : public ConfigOptions
    {
    public:
        ScreenSpaceLayoutOptions( const ConfigOptions& co =ConfigOptions() )
            : ConfigOptions         ( co ),
              _minAnimAlpha         ( 0.35f ),
              _minAnimScale         ( 0.45f ),
              _inAnimTime           ( 0.40f ),
              _outAnimTime          ( 0.00f ),
              _sortByPriority       ( false ),
              _sortByDistance       ( true ),
              _snapToPixel          ( true ),
              _maxObjects           ( INT_MAX ),
              _renderBinNumber      ( 13 )
        {
            fromConfig(_conf);
        }

        virtual ~ScreenSpaceLayoutOptions() { }

        /** Alpha value of a fully-occluded object */
        optional<float>& minAnimationAlpha() { return _minAnimAlpha; }
        const optional<float>& minAnimationAlpha() const { return _minAnimAlpha; }

        /** Scale factor of a fully-occluded object */
        optional<float>& minAnimationScale() { return _minAnimScale; }
        const optional<float>& minAnimationScale() const { return _minAnimScale; }

        /** Time (in seconds) for an object to transition from occluded to visible */
        optional<float>& inAnimationTime() { return _inAnimTime; }
        const optional<float>& inAnimationTime() const { return _inAnimTime; }

        /** Time (in seconds) for an object to transition from visible to occluded */
        optional<float>& outAnimationTime() { return _outAnimTime; }
        const optional<float>& outAnimationTime() const { return _outAnimTime; }

        /** If set, activate the AnnotationData priority-based sorting */
        optional<bool>& sortByPriority() { return _sortByPriority; }
        const optional<bool>& sortByPriority() const { return _sortByPriority; }

        /** If set, activate the AnnotationData distance-based sorting */
        optional<bool>& sortByDistance() { return _sortByDistance; }
        const optional<bool>& sortByDistance() const { return _sortByDistance; }

        /** Whether to always start rendering text on a pixel boundary, thereby 
          * minimizing filtering artifacts. */
        optional<bool>& snapToPixel() { return _snapToPixel; }
        const optional<bool>& snapToPixel() const { return _snapToPixel; }

        /** Maximum number of objects to draw after sorting */
        optional<unsigned>& maxObjects() { return _maxObjects; }
        const optional<unsigned>& maxObjects() const { return _maxObjects; }

        /** Render bin number to use for the screen layout */
        optional<int>& renderOrder() { return _renderBinNumber; }
        const optional<int>& renderOrder() const { return _renderBinNumber; }

    public:

        Config getConfig() const;

    protected:
        optional<float>    _minAnimAlpha;
        optional<float>    _minAnimScale;
        optional<float>    _inAnimTime;
        optional<float>    _outAnimTime;
        optional<bool>     _sortByPriority;
        optional<bool>     _sortByDistance;
        optional<bool>     _snapToPixel;
        optional<unsigned> _maxObjects;
        optional<int>      _renderBinNumber;

        void fromConfig( const Config& conf );
    };

    struct OSGEARTH_EXPORT ScreenSpaceLayout
    {
        /**
         * Assigns a stateset to the screen-space layout engine.
         * Drawables rendered while this stateset is active will be projected from
         * scene space to 2D screen space with optional decluttering.
         */
        static void activate(osg::StateSet* stateSet); //, int binNum =13);

        /**
         * Deactivates the use of the screen-space layout engine for a stateset.
         */
        static void deactivate(osg::StateSet* stateSet);

        /**
         * Enables or disables decluttering globally.
         */
        static void setDeclutteringEnabled(bool enabled);

        /**
         * Applies the provided options to the layout engine.
         */
        static void setOptions(const ScreenSpaceLayoutOptions& options);

        /**
         * Fetches the current layout options
         */
        static const ScreenSpaceLayoutOptions& getOptions();

    public: // advanced

        /**
         * Sets a functor to use to determine render leaf priority for declutter sorting.
         */
        static void setSortFunctor( DeclutterSortFunctor* f );

        /**
         * Clears a custom priority functor that was set using setDeclutterPriorityFunctor,
         * reverting to the default behavior (which is to sort by distance from the camera).
         */
        static void clearSortFunctor();
    };

} // namespace osgEarth

#endif //OSGEARTH_SCREEN_SPACE_LAYOUT_H