From: James Turner Date: Mon, 24 Dec 2012 17:42:23 +0000 (+0000) Subject: Make PLAN mode in Boeing NDs possible. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=a6dc2beb4d0e51ef1e0b8fffd60460341931f639;p=flightgear.git Make PLAN mode in Boeing NDs possible. Allow the location of the ND centre to be set from properties instead of always using the acct position. (I thought I'd supported this option long ago, evidently not) --- diff --git a/src/Cockpit/NavDisplay.cxx b/src/Cockpit/NavDisplay.cxx index 15452a2e9..caf70b0ff 100644 --- a/src/Cockpit/NavDisplay.cxx +++ b/src/Cockpit/NavDisplay.cxx @@ -562,6 +562,10 @@ NavDisplay::init () _testModeNode->setBoolValue(false); _viewHeadingNode = _Instrument->getChild("view-heading-deg", 0, true); + _userLatNode = _Instrument->getChild("user-latitude-deg", 0, true); + _userLonNode = _Instrument->getChild("user-longitude-deg", 0, true); + _userPositionEnable = _Instrument->getChild("user-position", 0, true); + // OSG geometry setup _radarGeode = new osg::Geode; @@ -695,8 +699,12 @@ NavDisplay::update (double delta_time_sec) _projectMat = osg::Matrixf::scale(_scale, _scale, 1.0) * degRotation(-_view_heading) * _centerTrans; - _pos = globals->get_aircraft_position(); - + if (_userPositionEnable->getBoolValue()) { + _pos = SGGeod::fromDeg(_userLonNode->getDoubleValue(), _userLatNode->getDoubleValue()); + } else { + _pos = globals->get_aircraft_position(); + } + // invalidate the cache of positioned items, if we travelled more than 1nm if (_cachedItemsValid) { SGVec3d cartNow(SGVec3d::fromGeod(_pos)); diff --git a/src/Cockpit/NavDisplay.hxx b/src/Cockpit/NavDisplay.hxx index 870c3cc30..b45caed6c 100644 --- a/src/Cockpit/NavDisplay.hxx +++ b/src/Cockpit/NavDisplay.hxx @@ -90,7 +90,8 @@ protected: SGPropertyNode_ptr _radar_mode_control_node; SGPropertyNode_ptr _user_heading_node; SGPropertyNode_ptr _testModeNode; - + SGPropertyNode_ptr _userLatNode, _userLonNode, _userPositionEnable; + FGODGauge *_odg; // Convenience function for creating a property node with a