osgEarth 2.1.1
|
Public Member Functions | |
Viewpoint () | |
Viewpoint (const osg::Vec3d &focal_point, double heading_deg, double pitch_deg, double range, const osgEarth::SpatialReference *srs=NULL) | |
Viewpoint (double x_or_lon, double y_or_lat, double z, double heading_deg, double pitch_deg, double range, const osgEarth::SpatialReference *srs=NULL) | |
Viewpoint (const std::string &name, const osg::Vec3d &focal_point, double heading_deg, double pitch_deg, double range, const osgEarth::SpatialReference *srs=NULL) | |
Viewpoint (const std::string &name, double x_or_lon, double y_or_lat, double z, double heading_deg, double pitch_deg, double range, const osgEarth::SpatialReference *srs=NULL) | |
Viewpoint (const Config &conf) | |
Viewpoint (const Viewpoint &rhs) | |
bool | isValid () const |
void | setName (const std::string &name) |
const std::string & | getName () const |
const osg::Vec3d & | getFocalPoint () const |
void | setFocalPoint (const osg::Vec3d &point) |
double | x () const |
double & | x () |
double | y () const |
double & | y () |
double | z () const |
double & | z () |
double | getHeading () const |
void | setHeading (double heading_deg) |
double | getPitch () const |
void | setPitch (double pitch_deg) |
double | getRange () const |
void | setRange (double range) |
const osgEarth::SpatialReference * | getSRS () const |
std::string | toString () const |
Config | getConfig () const |
Private Attributes | |
std::string | _name |
osg::Vec3d | _focal_point |
double | _heading_deg |
double | _pitch_deg |
double | _range |
osg::ref_ptr< const osgEarth::SpatialReference > | _srs |
bool | _is_valid |
Viewpoint data object. Stores a view configuration as a focal point and the camera's position relative to that focal point.
Viewpoint::Viewpoint | ( | ) |
Constructs a blank (invalid) viewpoint.
Definition at line 26 of file Viewpoint.cpp.
: _is_valid( false ), _heading_deg(0.0), _pitch_deg(0.0), _range(1.0) { //NOP }
Viewpoint::Viewpoint | ( | const osg::Vec3d & | focal_point, |
double | heading_deg, | ||
double | pitch_deg, | ||
double | range, | ||
const osgEarth::SpatialReference * | srs = NULL |
||
) |
Constructs a new viewpoint.
focal_point | The location at which the camera points. Express this is either cartesian coordinates (for a "flat-earth" model) or in lat/long degrees for a round-earth model. |
heading_deg | Heading (in clockwise degrees) of the camera relative to the tangent plane of the focal point. |
pitch_deg | Pitch (in degrees) of the camera relative to the tangent plane of the focal point. |
range | Straight-line distance from the camera to the focal point. |
srs | (optional) Spatial reference defining the focal point. |
Definition at line 35 of file Viewpoint.cpp.
: _focal_point( focal_point ), _heading_deg( heading_deg ), _pitch_deg( pitch_deg ), _range( range ), _srs( srs ), _is_valid( true ) { //NOP }
Viewpoint::Viewpoint | ( | double | x_or_lon, |
double | y_or_lat, | ||
double | z, | ||
double | heading_deg, | ||
double | pitch_deg, | ||
double | range, | ||
const osgEarth::SpatialReference * | srs = NULL |
||
) |
Definition at line 49 of file Viewpoint.cpp.
: _focal_point( x, y, z ), _heading_deg( heading_deg ), _pitch_deg( pitch_deg ), _range( range ), _srs( srs ), _is_valid( true ) { //NOP }
Viewpoint::Viewpoint | ( | const std::string & | name, |
const osg::Vec3d & | focal_point, | ||
double | heading_deg, | ||
double | pitch_deg, | ||
double | range, | ||
const osgEarth::SpatialReference * | srs = NULL |
||
) |
Constructs a new viewpoint.
name | Name of this viewpoint. |
focal_point | The location at which the camera points. Express this is either cartesian coordinates (for a "flat-earth" model) or in lat/long degrees for a round-earth model. |
heading_deg | Heading (in clockwise degrees) of the camera relative to the tangent plane of the focal point. |
pitch_deg | Pitch (in degrees) of the camera relative to the tangent plane of the focal point. |
range | Straight-line distance from the camera to the focal point. |
srs | (optional) Spatial reference defining the focal point. |
Definition at line 64 of file Viewpoint.cpp.
: _name( name ), _focal_point( focal_point ), _heading_deg( heading_deg ), _pitch_deg( pitch_deg ), _range( range ), _srs( srs ), _is_valid( true ) { //NOP }
Viewpoint::Viewpoint | ( | const std::string & | name, |
double | x_or_lon, | ||
double | y_or_lat, | ||
double | z, | ||
double | heading_deg, | ||
double | pitch_deg, | ||
double | range, | ||
const osgEarth::SpatialReference * | srs = NULL |
||
) |
Definition at line 81 of file Viewpoint.cpp.
: _name( name ), _focal_point( x, y, z ), _heading_deg( heading_deg ), _pitch_deg( pitch_deg ), _range( range ), _srs( srs ), _is_valid( true ) { //NOP }
Viewpoint::Viewpoint | ( | const Config & | conf | ) |
Deserialize a Config into this viewpoint object.
Definition at line 110 of file Viewpoint.cpp.
{ _name = conf.value("name"); if ( conf.hasValue("x") ) { _focal_point.set( conf.value<double>("x", 0.0), conf.value<double>("y", 0.0), conf.value<double>("z", 0.0) ); } else if ( conf.hasValue("lat") ) { _focal_point.set( conf.value<double>("long", 0.0), conf.value<double>("lat", 0.0), conf.value<double>("height", 0.0) ); } _heading_deg = conf.value<double>("heading", 0.0); _pitch_deg = conf.value<double>("pitch", 0.0); _range = conf.value<double>("range", 0.0); _is_valid = _range > 0.0; //TODO: SRS }
Viewpoint::Viewpoint | ( | const Viewpoint & | rhs | ) |
Copy constructor.
Definition at line 98 of file Viewpoint.cpp.
: _name( rhs._name ), _focal_point( rhs._focal_point ), _heading_deg( rhs._heading_deg ), _pitch_deg( rhs._pitch_deg ), _range( rhs._range ), _srs( rhs._srs.get() ), _is_valid( rhs._is_valid ) { //NOP }
Config Viewpoint::getConfig | ( | ) | const |
Serialize this viewpoint to a config.
Definition at line 153 of file Style.cpp.
{ Config conf( "style" ); conf.attr("name") = _name; conf.addIfSet( "url", _uri ); if ( _origType == "text/css" && keepOrigType ) { conf.attr("type") = _origType; conf.value() = _origData; } else { Config symbolsConf( "symbols" ); for( SymbolList::const_iterator i = _symbols.begin(); i != _symbols.end(); ++i ) { symbolsConf.addChild( i->get()->getConfig() ); } conf.addChild( symbolsConf ); } return conf; }
const osg::Vec3d & Viewpoint::getFocalPoint | ( | ) | const |
Gets or sets the location at which the camera is pointing.
Definition at line 184 of file Viewpoint.cpp.
{ return _focal_point; }
double Viewpoint::getHeading | ( | ) | const |
Gets the heading (in degrees) of the camera relative to the focal point.
Definition at line 224 of file Viewpoint.cpp.
{ return _heading_deg; }
const std::string & Viewpoint::getName | ( | ) | const |
Definition at line 174 of file Viewpoint.cpp.
{ return _name; }
double Viewpoint::getPitch | ( | ) | const |
Gets the pitch (in degrees) of the camera relative to the focal point.
Definition at line 234 of file Viewpoint.cpp.
{ return _pitch_deg; }
double Viewpoint::getRange | ( | ) | const |
Gets the distance from the camera to the focal point.
Definition at line 244 of file Viewpoint.cpp.
{ return _range; }
const SpatialReference * Viewpoint::getSRS | ( | ) | const |
Gets the spatial reference system of the focal point, if defined.
Definition at line 254 of file Viewpoint.cpp.
{ return _srs.get(); }
bool Viewpoint::isValid | ( | ) | const |
Returns true if this viewpoint contains valid information.
Definition at line 169 of file Viewpoint.cpp.
{ return _is_valid; }
void Viewpoint::setFocalPoint | ( | const osg::Vec3d & | point | ) |
Definition at line 189 of file Viewpoint.cpp.
{ _focal_point = value; }
void Viewpoint::setHeading | ( | double | heading_deg | ) |
Definition at line 229 of file Viewpoint.cpp.
{ _heading_deg = value; }
void Viewpoint::setName | ( | const std::string & | name | ) |
Gets or sets the name of the viewpoint.
Definition at line 179 of file Viewpoint.cpp.
{ _name = name; }
void Viewpoint::setPitch | ( | double | pitch_deg | ) |
Definition at line 239 of file Viewpoint.cpp.
{ _pitch_deg = value; }
void Viewpoint::setRange | ( | double | range | ) |
Definition at line 249 of file Viewpoint.cpp.
{ _range = value; }
std::string Viewpoint::toString | ( | ) | const |
Returns a printable string with the viewpoint data
Definition at line 259 of file Viewpoint.cpp.
{ std::stringstream buf; buf << "x=" << _focal_point.x() << ", y=" << _focal_point.y() << ", z=" << _focal_point.z() << ", h=" << _heading_deg << ", p=" << _pitch_deg << ", d=" << _range ; std::string str = buf.str(); return str; }
double & Viewpoint::x | ( | ) |
Definition at line 199 of file Viewpoint.cpp.
{ return _focal_point.x(); }
double Viewpoint::x | ( | ) | const |
Definition at line 194 of file Viewpoint.cpp.
{ return _focal_point.x(); }
double & Viewpoint::y | ( | ) |
Definition at line 209 of file Viewpoint.cpp.
{ return _focal_point.y(); }
double Viewpoint::y | ( | ) | const |
Definition at line 204 of file Viewpoint.cpp.
{ return _focal_point.y(); }
double Viewpoint::z | ( | ) | const |
Definition at line 214 of file Viewpoint.cpp.
{ return _focal_point.z(); }
double & Viewpoint::z | ( | ) |
Definition at line 219 of file Viewpoint.cpp.
{ return _focal_point.z(); }
osg::Vec3d osgEarth::Util::Viewpoint::_focal_point [private] |
double osgEarth::Util::Viewpoint::_heading_deg [private] |
bool osgEarth::Util::Viewpoint::_is_valid [private] |
std::string osgEarth::Util::Viewpoint::_name [private] |
double osgEarth::Util::Viewpoint::_pitch_deg [private] |
double osgEarth::Util::Viewpoint::_range [private] |
osg::ref_ptr<const osgEarth::SpatialReference> osgEarth::Util::Viewpoint::_srs [private] |