2
/* osgEarth - Dynamic map generation toolkit for OpenSceneGraph
3
* Copyright 2008-2010 Pelican Mapping
6
* osgEarth is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU Lesser General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU Lesser General Public License for more details.
16
* You should have received a copy of the GNU Lesser General Public License
17
* along with this program. If not, see <http://www.gnu.org/licenses/>
20
#ifndef OSGEARTH_LOCATORS_H
21
#define OSGEARTH_LOCATORS_H 1
23
#include <osgEarth/Common>
24
#include <osgEarth/GeoData>
25
#include <osgTerrain/Locator>
30
* Locator that stores the extent of its source data (which might be different
31
* than the extent of the locator's transform). This locator can also automatically
32
* crop out a section of the source image.
34
class OSGEARTH_EXPORT GeoLocator : public osgTerrain::Locator
39
GeoLocator( const GeoExtent& dataExtent );
41
GeoLocator( const osgTerrain::Locator& prototype, const GeoExtent& dataExtent );
43
/** Construct a locator that crops to a display extent. */
44
GeoLocator( const osgTerrain::Locator& prototype, const GeoExtent& dataExtent, const GeoExtent& displayExtent );
46
static GeoLocator* createForKey( const class TileKey& key, const class MapInfo& mapInfo );
48
void setDataExtent( const GeoExtent& extent );
49
const GeoExtent& getDataExtent() const;
51
/** Clones the current locator, applying a new display (i.e. crop) extent. */
52
virtual GeoLocator* cloneAndCrop( const osgTerrain::Locator& prototype, const GeoExtent& displayExtent ) const;
54
virtual GeoLocator* getGeographicFromGeocentric( ) const;
56
virtual bool isEquivalentTo( const GeoLocator& rhs ) const;
59
virtual bool convertModelToLocal(const osg::Vec3d& world, osg::Vec3d& local) const;
62
void cropLocal( osg::Vec3d& local ) const;
64
bool _inverseCalculated;
67
GeoExtent _dataExtent;
68
double _x0, _y0, _x1, _y1;
73
* A terrain locator that generates texture coordinates that warp a Mercator image.
75
* Note: the MercatorLocator doesn't have a "cropping" variation b/c it automatically
76
* self-crops as necessary.
78
class OSGEARTH_EXPORT MercatorLocator : public GeoLocator
81
MercatorLocator( const osgTerrain::Locator& prototype, const GeoExtent& dataExtent );
83
//virtual bool convertLocalToModel(const osg::Vec3d& local, osg::Vec3d& model) const;
84
virtual bool convertModelToLocal(const osg::Vec3d& world, osg::Vec3d& local) const;
86
/** Clones the current locator, applying a new display (i.e. crop) extent. */
87
virtual GeoLocator* cloneAndCrop( const osgTerrain::Locator& prototype, const GeoExtent& displayExtent );
89
virtual GeoLocator* getGeographicFromGeocentric( );
92
GeoExtent _geoDataExtent;
96
#endif // OSGEARTH_LOCATORS_H