////////////////////////////////////////////////////////////////////
// Initialize the property interpolator subsystem
////////////////////////////////////////////////////////////////////
- globals->add_subsystem("interpolator", new SGInterpolator());
+ globals->add_subsystem("interpolator", new SGInterpolator);
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Add the FlightGear property utilities.
+ ////////////////////////////////////////////////////////////////////
+ globals->add_subsystem("properties", new FGProperties);
////////////////////////////////////////////////////////////////////
// Initialize the material property subsystem.
}
- ////////////////////////////////////////////////////////////////////
- // Initialize the default (kludged) properties.
- ////////////////////////////////////////////////////////////////////
-
- fgInitProps();
-
-
////////////////////////////////////////////////////////////////////
// Initialize the controls subsystem.
////////////////////////////////////////////////////////////////////
return buf;
}
-
/**
* Return the magnetic variation
*/
// Tie the properties.
////////////////////////////////////////////////////////////////////////
+FGProperties::FGProperties ()
+{
+}
+
+FGProperties::~FGProperties ()
+{
+}
+
void
-fgInitProps ()
+FGProperties::init ()
+{
+}
+
+void
+FGProperties::bind ()
{
- SG_LOG(SG_GENERAL, SG_DEBUG, "start of fgInitProps()" );
// Simulation
fgTie("/sim/logging/priority", getLoggingPriority, setLoggingPriority);
fgTie("/sim/logging/classes", getLoggingClasses, setLoggingClasses);
fgTie("/sim/temp/winding-ccw", getWindingCCW, setWindingCCW, false);
fgTie("/sim/temp/full-screen", getFullScreen, setFullScreen);
fgTie("/sim/temp/fdm-data-logging", getFDMDataLogging, setFDMDataLogging);
-
- SG_LOG(SG_GENERAL, SG_DEBUG, "end of fgInitProps()" );
}
-
void
-fgUpdateProps ()
+FGProperties::unbind ()
{
+ // Simulation
+ fgUntie("/sim/logging/priority");
+ fgUntie("/sim/logging/classes");
+ fgUntie("/sim/freeze/master");
+ fgUntie("/sim/aircraft-dir");
+
+ fgUntie("/sim/time/elapsed-sec");
+ fgUntie("/sim/time/gmt");
+ fgUntie("/sim/time/gmt-string");
+
+ // Orientation
+ fgUntie("/orientation/heading-magnetic-deg");
+
+ // Environment
+#ifdef FG_WEATHERCM
+ fgUntie("/environment/visibility-m");
+ fgUntie("/environment/wind-from-north-fps");
+ fgUntie("/environment/wind-from-east-fps");
+ fgUntie("/environment/wind-from-down-fps");
+#endif
+
+ fgUntie("/environment/magnetic-variation-deg");
+ fgUntie("/environment/magnetic-dip-deg");
+
+ fgUntie("/sim/time/warp");
+ fgUntie("/sim/time/warp-delta");
+
+ // Misc. Temporary junk.
+ fgUntie("/sim/temp/winding-ccw");
+ fgUntie("/sim/temp/full-screen");
+ fgUntie("/sim/temp/fdm-data-logging");
+}
+
+void
+FGProperties::update (double dt)
+{
+ // Date and time
+ struct tm * t = globals->get_time_params()->getGmt();
+
+ fgSetInt("/sim/time/utc/year", t->tm_year + 1900);
+ fgSetInt("/sim/time/utc/month", t->tm_mon + 1);
+ fgSetInt("/sim/time/utc/day", t->tm_mday);
+ fgSetInt("/sim/time/utc/hour", t->tm_hour);
+ fgSetInt("/sim/time/utc/minute", t->tm_min);
+ fgSetInt("/sim/time/utc/second", t->tm_sec);
+
+ fgSetDouble("/sim/time/utc/day-seconds",
+ t->tm_hour * 3600 +
+ t->tm_min * 60 +
+ t->tm_sec);
}
#include <simgear/debug/logstream.hxx>
#include <simgear/props/props.hxx>
#include <simgear/props/props_io.hxx>
+#include <simgear/structure/subsystem_mgr.hxx>
#include "globals.hxx"
// Property management.
////////////////////////////////////////////////////////////////////////
-
-/**
- * Initialize the default FlightGear properties.
- *
- * These are mostly properties that haven't been claimed by a
- * specific module yet. This function should be invoked once,
- * while the program is starting (and after the global property
- * tree has been created).
- */
-extern void fgInitProps (); // fixme: how are they untied?
-
-
-/**
- * Update the default FlightGear properties.
- *
- * This function should be invoked once in each loop to update all
- * of the default properties.
- */
-extern void fgUpdateProps ();
+class FGProperties : public SGSubsystem
+{
+public:
+ FGProperties ();
+ virtual ~FGProperties ();
+
+ void init ();
+ void bind ();
+ void unbind ();
+ void update (double dt);
+};
/**