This file is indexed.

/usr/include/osgEarthQt/TerrainProfileWidget 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
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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
/* -*-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 OSGEARTHQT_TERRAINPROFILEWIDGET_H
#define OSGEARTHQT_TERRAINPROFILEWIDGET_H 1

#include <osgEarthQt/Actions>
#include <osgEarthQt/Common>
#include <osgEarthQt/DataManager>
#include <osgEarthQt/TerrainProfileGraph>

#include <osgEarth/Map>
#include <osgEarthAnnotation/FeatureNode>
#include <osgEarthAnnotation/PlaceNode>
#include <osgEarthFeatures/Feature>

#include <QFrame>
#include <QHBoxLayout>
#include <QPushButton>
#include <QVBoxLayout>
#include <QWidget>

namespace osgEarth { namespace QtGui
{
    /**
     * Widget that displays a TerrainProfileGraph and provides interactive
     * query and zoom controls.
     */     
    class OSGEARTHQT_EXPORT TerrainProfileWidget : public QFrame
    {
    Q_OBJECT

    public:
      TerrainProfileWidget(osg::Group* root, osgEarth::MapNode* mapNode);

      virtual ~TerrainProfileWidget();

      void setActiveView(osgViewer::View* view);

      void setActiveViews(const ViewVector& views);

      void setStartEnd(const GeoPoint& start, const GeoPoint& end);

      void updatePosition(double lat, double lon, const std::string& text);

    public:
      void notifyTerrainProfileChanged() { emit onNotifyTerrainProfileChanged(); }

    signals:
        void onNotifyTerrainProfileChanged();

    private slots:
      void onCaptureToggled(bool checked);
      void onUndoZoom();
      void onTerrainProfileChanged();

    protected:  
      void initialize();
      void addView(osgViewer::View* view);
      void removeViews();
      void refreshViews();
      void hideEvent(QHideEvent* e);
      void showEvent(QShowEvent* e);

    private:

      struct StartEndPair
      {
        GeoPoint start;
        GeoPoint end;

        StartEndPair(GeoPoint profileStart, GeoPoint profileEnd)
        {
          start = profileStart;
          end = profileEnd;
        }
      };

      void drawProfileLine();

      osg::ref_ptr<osg::Group>                                _root;
      osg::ref_ptr<osgEarth::MapNode>                         _mapNode;
      ViewVector                                              _views;
      osg::ref_ptr<osgEarth::Util::TerrainProfileCalculator>  _calculator;
      TerrainProfileGraph*                                    _graph;
      QAction*                                                _captureAction;
      QAction*                                                _undoZoomAction;
      osg::ref_ptr<osgGA::GUIEventHandler>                    _guiHandler;
      std::vector<StartEndPair>                               _profileStack;
      osg::ref_ptr<osgEarth::Annotation::FeatureNode>         _lineNode;
      osgEarth::Symbology::Style                              _lineStyle;
      osg::ref_ptr<osgEarth::Annotation::PlaceNode>           _markerNode;
      osg::ref_ptr<osg::Image>                                _markerImage;
      osgEarth::Symbology::Style                              _placeStyle;
    };


    /**
     * Event handler for entering a new terrain profile line.
     */
    struct TerrainProfileMouseHandler : public osgGA::GUIEventHandler
    {
      TerrainProfileMouseHandler(osgEarth::MapNode* mapNode, osg::Group* root, TerrainProfileWidget* profileWidget)
        : _mapNode(mapNode), _root(root), _profileWidget(profileWidget), _capturing(false), _startValid(false), _mouseDown(false)
      {
        //Define a style for the line
        osgEarth::Symbology::LineSymbol* ls = _lineStyle.getOrCreateSymbol<osgEarth::Symbology::LineSymbol>();
        ls->stroke()->color() = osgEarth::Symbology::Color::Yellow;
        ls->stroke()->width() = 2.0f;
        ls->tessellation() = 20;
        _lineStyle.getOrCreate<osgEarth::Symbology::AltitudeSymbol>()->clamping() = osgEarth::Symbology::AltitudeSymbol::CLAMP_TO_TERRAIN;
      }

      void setCapturing(bool capturing)
      {
        _capturing = capturing;
      }

      bool handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa )
      {
        if (_capturing)
        {
          if ( ea.getEventType() == osgGA::GUIEventAdapter::PUSH )
          {
            if (ea.getButton() == osgGA::GUIEventAdapter::LEFT_MOUSE_BUTTON)
            {
              _mouseDown = true;
              _xDown = ea.getX();
              _yDown = ea.getY();
              aa.requestRedraw();
            }
          }
          else if (ea.getEventType() == osgGA::GUIEventAdapter::RELEASE)
          {
            if (ea.getButton() == osgGA::GUIEventAdapter::LEFT_MOUSE_BUTTON)
            {
              if (_mouseDown && _xDown == ea.getX() && _yDown == ea.getY())
              {
                osg::Vec3d world;
                if ( _mapNode->getTerrain()->getWorldCoordsUnderMouse( aa.asView(), ea.getX(), ea.getY(), world ))
                {
                  osgEarth::GeoPoint mapPoint;
                  mapPoint.fromWorld( _mapNode->getMapSRS(), world );
                  //_mapNode->getMap()->worldPointToMapPoint( world, mapPoint );

                  if (!_startValid)
                  {
                    _start = mapPoint.vec3d();
                    _end = mapPoint.vec3d();
                    _startValid = true;
                  }
                  else
                  {
                    _end = mapPoint.vec3d();
                    _startValid = false;

                    _profileWidget->setStartEnd(GeoPoint(_mapNode->getMapSRS(), _start.x(), _start.y()),
                                                GeoPoint(_mapNode->getMapSRS(), _end.x(), _end.y()));
                  }

                  updateDisplay();
                }
              }

              _mouseDown = false;
              aa.requestRedraw();
            }
          }
          else if (ea.getEventType() == osgGA::GUIEventAdapter::MOVE)
          {
            if (_startValid)
            {
              osg::Vec3d world;
              if (_mapNode->getTerrain()->getWorldCoordsUnderMouse(aa.asView(), ea.getX(), ea.getY(), world))
              {
                osgEarth::GeoPoint mapPoint;
                mapPoint.fromWorld( _mapNode->getMapSRS(), world );
                //_mapNode->getMap()->worldPointToMapPoint( world, mapPoint );
                _end = mapPoint.vec3d();

                updateDisplay();
                aa.requestRedraw();
              }
            }
          }
        }

        return false;
      }

      void updateDisplay()
      {
        if (!_startValid)
        {
          if (_featureNode.valid())
          {
            _root->removeChild( _featureNode.get() );
            _featureNode = 0L;
          }

          return;
        }

        osgEarth::Symbology::LineString* line = new osgEarth::Symbology::LineString();
        line->push_back( _start );
        line->push_back( _end );

        osgEarth::Features::Feature* feature = new osgEarth::Features::Feature(line, _mapNode->getMapSRS());
        feature->geoInterp() = osgEarth::GEOINTERP_GREAT_CIRCLE;    
        feature->style() = _lineStyle;

        if (!_featureNode.valid())
        {
          _featureNode = new osgEarth::Annotation::FeatureNode( _mapNode, feature );
          _featureNode->getOrCreateStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
          _root->addChild( _featureNode.get() );
        }
        else
        {
          _featureNode->setFeature(feature);
        }
      }

      
      osg::ref_ptr<osgEarth::MapNode>  _mapNode;
      osg::Group* _root;
      TerrainProfileWidget* _profileWidget;
      osg::ref_ptr<osgEarth::Annotation::FeatureNode> _featureNode;
      osgEarth::Symbology::Style _lineStyle;
      osg::Vec3d _start;
      osg::Vec3d _end;
      bool _capturing;
      bool _startValid;
      bool _mouseDown;
      float _xDown, _yDown;
    };
} }

#endif // OSGEARTHQT_TERRAINPROFILEWIDGET_H