]> git.mxchange.org Git - flightgear.git/commitdiff
Sink more properties into View
authorJames Turner <zakalawe@mac.com>
Thu, 21 Jan 2016 03:45:48 +0000 (22:45 -0500)
committerJames Turner <zakalawe@mac.com>
Wed, 17 Feb 2016 21:25:39 +0000 (21:25 +0000)
src/Viewer/viewer.cxx
src/Viewer/viewer.hxx
src/Viewer/viewmgr.cxx
src/Viewer/viewmgr.hxx

index e7a90b22d6e95bc4da08caab00ab2f877905f314..16eaeec8362499c96bd41d200f89c60dbad0dcd8 100644 (file)
@@ -261,6 +261,15 @@ View::bind ()
                         &View::set_aspect_ratio_multiplier,
                         false);
 
+    _tiedProperties.Tie("ground-level-nearplane-m", this,
+                        &View::getNear_m, &View::setNear_m, false);
+    fgSetArchivable("/sim/current-view/ground-level-nearplane-m");
+
+
+    _tiedProperties.Tie("viewer-lon-deg", this, &View::getLon_deg);
+    _tiedProperties.Tie("viewer-lat-deg", this, &View::getLat_deg);
+    _tiedProperties.Tie("viewer-elev-ft", this, &View::getElev_ft);
+
 // expose various quaternions under the debug/ subtree
     _tiedProperties.Tie("debug/orientation-w", this, &View::getOrientation_w);
     _tiedProperties.Tie("debug/orientation-x", this, &View::getOrientation_x);
@@ -1067,6 +1076,21 @@ double View::get_aspect_ratio() const
     return flightgear::CameraGroup::getDefault()->getMasterAspectRatio();
 }
 
+double View::getLon_deg() const
+{
+    return _position.getLongitudeDeg();
+}
+
+double View::getLat_deg() const
+{
+    return _position.getLatitudeDeg();
+}
+
+double View::getElev_ft() const
+{
+    return _position.getElevationFt();
+}
+
 View::PositionAttitudeProperties::PositionAttitudeProperties()
 {
 }
index e556e6411621abaeb2c4cbbe16db8dd5dc318f84..15d2dd7b10ce1c9ffd5fab9dea93499ad1f50ba9 100644 (file)
@@ -278,6 +278,10 @@ private:
     double getOrOffset_y() const;
     double getOrOffset_z() const;
 
+    double getLon_deg() const;
+    double getLat_deg() const;
+    double getElev_ft() const;
+
     //////////////////////////////////////////////////////////////////
     // private data                                                 //
     //////////////////////////////////////////////////////////////////
index 588bbf2e587ad4a8992eb546913ce841f6b1161d..a983df6aa4324df4fd2fe4d691e95f30de5ed5e9 100644 (file)
@@ -127,15 +127,6 @@ FGViewMgr::bind()
                         (double_getter)0, &FGViewMgr::setViewAxisLat);
     fgSetArchivable("/sim/current-view/axes/lat");
 
-    _tiedProperties.Tie("ground-level-nearplane-m", this,
-                        &FGViewMgr::getNear_m, &FGViewMgr::setNear_m);
-    fgSetArchivable("/sim/current-view/ground-level-nearplane-m");
-
-    _tiedProperties.Tie("viewer-lon-deg", this, &FGViewMgr::getViewLon_deg);
-    _tiedProperties.Tie("viewer-lat-deg", this, &FGViewMgr::getViewLat_deg);
-    _tiedProperties.Tie("viewer-elev-ft", this, &FGViewMgr::getViewElev_ft);
-
-
     current_x_offs = fgGetNode("/sim/current-view/x-offset-m", true);
     current_y_offs = fgGetNode("/sim/current-view/y-offset-m", true);
     current_z_offs = fgGetNode("/sim/current-view/z-offset-m", true);
@@ -431,21 +422,6 @@ FGViewMgr::setView (int newview)
     update(0.0);
 }
 
-double
-FGViewMgr::getNear_m () const
-{
-  const flightgear::View * view = get_current_view();
-  return (view == 0 ? 0.5f : view->getNear_m());
-}
-
-void
-FGViewMgr::setNear_m (double near_m)
-{
-  flightgear::View * view = get_current_view();
-  if (view != 0)
-    view->setNear_m(near_m);
-}
-
 void
 FGViewMgr::setViewAxisLong (double axis)
 {
@@ -458,27 +434,6 @@ FGViewMgr::setViewAxisLat (double axis)
   axis_lat = axis;
 }
 
-double
-FGViewMgr::getViewLon_deg() const
-{
-  const flightgear::View* view = get_current_view();
-  return (view != NULL) ? view->getPosition().getLongitudeDeg() : 0.0;
-}
-
-double
-FGViewMgr::getViewLat_deg() const
-{
-  const flightgear::View* view = get_current_view();
-  return (view != NULL) ? view->getPosition().getLatitudeDeg() : 0.0;
-}
-
-double
-FGViewMgr::getViewElev_ft() const
-{
-  const flightgear::View* view = get_current_view();
-  return (view != NULL) ? view->getPosition().getElevationFt() : 0.0;
-}
-
 void
 FGViewMgr::do_axes ()
 {
index 9dd6ed33c0513109cdd35af2bdea29df25e60825..5649f83083e444f83fa03632d861577b2670866c 100644 (file)
@@ -101,23 +101,16 @@ private:
     double getViewTargetZOffset_m () const;
     void setViewTargetZOffset_m (double z);
 
-    double getNear_m () const;
-    void setNear_m (double near_m);
     void setViewAxisLong (double axis);
     void setViewAxisLat (double axis);
     int getView () const;
     void setView (int newview);
 
-    double getViewLon_deg() const;
-    double getViewLat_deg() const;
-    double getViewElev_ft() const;
-
     bool inited;
     std::vector<SGPropertyNode_ptr> config_list;
     SGPropertyNode_ptr _viewNumberProp;
     typedef std::vector<flightgear::ViewPtr> viewer_list;
     viewer_list views;
-    SGVec3d abs_viewer_position;
 
     int current;