]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/globals.cxx
Make HTTPClient a proper subsystem.
[flightgear.git] / src / Main / globals.cxx
index b126d795c1d33f565c4c48f09d0e4a2c0feab6f8..683339dcf03d480056b1e0b46b0efda030247cf6 100644 (file)
@@ -148,6 +148,10 @@ FGGlobals::FGGlobals() :
   positionLat = props->getNode("position/latitude-deg", true);
   positionAlt = props->getNode("position/altitude-ft", true);
   
+  viewLon = props->getNode("sim/current-view/viewer-lon-deg", true);
+  viewLat = props->getNode("sim/current-view/viewer-lat-deg", true);
+  viewAlt = props->getNode("sim/current-view/viewer-elev-ft", true);
+  
   orientPitch = props->getNode("orientation/pitch-deg", true);
   orientHeading = props->getNode("orientation/heading-deg", true);
   orientRoll = props->getNode("orientation/roll-deg", true);
@@ -323,7 +327,7 @@ SGPath FGGlobals::resolve_maybe_aircraft_path(const std::string& branch) const
   return simgear::ResourceManager::instance()->findPath(branch);
 }
 
-SGPath FGGlobals::resolve_ressource_path(const std::string& branch) const
+SGPath FGGlobals::resolve_resource_path(const std::string& branch) const
 {
   return simgear::ResourceManager::instance()
     ->findPath(branch, SGPath(fgGetString("/sim/aircraft-dir")));
@@ -380,7 +384,7 @@ FGGlobals::get_aircraft_position() const
 }
 
 SGVec3d
-FGGlobals::get_aircraft_positon_cart() const
+FGGlobals::get_aircraft_position_cart() const
 {
     return SGVec3d::fromGeod(get_aircraft_position());
 }
@@ -392,6 +396,19 @@ void FGGlobals::get_aircraft_orientation(double& heading, double& pitch, double&
   roll = orientRoll->getDoubleValue();
 }
 
+SGGeod
+FGGlobals::get_view_position() const
+{
+  return SGGeod::fromDegFt(viewLon->getDoubleValue(),
+                           viewLat->getDoubleValue(),
+                           viewAlt->getDoubleValue());
+}
+
+SGVec3d
+FGGlobals::get_view_position_cart() const
+{
+  return SGVec3d::fromGeod(get_view_position());
+}
 
 // Save the current state as the initial state.
 void