osgEarth 2.1.1

/home/cube/sources/osgearth/src/osgEarth/VerticalSpatialReference

Go to the documentation of this file.
00001 /* -*-c++-*- */
00002 /* osgEarth - Dynamic map generation toolkit for OpenSceneGraph
00003  * Copyright 2008-2010 Pelican Mapping
00004  * http://osgearth.org
00005  *
00006  * osgEarth is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU Lesser General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public License
00017  * along with this program.  If not, see <http://www.gnu.org/licenses/>
00018  */
00019 #ifndef OSGEARTH_VERTICAL_SPATIAL_REFERENCE_H
00020 #define OSGEARTH_VERTICAL_SPATIAL_REFERENCE_H 1
00021 
00022 #include <osgEarth/Common>
00023 #include <osgEarth/Units>
00024 #include <osg/Shape>
00025 
00026 namespace osgEarth
00027 {
00028     class Geoid;
00029     class GeoExtent;
00030 
00034     class OSGEARTH_EXPORT VerticalSpatialReference : public osg::Referenced
00035     {
00036     public:
00040         static VerticalSpatialReference* create( const std::string& init );
00041 
00044         static void registerGeoid( const Geoid* geoid );
00045 
00046     public:
00051         bool transform( 
00052             const VerticalSpatialReference* toVSRS, 
00053             double lat_deg, double lon_deg, double z,
00054             double& out_z ) const;
00055 
00060         bool canTransform( const VerticalSpatialReference* toVSRS ) const;
00061 
00065         static bool canTransform( 
00066             const VerticalSpatialReference* from,
00067             const VerticalSpatialReference* toVSRS );
00068 
00074         osg::HeightField* createReferenceHeightField(const GeoExtent& extent, int cols, int rows) const;
00075 
00077         const std::string& getName() const { return _name; }
00078 
00080         const Units& getUnits() const { return _units; }
00081 
00083         const std::string& getInitString() const { return _initString; }
00084 
00086         virtual bool isEquivalentTo( const VerticalSpatialReference* rhs ) const;
00087         
00088     public:
00090         VerticalSpatialReference(
00091             const std::string& name,
00092             const std::string& initString,
00093             const Geoid* geoid );
00094 
00096         VerticalSpatialReference( const Units& units );
00097 
00098         std::string _name;
00099         std::string _initString;
00100         osg::ref_ptr<const Geoid> _geoid;
00101         Units _units;
00102 
00103         typedef std::map<std::string, osg::ref_ptr<const Geoid> > GeoidRegistry;
00104         static GeoidRegistry* _geoidRegistry;
00105     };
00106 
00107 #if 0
00108 
00109     template<class T>
00110     struct  GeoidRegisterProxy {
00111         GeoidRegisterProxy() {
00112             VerticalSpatialReference::registerGeoid( new T );
00113         }
00114     };
00115 #endif
00116 
00117 }
00118 
00119 #endif // OSGEARTH_VERTICAL_SPATIAL_REFERENCE_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines