From: James Turner Date: Thu, 21 Jan 2016 03:45:48 +0000 (-0500) Subject: Sink more properties into View X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=e404ebc38ac203ac5cbe94a6db5214e3e7cee910;p=flightgear.git Sink more properties into View --- diff --git a/src/Viewer/viewer.cxx b/src/Viewer/viewer.cxx index e7a90b22d..16eaeec83 100644 --- a/src/Viewer/viewer.cxx +++ b/src/Viewer/viewer.cxx @@ -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() { } diff --git a/src/Viewer/viewer.hxx b/src/Viewer/viewer.hxx index e556e6411..15d2dd7b1 100644 --- a/src/Viewer/viewer.hxx +++ b/src/Viewer/viewer.hxx @@ -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 // ////////////////////////////////////////////////////////////////// diff --git a/src/Viewer/viewmgr.cxx b/src/Viewer/viewmgr.cxx index 588bbf2e5..a983df6aa 100644 --- a/src/Viewer/viewmgr.cxx +++ b/src/Viewer/viewmgr.cxx @@ -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 () { diff --git a/src/Viewer/viewmgr.hxx b/src/Viewer/viewmgr.hxx index 9dd6ed33c..5649f8308 100644 --- a/src/Viewer/viewmgr.hxx +++ b/src/Viewer/viewmgr.hxx @@ -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 config_list; SGPropertyNode_ptr _viewNumberProp; typedef std::vector viewer_list; viewer_list views; - SGVec3d abs_viewer_position; int current;