]> git.mxchange.org Git - flightgear.git/blobdiff - src/Instrumentation/instrument_mgr.cxx
Merge branch 'durk/traffic'
[flightgear.git] / src / Instrumentation / instrument_mgr.cxx
index 28b2c92984c7842de22a9d9004f9003cbd4a4949..380ccd2ee8bae6dbae57b02ace3ebc969a2e675b 100644 (file)
 #include "mk_viii.hxx"
 #include "mrg.hxx"
 #include "groundradar.hxx"
+#include "agradar.hxx"
+#include "rad_alt.hxx"
 
-FGInstrumentMgr::FGInstrumentMgr ()
+FGInstrumentMgr::FGInstrumentMgr () :
+  _explicitGps(false)
 {
     set_subsystem("od_gauge", new FGODGauge);
     set_subsystem("hud", new HUD);
@@ -68,11 +71,11 @@ FGInstrumentMgr::FGInstrumentMgr ()
             readProperties( config.str(), config_props );
 
             if ( !build() ) {
-                throw sg_throwable(string(
-                        "Detected an internal inconsistency in the instrumentation\n"
-                        "system specification file.  See earlier errors for details."));
+                throw sg_error(
+                    "Detected an internal inconsistency in the instrumentation\n"
+                    "system specification file.  See earlier errors for details.");
             }
-        } catch (const sg_exception& exc) {
+        } catch (const sg_exception&) {
             SG_LOG( SG_ALL, SG_ALERT, "Failed to load instrumentation system model: "
                     << config.str() );
         }
@@ -83,6 +86,14 @@ FGInstrumentMgr::FGInstrumentMgr ()
     }
 
     delete config_props;
+    
+    if (!_explicitGps) {
+      SG_LOG(SG_INSTR, SG_INFO, "creating default GPS instrument");
+      SGPropertyNode_ptr nd(new SGPropertyNode);
+      nd->setStringValue("name", "gps");
+      nd->setIntValue("number", 0);
+      set_subsystem("gps[0]", new GPS(nd));
+    }
 }
 
 FGInstrumentMgr::~FGInstrumentMgr ()
@@ -126,8 +137,8 @@ bool FGInstrumentMgr::build ()
             set_subsystem( id, new Altimeter( node ) );
 
         } else if ( name == "gps" ) {
-            set_subsystem( id, new GPS( node ), 0.45 );
-
+            set_subsystem( id, new GPS( node ) );
+            _explicitGps = true;
         } else if ( name == "gsdi" ) {
             set_subsystem( id, new GSDI( node ) );
 
@@ -168,7 +179,7 @@ bool FGInstrumentMgr::build ()
             set_subsystem( id, new VerticalSpeedIndicator( node ) );
 
         } else if ( name == "radar" ) {
-            set_subsystem( id, new wxRadarBg ( node ), 0.5 );
+            set_subsystem( id, new wxRadarBg ( node ), 1);
 
         } else if ( name == "inst-vertical-speed-indicator" ) {
             set_subsystem( id, new InstVerticalSpeedIndicator( node ) );
@@ -183,7 +194,13 @@ bool FGInstrumentMgr::build ()
             set_subsystem( id, new MasterReferenceGyro( node ) );
 
         } else if ( name == "groundradar" ) {
-            set_subsystem( id, new GroundRadar( node ) );
+            set_subsystem( id, new GroundRadar( node ), 1 );
+
+        } else if ( name == "air-ground-radar" ) {
+            set_subsystem( id, new agRadar( node ),1);
+
+        } else if ( name == "radar-altimeter" ) {
+            set_subsystem( id, new radAlt( node ),1);
 
         } else {
             SG_LOG( SG_ALL, SG_ALERT, "Unknown top level section: "