]> git.mxchange.org Git - flightgear.git/commitdiff
Make PLAN mode in Boeing NDs possible.
authorJames Turner <jmt@Bishop.local>
Mon, 24 Dec 2012 17:42:23 +0000 (17:42 +0000)
committerJames Turner <jmt@Bishop.local>
Mon, 24 Dec 2012 17:42:23 +0000 (17:42 +0000)
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)

src/Cockpit/NavDisplay.cxx
src/Cockpit/NavDisplay.hxx

index 15452a2e9e9ab3529fefe0e074dda9fa61b38800..caf70b0ff1528ff3ee9d38570099efd0cf2fcb54 100644 (file)
@@ -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));
index 870c3cc3051a58089dd83a13cd143a221253ef3e..b45caed6c645c435fe96816c08b0e9ed4577f4d8 100644 (file)
@@ -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