/usr/include/osgEarth/GeoTransform 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 | /* -*-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_GEO_TRANSFORM
#define OSGEARTH_GEO_TRANSFORM
#include <osgEarth/Common>
#include <osgEarth/Config>
#include <osgEarth/GeoData>
#include <osgEarth/Terrain>
#include <osg/MatrixTransform>
namespace osgEarth
{
class TileKey;
/**
* Transform node that accepts geospatial coordinates.
*/
class OSGEARTH_EXPORT GeoTransform : public osg::MatrixTransform
{
public:
META_Node(osgEarth, GeoTransform);
/** Constructor */
GeoTransform();
/** Copy constructor */
GeoTransform(const GeoTransform& rhs, const osg::CopyOp& op);
/**
* Sets the geospatial position. Returns false upon error.
* This method will only handle a GeoPoint with ALTMODE_ABSOLUTE.
*/
bool setPosition(const GeoPoint& p);
/**
* Gets the last known geospatial position.
*/
const GeoPoint& getPosition() const;
/**
* Sets a reference terrain for this transform. Setting this
* is required if you want to transform positions into the
* terrain's SRS or if you want support for ALTMODE_RELATIVE
* positions.
*/
void setTerrain(Terrain* terrain);
osg::ref_ptr<Terrain> getTerrain() const { osg::ref_ptr<Terrain> t; _terrain.lock(t); return t; }
/**
* Enabling this will cause the object to automatically
* recompute the matrix for an ALTMODE_RELATIVE position if
* the terrain under that position changes. This is disabled
* by default. This functionality requires that you set
* a reference terrain (see setTerrain).
*/
void setAutoRecomputeHeights(bool value);
bool getAutoRecomputeHeights() const { return _autoRecomputeHeights; }
public:
/** Callback that lets the user intercept the compute*Matrix functions during a traversal. */
class OSGEARTH_EXPORT ComputeMatrixCallback : public osg::Referenced
{
public:
virtual bool computeLocalToWorldMatrix(const GeoTransform* xform, osg::Matrix& m, osg::NodeVisitor* nv) const;
virtual bool computeWorldToLocalMatrix(const GeoTransform* xform, osg::Matrix& m, osg::NodeVisitor* nv) const;
};
/** Installs a compute matrix callback */
void setComputeMatrixCallback(ComputeMatrixCallback* cb);
public: // osg::Transform
virtual bool computeLocalToWorldMatrix(osg::Matrix& m, osg::NodeVisitor* nv) const {
return _computeMatrixCallback.valid()
? _computeMatrixCallback->computeLocalToWorldMatrix(this, m, nv)
: osg::MatrixTransform::computeLocalToWorldMatrix(m, nv);
}
virtual bool computeWorldToLocalMatrix(osg::Matrix& m, osg::NodeVisitor* nv) const {
return _computeMatrixCallback.valid()
? _computeMatrixCallback->computeWorldToLocalMatrix(this, m, nv)
: osg::MatrixTransform::computeWorldToLocalMatrix(m, nv);
}
public: // osg::Node
virtual void traverse(osg::NodeVisitor& nv);
public: // TerrainCallback interface
// called when new data pages in and autoRecompute is true
void onTileAdded(const TileKey& key,
osg::Node* node,
TerrainCallbackContext& context);
protected:
virtual ~GeoTransform() { }
GeoPoint _position; // Current position
osg::observer_ptr<Terrain> _terrain; // Terrain for relative height resolution
bool _terrainCallbackInstalled; // Whether the Terrain callback is in
bool _findTerrain; // True is we need _terrain but don't have it
bool _autoRecomputeHeights; // Whether to resolve relative position Z's
bool _dirtyClamp; // Whether a terrain clamp is required
osg::ref_ptr<ComputeMatrixCallback> _computeMatrixCallback;
void configureAutoRecompute(Terrain* terrain);
};
} // namespace osgEarth
#endif // OSGEARTH_GEO_TRANSFORM
|