osgEarth 2.1.1
|
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 OSGEARTHUTIL_VIEWPOINT 00020 #define OSGEARTHUTIL_VIEWPOINT 00021 00022 #include <osgEarthUtil/Common> 00023 #include <osgEarth/SpatialReference> 00024 #include <osgEarth/Config> 00025 00026 namespace osgEarth { namespace Util 00027 { 00032 class OSGEARTHUTIL_EXPORT Viewpoint 00033 { 00034 public: 00038 Viewpoint(); 00039 00062 Viewpoint( 00063 const osg::Vec3d& focal_point, 00064 double heading_deg, 00065 double pitch_deg, 00066 double range, 00067 const osgEarth::SpatialReference* srs =NULL ); 00068 00069 Viewpoint( 00070 double x_or_lon, double y_or_lat, double z, 00071 double heading_deg, 00072 double pitch_deg, 00073 double range, 00074 const osgEarth::SpatialReference* srs =NULL ); 00075 00101 Viewpoint( 00102 const std::string& name, 00103 const osg::Vec3d& focal_point, 00104 double heading_deg, 00105 double pitch_deg, 00106 double range, 00107 const osgEarth::SpatialReference* srs =NULL ); 00108 00109 Viewpoint( 00110 const std::string& name, 00111 double x_or_lon, double y_or_lat, double z, 00112 double heading_deg, 00113 double pitch_deg, 00114 double range, 00115 const osgEarth::SpatialReference* srs =NULL ); 00116 00120 Viewpoint( const Config& conf ); 00121 00125 Viewpoint( const Viewpoint& rhs ); 00126 00127 public: 00128 00132 bool isValid() const; 00133 00137 void setName( const std::string& name ); 00138 const std::string& getName() const; 00139 00143 const osg::Vec3d& getFocalPoint() const; 00144 void setFocalPoint( const osg::Vec3d& point ); 00145 00146 double x() const; 00147 double& x(); 00148 00149 double y() const; 00150 double& y(); 00151 00152 double z() const; 00153 double& z(); 00154 00158 double getHeading() const; 00159 void setHeading( double heading_deg ); 00160 00164 double getPitch() const; 00165 void setPitch( double pitch_deg ); 00166 00170 double getRange() const; 00171 void setRange( double range ); 00172 00176 const osgEarth::SpatialReference* getSRS() const; 00177 00181 std::string toString() const; 00182 00186 Config getConfig() const; 00187 00188 private: 00189 std::string _name; 00190 osg::Vec3d _focal_point; 00191 double _heading_deg; 00192 double _pitch_deg; 00193 double _range; 00194 osg::ref_ptr<const osgEarth::SpatialReference> _srs; 00195 bool _is_valid; 00196 }; 00197 00198 } } // namespace osgEarth::Util 00199 00200 #endif // OSGEARTHUTIL_VIEWPOINT