From: James Turner Date: Thu, 21 Jan 2016 03:51:30 +0000 (-0500) Subject: Simplify setting view eye/target offsets X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=a3382fec6df7ac8ed20416c3f8e1f8c20000ef65;p=flightgear.git Simplify setting view eye/target offsets --- diff --git a/src/Viewer/viewmgr.cxx b/src/Viewer/viewmgr.cxx index a983df6aa..3e4a307b6 100644 --- a/src/Viewer/viewmgr.cxx +++ b/src/Viewer/viewmgr.cxx @@ -168,13 +168,13 @@ FGViewMgr::update (double dt) // these properties aren't tied - manually propogate them to the // currently active view - setViewXOffset_m(current_x_offs->getDoubleValue()); - setViewYOffset_m(current_y_offs->getDoubleValue()); - setViewZOffset_m(current_z_offs->getDoubleValue()); + currentView->setXOffset_m(current_x_offs->getDoubleValue()); + currentView->setYOffset_m(current_y_offs->getDoubleValue()); + currentView->setZOffset_m(current_z_offs->getDoubleValue()); - setViewTargetXOffset_m(target_x_offs->getDoubleValue()); - setViewTargetYOffset_m(target_y_offs->getDoubleValue()); - setViewTargetZOffset_m(target_z_offs->getDoubleValue()); + currentView->setTargetXOffset_m(target_x_offs->getDoubleValue()); + currentView->setTargetYOffset_m(target_y_offs->getDoubleValue()); + currentView->setTargetZOffset_m(target_z_offs->getDoubleValue()); // Update the current view do_axes(); @@ -254,126 +254,6 @@ FGViewMgr::add_view( flightgear::View * v ) v->init(); } -double -FGViewMgr::getViewXOffset_m () const -{ - const flightgear::View * view = get_current_view(); - if (view != 0) { - return ((flightgear::View *)view)->getXOffset_m(); - } else { - return 0; - } -} - -void -FGViewMgr::setViewXOffset_m (double x) -{ - flightgear::View * view = get_current_view(); - if (view != 0) { - view->setXOffset_m(x); - } -} - -double -FGViewMgr::getViewYOffset_m () const -{ - const flightgear::View * view = get_current_view(); - if (view != 0) { - return ((flightgear::View *)view)->getYOffset_m(); - } else { - return 0; - } -} - -void -FGViewMgr::setViewYOffset_m (double y) -{ - flightgear::View * view = get_current_view(); - if (view != 0) { - view->setYOffset_m(y); - } -} - -double -FGViewMgr::getViewZOffset_m () const -{ - const flightgear::View * view = get_current_view(); - if (view != 0) { - return ((flightgear::View *)view)->getZOffset_m(); - } else { - return 0; - } -} - -void -FGViewMgr::setViewZOffset_m (double z) -{ - flightgear::View * view = get_current_view(); - if (view != 0) { - view->setZOffset_m(z); - } -} - -double -FGViewMgr::getViewTargetXOffset_m () const -{ - const flightgear::View * view = get_current_view(); - if (view != 0) { - return ((flightgear::View *)view)->getTargetXOffset_m(); - } else { - return 0; - } -} - -void -FGViewMgr::setViewTargetXOffset_m (double x) -{ - flightgear::View * view = get_current_view(); - if (view != 0) { - view->setTargetXOffset_m(x); - } -} - -double -FGViewMgr::getViewTargetYOffset_m () const -{ - const flightgear::View * view = get_current_view(); - if (view != 0) { - return ((flightgear::View *)view)->getTargetYOffset_m(); - } else { - return 0; - } -} - -void -FGViewMgr::setViewTargetYOffset_m (double y) -{ - flightgear::View * view = get_current_view(); - if (view != 0) { - view->setTargetYOffset_m(y); - } -} - -double -FGViewMgr::getViewTargetZOffset_m () const -{ - const flightgear::View * view = get_current_view(); - if (view != 0) { - return ((flightgear::View *)view)->getTargetZOffset_m(); - } else { - return 0; - } -} - -void -FGViewMgr::setViewTargetZOffset_m (double z) -{ - flightgear::View * view = get_current_view(); - if (view != 0) { - view->setTargetZOffset_m(z); - } -} - int FGViewMgr::getView () const { return current; diff --git a/src/Viewer/viewmgr.hxx b/src/Viewer/viewmgr.hxx index 5649f8308..29e0109d8 100644 --- a/src/Viewer/viewmgr.hxx +++ b/src/Viewer/viewmgr.hxx @@ -86,20 +86,6 @@ private: void do_axes (); - // callbacks in manager to access viewer methods - - double getViewXOffset_m () const; - void setViewXOffset_m (double x); - double getViewYOffset_m () const; - void setViewYOffset_m (double y); - double getViewZOffset_m () const; - void setViewZOffset_m (double z); - double getViewTargetXOffset_m () const; - void setViewTargetXOffset_m (double x); - double getViewTargetYOffset_m () const; - void setViewTargetYOffset_m (double y); - double getViewTargetZOffset_m () const; - void setViewTargetZOffset_m (double z); void setViewAxisLong (double axis); void setViewAxisLat (double axis);