Ensures we don't forget to untie some individual properties.
void FGAIAircraft::bind() {
FGAIBase::bind();
- props->tie("controls/gear/gear-down",
- SGRawValueMethods<FGAIAircraft,bool>(*this,
- &FGAIAircraft::_getGearDown));
- props->tie("transponder-id",
- SGRawValueMethods<FGAIAircraft,const char*>(*this,
- &FGAIAircraft::_getTransponderCode));
+ tie("controls/gear/gear-down",
+ SGRawValueMethods<FGAIAircraft,bool>(*this,
+ &FGAIAircraft::_getGearDown));
+ tie("transponder-id",
+ SGRawValueMethods<FGAIAircraft,const char*>(*this,
+ &FGAIAircraft::_getTransponderCode));
}
-
-void FGAIAircraft::unbind() {
- FGAIBase::unbind();
-
- props->untie("controls/gear/gear-down");
- props->untie("transponder-id");
-}
-
-
void FGAIAircraft::update(double dt) {
FGAIBase::update(dt);
Run(dt);
// virtual bool init(bool search_in_AI_path=false);
virtual void bind();
- virtual void unbind();
virtual void update(double dt);
void setPerformance(const std::string& perfString);
void FGAIBallistic::bind() {
// FGAIBase::bind();
- props->tie("sim/time/elapsed-sec",
+ _tiedProperties.setRoot(props);
+ tie("sim/time/elapsed-sec",
SGRawValueMethods<FGAIBallistic,double>(*this,
&FGAIBallistic::_getTime, &FGAIBallistic::setTime));
- //props->tie("mass-slug",
+ //tie("mass-slug",
// SGRawValueMethods<FGAIBallistic,double>(*this,
// &FGAIBallistic::getMass));
- props->tie("material/solid",
+ tie("material/solid",
SGRawValuePointer<bool>(&_solid));
- props->tie("altitude-agl-ft",
+ tie("altitude-agl-ft",
SGRawValuePointer<double>(&_ht_agl_ft));
- props->tie("controls/slave-to-ac",
+ tie("controls/slave-to-ac",
SGRawValueMethods<FGAIBallistic,bool>
(*this, &FGAIBallistic::getSlaved, &FGAIBallistic::setSlaved));
- props->tie("controls/invisible",
+ tie("controls/invisible",
SGRawValuePointer<bool>(&invisible));
if(_external_force || _slave_to_ac){
- props->tie("controls/force_stabilized",
+ tie("controls/force_stabilized",
SGRawValuePointer<bool>(&_force_stabilised));
- props->tie("position/global-x",
+ tie("position/global-x",
SGRawValueMethods<FGAIBase,double>(*this, &FGAIBase::_getCartPosX, 0));
- props->tie("position/global-y",
+ tie("position/global-y",
SGRawValueMethods<FGAIBase,double>(*this, &FGAIBase::_getCartPosY, 0));
- props->tie("position/global-z",
+ tie("position/global-z",
SGRawValueMethods<FGAIBase,double>(*this, &FGAIBase::_getCartPosZ, 0));
- props->tie("velocities/vertical-speed-fps",
+ tie("velocities/vertical-speed-fps",
SGRawValuePointer<double>(&vs));
- props->tie("velocities/true-airspeed-kt",
+ tie("velocities/true-airspeed-kt",
SGRawValuePointer<double>(&speed));
- props->tie("velocities/horizontal-speed-fps",
+ tie("velocities/horizontal-speed-fps",
SGRawValuePointer<double>(&hs));
- props->tie("position/altitude-ft",
+ tie("position/altitude-ft",
SGRawValueMethods<FGAIBase,double>(*this, &FGAIBase::_getElevationFt, &FGAIBase::_setAltitude));
- props->tie("position/latitude-deg",
+ tie("position/latitude-deg",
SGRawValueMethods<FGAIBase,double>(*this, &FGAIBase::_getLatitude, &FGAIBase::_setLatitude));
- props->tie("position/longitude-deg",
+ tie("position/longitude-deg",
SGRawValueMethods<FGAIBase,double>(*this, &FGAIBase::_getLongitude, &FGAIBase::_setLongitude));
- props->tie("orientation/hdg-deg",
+ tie("orientation/hdg-deg",
SGRawValuePointer<double>(&hdg));
- props->tie("orientation/pitch-deg",
+ tie("orientation/pitch-deg",
SGRawValuePointer<double>(&pitch));
- props->tie("orientation/roll-deg",
+ tie("orientation/roll-deg",
SGRawValuePointer<double>(&roll));
- props->tie("controls/slave-load-to-ac",
+ tie("controls/slave-load-to-ac",
SGRawValueMethods<FGAIBallistic,bool>
(*this, &FGAIBallistic::getSlavedLoad, &FGAIBallistic::setSlavedLoad));
- props->tie("position/load-offset",
+ tie("position/load-offset",
SGRawValueMethods<FGAIBallistic,double>
(*this, &FGAIBallistic::getLoadOffset, &FGAIBallistic::setLoadOffset));
- props->tie("load/distance-to-hitch-ft",
+ tie("load/distance-to-hitch-ft",
SGRawValueMethods<FGAIBallistic,double>
(*this, &FGAIBallistic::getDistanceToHitch));
- props->tie("load/elevation-to-hitch-deg",
+ tie("load/elevation-to-hitch-deg",
SGRawValueMethods<FGAIBallistic,double>
(*this, &FGAIBallistic::getElevToHitch));
- props->tie("load/bearing-to-hitch-deg",
+ tie("load/bearing-to-hitch-deg",
SGRawValueMethods<FGAIBallistic,double>
(*this, &FGAIBallistic::getBearingToHitch));
- props->tie("material/load-resistance",
+ tie("material/load-resistance",
SGRawValuePointer<double>(&_load_resistance));
}
}
-void FGAIBallistic::unbind() {
-// FGAIBase::unbind();
-
- props->untie("sim/time/elapsed-sec");
- props->untie("mass-slug");
- props->untie("material/solid");
- props->untie("altitude-agl-ft");
- props->untie("controls/slave-to-ac");
- props->untie("controls/invisible");
-
- if(_external_force || _slave_to_ac){
- props->untie("position/global-y");
- props->untie("position/global-x");
- props->untie("position/global-z");
- props->untie("velocities/vertical-speed-fps");
- props->untie("velocities/true-airspeed-kt");
- props->untie("velocities/horizontal-speed-fps");
- props->untie("position/altitude-ft");
- props->untie("position/latitude-deg");
- props->untie("position/longitude-deg");
- props->untie("position/ht-agl-ft");
- props->untie("orientation/hdg-deg");
- props->untie("orientation/pitch-deg");
- props->untie("orientation/roll-deg");
- props->untie("controls/force_stabilized");
- props->untie("position/load-offset");
- props->untie("load/distance-to-hitch-ft");
- props->untie("load/elevation-to-hitch-deg");
- props->untie("load/bearing-to-hitch-deg");
- props->untie("material/load-resistance");
- }
-}
-
void FGAIBallistic::update(double dt) {
FGAIBase::update(dt);
_setUserPos();
bool init(bool search_in_AI_path=false);
virtual void bind();
- virtual void unbind();
virtual void reinit();
virtual void update(double dt);
void FGAIBase::bind() {
- props->tie("id", SGRawValueMethods<FGAIBase,int>(*this,
+ _tiedProperties.setRoot(props);
+ tie("id", SGRawValueMethods<FGAIBase,int>(*this,
&FGAIBase::getID));
- props->tie("velocities/true-airspeed-kt", SGRawValuePointer<double>(&speed));
- props->tie("velocities/vertical-speed-fps",
+ tie("velocities/true-airspeed-kt", SGRawValuePointer<double>(&speed));
+ tie("velocities/vertical-speed-fps",
SGRawValueMethods<FGAIBase,double>(*this,
&FGAIBase::_getVS_fps,
&FGAIBase::_setVS_fps));
- props->tie("position/altitude-ft",
+ tie("position/altitude-ft",
SGRawValueMethods<FGAIBase,double>(*this,
&FGAIBase::_getAltitude,
&FGAIBase::_setAltitude));
- props->tie("position/latitude-deg",
+ tie("position/latitude-deg",
SGRawValueMethods<FGAIBase,double>(*this,
&FGAIBase::_getLatitude,
&FGAIBase::_setLatitude));
- props->tie("position/longitude-deg",
+ tie("position/longitude-deg",
SGRawValueMethods<FGAIBase,double>(*this,
&FGAIBase::_getLongitude,
&FGAIBase::_setLongitude));
- props->tie("position/global-x",
+ tie("position/global-x",
SGRawValueMethods<FGAIBase,double>(*this,
&FGAIBase::_getCartPosX,
0));
- props->tie("position/global-y",
+ tie("position/global-y",
SGRawValueMethods<FGAIBase,double>(*this,
&FGAIBase::_getCartPosY,
0));
- props->tie("position/global-z",
+ tie("position/global-z",
SGRawValueMethods<FGAIBase,double>(*this,
&FGAIBase::_getCartPosZ,
0));
- props->tie("callsign",
+ tie("callsign",
SGRawValueMethods<FGAIBase,const char*>(*this,
&FGAIBase::_getCallsign,
0));
- props->tie("orientation/pitch-deg", SGRawValuePointer<double>(&pitch));
- props->tie("orientation/roll-deg", SGRawValuePointer<double>(&roll));
- props->tie("orientation/true-heading-deg", SGRawValuePointer<double>(&hdg));
-
- props->tie("radar/in-range", SGRawValuePointer<bool>(&in_range));
- props->tie("radar/bearing-deg", SGRawValuePointer<double>(&bearing));
- props->tie("radar/elevation-deg", SGRawValuePointer<double>(&elevation));
- props->tie("radar/range-nm", SGRawValuePointer<double>(&range));
- props->tie("radar/h-offset", SGRawValuePointer<double>(&horiz_offset));
- props->tie("radar/v-offset", SGRawValuePointer<double>(&vert_offset));
- props->tie("radar/x-shift", SGRawValuePointer<double>(&x_shift));
- props->tie("radar/y-shift", SGRawValuePointer<double>(&y_shift));
- props->tie("radar/rotation", SGRawValuePointer<double>(&rotation));
- props->tie("radar/ht-diff-ft", SGRawValuePointer<double>(&ht_diff));
- props->tie("subID", SGRawValuePointer<int>(&_subID));
- props->tie("controls/lighting/nav-lights",
- SGRawValueFunctions<bool>(_isNight));
+ tie("orientation/pitch-deg", SGRawValuePointer<double>(&pitch));
+ tie("orientation/roll-deg", SGRawValuePointer<double>(&roll));
+ tie("orientation/true-heading-deg", SGRawValuePointer<double>(&hdg));
+
+ tie("radar/in-range", SGRawValuePointer<bool>(&in_range));
+ tie("radar/bearing-deg", SGRawValuePointer<double>(&bearing));
+ tie("radar/elevation-deg", SGRawValuePointer<double>(&elevation));
+ tie("radar/range-nm", SGRawValuePointer<double>(&range));
+ tie("radar/h-offset", SGRawValuePointer<double>(&horiz_offset));
+ tie("radar/v-offset", SGRawValuePointer<double>(&vert_offset));
+ tie("radar/x-shift", SGRawValuePointer<double>(&x_shift));
+ tie("radar/y-shift", SGRawValuePointer<double>(&y_shift));
+ tie("radar/rotation", SGRawValuePointer<double>(&rotation));
+ tie("radar/ht-diff-ft", SGRawValuePointer<double>(&ht_diff));
+ tie("subID", SGRawValuePointer<int>(&_subID));
+ tie("controls/lighting/nav-lights", SGRawValueFunctions<bool>(_isNight));
+
props->setBoolValue("controls/lighting/beacon", true);
props->setBoolValue("controls/lighting/strobe", true);
props->setBoolValue("controls/glide-path", true);
props->setDoubleValue("sim/sound/avionics/volume", 0.0);
props->setBoolValue("sim/sound/avionics/external-view", false);
props->setBoolValue("sim/current-view/internal", false);
-
}
void FGAIBase::unbind() {
- props->untie("id");
- props->untie("velocities/true-airspeed-kt");
- props->untie("velocities/vertical-speed-fps");
-
- props->untie("position/altitude-ft");
- props->untie("position/latitude-deg");
- props->untie("position/longitude-deg");
- props->untie("position/global-x");
- props->untie("position/global-y");
- props->untie("position/global-z");
- props->untie("callsign");
-
- props->untie("orientation/pitch-deg");
- props->untie("orientation/roll-deg");
- props->untie("orientation/true-heading-deg");
-
- props->untie("radar/in-range");
- props->untie("radar/bearing-deg");
- props->untie("radar/elevation-deg");
- props->untie("radar/range-nm");
- props->untie("radar/h-offset");
- props->untie("radar/v-offset");
- props->untie("radar/x-shift");
- props->untie("radar/y-shift");
- props->untie("radar/rotation");
- props->untie("radar/ht-diff-ft");
-
- props->untie("controls/lighting/nav-lights");
-
- props->setBoolValue("/sim/controls/radar/", true);
+ _tiedProperties.Untie();
+
+ props->setBoolValue("/sim/controls/radar", true);
// drop reference to sound effects now
_fx = 0;
#include <simgear/misc/sg_path.hxx>
#include <simgear/structure/SGSharedPtr.hxx>
#include <simgear/structure/SGReferenced.hxx>
+#include <simgear/props/tiedpropertylist.hxx>
#include <simgear/sg_inlines.h>
#include <simgear/math/sg_geodesy.hxx>
class FGAIFlightPlan;
class FGFX;
class FGNasalModelDataProxy;
-class FGAIModelData; // defined below
+class FGAIModelData; // defined below
class FGAIBase : public SGReferenced {
enum object_type { otNull = 0, otAircraft, otShip, otCarrier, otBallistic,
otRocket, otStorm, otThermal, otStatic, otWingman, otGroundVehicle,
otEscort, otMultiplayer,
- MAX_OBJECTS }; // Needs to be last!!!
+ MAX_OBJECTS }; // Needs to be last!!!
FGAIBase(object_type ot, bool enableHot);
virtual ~FGAIBase();
protected:
-
+ /**
+ * Tied-properties helper, record nodes which are tied for easy un-tie-ing
+ */
+ template <typename T>
+ void tie(const char* aRelPath, const SGRawValue<T>& aRawValue)
+ {
+ _tiedProperties.Tie(props->getNode(aRelPath, true), aRawValue);
+ }
+
+ simgear::TiedPropertyList _tiedProperties;
SGPropertyNode_ptr _selected_ac;
SGPropertyNode_ptr props;
SGPropertyNode_ptr trigger_node;
FGAIManager* manager;
// these describe the model's actual state
- SGGeod pos; // WGS84 lat & lon in degrees, elev above sea-level in meters
- double hdg; // True heading in degrees
- double roll; // degrees, left is negative
- double pitch; // degrees, nose-down is negative
+ SGGeod pos; // WGS84 lat & lon in degrees, elev above sea-level in meters
+ double hdg; // True heading in degrees
+ double roll; // degrees, left is negative
+ double pitch; // degrees, nose-down is negative
double speed; // knots true airspeed
double altitude_ft; // feet above sea level
double vs; // vertical speed, feet per minute
double x_shift; // value used by radar display instrument
double y_shift; // value used by radar display instrument
double rotation; // value used by radar display instrument
- double ht_diff; // value used by radar display instrument
+ double ht_diff; // value used by radar display instrument
- string model_path; //Path to the 3D model
+ string model_path; //Path to the 3D model
SGModelPlacement aip;
bool delete_me;
bool _initialized;
};
-#endif // _FG_AIBASE_HXX
+#endif // _FG_AIBASE_HXX
props->untie("velocities/true-airspeed-kt");
- props->tie("controls/flols/source-lights",
- SGRawValuePointer<int>(&source));
- props->tie("controls/flols/distance-m",
- SGRawValuePointer<double>(&dist));
- props->tie("controls/flols/angle-degs",
- SGRawValuePointer<double>(&angle));
- props->tie("controls/turn-to-launch-hdg",
- SGRawValuePointer<bool>(&turn_to_launch_hdg));
- props->tie("controls/in-to-wind",
- SGRawValuePointer<bool>(&turn_to_launch_hdg));
- props->tie("controls/base-course-deg",
- SGRawValuePointer<double>(&base_course));
- props->tie("controls/base-speed-kts",
- SGRawValuePointer<double>(&base_speed));
- props->tie("controls/start-pos-lat-deg",
- SGRawValueMethods<SGGeod,double>(pos, &SGGeod::getLatitudeDeg));
- props->tie("controls/start-pos-long-deg",
- SGRawValueMethods<SGGeod,double>(pos, &SGGeod::getLongitudeDeg));
- props->tie("controls/mp-control",
- SGRawValuePointer<bool>(&MPControl));
- props->tie("controls/ai-control",
- SGRawValuePointer<bool>(&AIControl));
- props->tie("environment/surface-wind-speed-true-kts",
- SGRawValuePointer<double>(&wind_speed_kts));
- props->tie("environment/surface-wind-from-true-degs",
- SGRawValuePointer<double>(&wind_from_deg));
- props->tie("environment/rel-wind-from-degs",
- SGRawValuePointer<double>(&rel_wind_from_deg));
- props->tie("environment/rel-wind-from-carrier-hdg-degs",
- SGRawValuePointer<double>(&rel_wind));
- props->tie("environment/rel-wind-speed-kts",
- SGRawValuePointer<double>(&rel_wind_speed_kts));
- props->tie("environment/in-to-wind",
+ tie("controls/flols/source-lights",
+ SGRawValuePointer<int>(&source));
+ tie("controls/flols/distance-m",
+ SGRawValuePointer<double>(&dist));
+ tie("controls/flols/angle-degs",
+ SGRawValuePointer<double>(&angle));
+ tie("controls/turn-to-launch-hdg",
+ SGRawValuePointer<bool>(&turn_to_launch_hdg));
+ tie("controls/in-to-wind",
+ SGRawValuePointer<bool>(&turn_to_launch_hdg));
+ tie("controls/base-course-deg",
+ SGRawValuePointer<double>(&base_course));
+ tie("controls/base-speed-kts",
+ SGRawValuePointer<double>(&base_speed));
+ tie("controls/start-pos-lat-deg",
+ SGRawValueMethods<SGGeod,double>(pos, &SGGeod::getLatitudeDeg));
+ tie("controls/start-pos-long-deg",
+ SGRawValueMethods<SGGeod,double>(pos, &SGGeod::getLongitudeDeg));
+ tie("controls/mp-control",
+ SGRawValuePointer<bool>(&MPControl));
+ tie("controls/ai-control",
+ SGRawValuePointer<bool>(&AIControl));
+ tie("environment/surface-wind-speed-true-kts",
+ SGRawValuePointer<double>(&wind_speed_kts));
+ tie("environment/surface-wind-from-true-degs",
+ SGRawValuePointer<double>(&wind_from_deg));
+ tie("environment/rel-wind-from-degs",
+ SGRawValuePointer<double>(&rel_wind_from_deg));
+ tie("environment/rel-wind-from-carrier-hdg-degs",
+ SGRawValuePointer<double>(&rel_wind));
+ tie("environment/rel-wind-speed-kts",
+ SGRawValuePointer<double>(&rel_wind_speed_kts));
+ tie("environment/in-to-wind",
SGRawValuePointer<bool>(&in_to_wind));
- //props->tie("controls/flols/wave-off-lights",
- // SGRawValuePointer<bool>(&wave_off_lights));
- props->tie("controls/elevators",
- SGRawValuePointer<bool>(&elevators));
- props->tie("surface-positions/elevators-pos-norm",
- SGRawValuePointer<double>(&pos_norm));
- props->tie("controls/constants/elevators/trans-time-s",
- SGRawValuePointer<double>(&transition_time));
- props->tie("controls/constants/elevators/time-constant",
- SGRawValuePointer<double>(&time_constant));
- props->tie("controls/jbd",
+ //tie("controls/flols/wave-off-lights",
+ // SGRawValuePointer<bool>(&wave_off_lights));
+ tie("controls/elevators",
+ SGRawValuePointer<bool>(&elevators));
+ tie("surface-positions/elevators-pos-norm",
+ SGRawValuePointer<double>(&pos_norm));
+ tie("controls/constants/elevators/trans-time-s",
+ SGRawValuePointer<double>(&transition_time));
+ tie("controls/constants/elevators/time-constant",
+ SGRawValuePointer<double>(&time_constant));
+ tie("controls/jbd",
SGRawValuePointer<bool>(&jbd));
- props->tie("surface-positions/jbd-pos-norm",
+ tie("surface-positions/jbd-pos-norm",
SGRawValuePointer<double>(&jbd_pos_norm));
- props->tie("controls/constants/jbd/trans-time-s",
+ tie("controls/constants/jbd/trans-time-s",
SGRawValuePointer<double>(&jbd_transition_time));
- props->tie("controls/constants/jbd/time-constant",
+ tie("controls/constants/jbd/time-constant",
SGRawValuePointer<double>(&jbd_time_constant));
- props->tie("controls/turn-to-recovery-hdg",
+ tie("controls/turn-to-recovery-hdg",
SGRawValuePointer<bool>(&turn_to_recovery_hdg));
- props->tie("controls/turn-to-base-course",
+ tie("controls/turn-to-base-course",
SGRawValuePointer<bool>(&turn_to_base_course));
-
props->setBoolValue("controls/flols/cut-lights", false);
props->setBoolValue("controls/flols/wave-off-lights", false);
props->setBoolValue("controls/flols/cond-datum-lights", true);
props->setDoubleValue("controls/lighting/flood-lights-red-norm", 0);
}
-
-void FGAICarrier::unbind() {
- FGAIShip::unbind();
-
- props->untie("velocities/true-airspeed-kt");
- props->untie("controls/flols/source-lights");
- props->untie("controls/flols/distance-m");
- props->untie("controls/flols/angle-degs");
- props->untie("controls/turn-to-launch-hdg");
- props->untie("environment/wind-speed-true-kts");
- props->untie("environment/wind-from-true-degs");
- props->untie("environment/rel-wind-from-degs");
- props->untie("environment/rel-wind-speed-kts");
- props->untie("environment/in-to-wind");
- //props->untie("controls/flols/wave-off-lights");
- props->untie("controls/elevators");
- props->untie("surface-positions/elevators-pos-norm");
- props->untie("controls/constants/elevators/trans-time-secs");
- props->untie("controls/constants/elevators/time-constant");
- props->untie("controls/jbd");
- props->untie("surface-positions/jbd/pos-norm");
- props->untie("controls/constants/jbd/trans-time-s");
- props->untie("controls/jbd-time-constant");
- props->untie("controls/mp-control");
- props->untie("controls/ai-control");
- props->untie("controls/turn-to-recovery-hdg");
- props->untie("controls/turn-to-base-course");
-}
-
-
bool FGAICarrier::getParkPosition(const string& id, SGGeod& geodPos,
double& hdng, SGVec3d& uvw)
{
void setTACANChannelID(const string &);
virtual void bind();
- virtual void unbind();
void UpdateWind ( double dt );
void setWind_from_east( double fps );
void setWind_from_north( double fps );
void FGAIEscort::bind() {
FGAIShip::bind();
- props->tie("station/rel-bearing-deg",
+ tie("station/rel-bearing-deg",
SGRawValuePointer<double>(&_stn_relbrg));
- props->tie("station/true-bearing-deg",
+ tie("station/true-bearing-deg",
SGRawValuePointer<double>(&_stn_truebrg));
- props->tie("station/range-nm",
+ tie("station/range-nm",
SGRawValuePointer<double>(&_stn_range));
- props->tie("station/range-limit-nm",
+ tie("station/range-limit-nm",
SGRawValuePointer<double>(&_stn_limit));
- props->tie("station/angle-limit-deg",
+ tie("station/angle-limit-deg",
SGRawValuePointer<double>(&_stn_angle_limit));
- props->tie("station/speed-kts",
+ tie("station/speed-kts",
SGRawValuePointer<double>(&_stn_speed));
- props->tie("station/height-ft",
+ tie("station/height-ft",
SGRawValuePointer<double>(&_stn_height));
- props->tie("controls/update-interval-sec",
+ tie("controls/update-interval-sec",
SGRawValuePointer<double>(&_interval));
- props->tie("controls/parent-mp-control",
+ tie("controls/parent-mp-control",
SGRawValuePointer<bool>(&_MPControl));
- props->tie("station/target-range-nm",
+ tie("station/target-range-nm",
SGRawValuePointer<double>(&_tgtrange));
- props->tie("station/target-brg-deg-t",
+ tie("station/target-brg-deg-t",
SGRawValuePointer<double>(&_tgtbrg));
- props->tie("station/patrol",
+ tie("station/patrol",
SGRawValuePointer<bool>(&_patrol));
}
-void FGAIEscort::unbind() {
- FGAIShip::unbind();
-
- props->untie("station/rel-bearing-deg");
- props->untie("station/true-bearing-deg");
- props->untie("station/range-nm");
- props->untie("station/range-limit-nm");
- props->untie("station/angle-limit-deg");
- props->untie("station/speed-kts");
- props->untie("station/height-ft");
- props->untie("controls/update-interval-sec");
-
-}
-
bool FGAIEscort::init(bool search_in_AI_path) {
if (!FGAIShip::init(search_in_AI_path))
return false;
bool init(bool search_in_AI_path=false);
virtual void bind();
- virtual void unbind();
virtual void reinit();
virtual void update (double dt);
void FGAIGroundVehicle::bind() {
FGAIShip::bind();
- props->tie("controls/constants/elevation-coeff",
+ tie("controls/constants/elevation-coeff",
SGRawValuePointer<double>(&_elevation_coeff));
- props->tie("controls/constants/pitch-coeff",
+ tie("controls/constants/pitch-coeff",
SGRawValuePointer<double>(&_pitch_coeff));
- props->tie("position/ht-AGL-ft",
+ tie("position/ht-AGL-ft",
SGRawValuePointer<double>(&_ht_agl_ft));
- props->tie("hitch/rel-bearing-deg",
+ tie("hitch/rel-bearing-deg",
SGRawValuePointer<double>(&_relbrg));
- props->tie("hitch/tow-angle-deg",
+ tie("hitch/tow-angle-deg",
SGRawValuePointer<double>(&_tow_angle));
- props->tie("hitch/range-ft",
+ tie("hitch/range-ft",
SGRawValuePointer<double>(&_range_ft));
- props->tie("hitch/x-offset-ft",
+ tie("hitch/x-offset-ft",
SGRawValuePointer<double>(&_x_offset));
- props->tie("hitch/y-offset-ft",
+ tie("hitch/y-offset-ft",
SGRawValuePointer<double>(&_y_offset));
- props->tie("hitch/z-offset-ft",
+ tie("hitch/z-offset-ft",
SGRawValuePointer<double>(&_z_offset));
- props->tie("hitch/parent-x-offset-ft",
+ tie("hitch/parent-x-offset-ft",
SGRawValuePointer<double>(&_parent_x_offset));
- props->tie("hitch/parent-y-offset-ft",
+ tie("hitch/parent-y-offset-ft",
SGRawValuePointer<double>(&_parent_y_offset));
- props->tie("hitch/parent-z-offset-ft",
+ tie("hitch/parent-z-offset-ft",
SGRawValuePointer<double>(&_parent_z_offset));
- props->tie("controls/constants/tow-angle/gain",
+ tie("controls/constants/tow-angle/gain",
SGRawValuePointer<double>(&_tow_angle_gain));
- props->tie("controls/constants/tow-angle/limit-deg",
+ tie("controls/constants/tow-angle/limit-deg",
SGRawValuePointer<double>(&_tow_angle_limit));
- props->tie("controls/contact-x1-offset-ft",
+ tie("controls/contact-x1-offset-ft",
SGRawValuePointer<double>(&_contact_x1_offset));
- props->tie("controls/contact-x2-offset-ft",
+ tie("controls/contact-x2-offset-ft",
SGRawValuePointer<double>(&_contact_x2_offset));
}
-void FGAIGroundVehicle::unbind() {
- FGAIShip::unbind();
-
- props->untie("controls/constants/elevation-coeff");
- props->untie("controls/constants/pitch-coeff");
- props->untie("position/ht-AGL-ft");
- props->untie("hitch/rel-bearing-deg");
- props->untie("hitch/tow-angle-deg");
- props->untie("hitch/range-ft");
- props->untie("hitch/x-offset-ft");
- props->untie("hitch/y-offset-ft");
- props->untie("hitch/z-offset-ft");
- props->untie("hitch/parent-x-offset-ft");
- props->untie("hitch/parent-y-offset-ft");
- props->untie("hitch/parent-y-offset-ft");
- props->untie("controls/constants/tow-angle/gain");
- props->untie("controls/constants/tow-angle/limit-deg");
- props->untie("controls/contact-x1-offset-ft");
- props->untie("controls/contact-x2-offset-ft");
-}
-
bool FGAIGroundVehicle::init(bool search_in_AI_path) {
if (!FGAIShip::init(search_in_AI_path))
return false;
bool init(bool search_in_AI_path=false);
virtual void bind();
- virtual void unbind();
virtual void reinit();
virtual void update (double dt);
void FGAIMultiplayer::bind() {
FGAIBase::bind();
- props->tie("refuel/contact", SGRawValuePointer<bool>(&contact));
- props->tie("tanker", SGRawValuePointer<bool>(&isTanker));
+ tie("refuel/contact", SGRawValuePointer<bool>(&contact));
+ tie("tanker", SGRawValuePointer<bool>(&isTanker));
- props->tie("controls/invisible",
+ tie("controls/invisible",
SGRawValuePointer<bool>(&invisible));
#define AIMPROProp(type, name) \
SGRawValueMethods<FGAIMultiplayer, type>(*this, \
&FGAIMultiplayer::get##name, &FGAIMultiplayer::set##name)
- //props->tie("callsign", AIMPROProp(const char *, CallSign));
+ //tie("callsign", AIMPROProp(const char *, CallSign));
- props->tie("controls/allow-extrapolation",
- AIMPRWProp(bool, AllowExtrapolation));
- props->tie("controls/lag-adjust-system-speed",
- AIMPRWProp(double, LagAdjustSystemSpeed));
+ tie("controls/allow-extrapolation",
+ AIMPRWProp(bool, AllowExtrapolation));
+ tie("controls/lag-adjust-system-speed",
+ AIMPRWProp(double, LagAdjustSystemSpeed));
#undef AIMPROProp
#undef AIMPRWProp
}
-void FGAIMultiplayer::unbind() {
- FGAIBase::unbind();
-
- //props->untie("callsign");
- props->untie("controls/allow-extrapolation");
- props->untie("controls/lag-adjust-system-speed");
- props->untie("controls/invisible");
- props->untie("refuel/contact");
- props->untie("tanker");
-
-}
-
void FGAIMultiplayer::update(double dt)
{
using namespace simgear;
virtual bool init(bool search_in_AI_path=false);
virtual void bind();
- virtual void unbind();
virtual void update(double dt);
void addMotionInfo(FGExternalMotionData& motionInfo, long stamp);
long mLastTimestamp;
- // Propertiies for tankers
+ // Properties for tankers
SGPropertyNode_ptr refuel_node;
bool isTanker;
bool contact; // set if this tanker is within fuelling range
void FGAIShip::bind() {
FGAIBase::bind();
- props->tie("surface-positions/rudder-pos-deg",
+ tie("surface-positions/rudder-pos-deg",
SGRawValuePointer<float>(&_rudder));
- props->tie("controls/heading-lock",
+ tie("controls/heading-lock",
SGRawValuePointer<bool>(&_hdg_lock));
- props->tie("controls/tgt-speed-kts",
+ tie("controls/tgt-speed-kts",
SGRawValuePointer<double>(&tgt_speed));
- props->tie("controls/tgt-heading-degs",
+ tie("controls/tgt-heading-degs",
SGRawValuePointer<double>(&tgt_heading));
- props->tie("controls/constants/rudder",
+ tie("controls/constants/rudder",
SGRawValuePointer<double>(&_rudder_constant));
- props->tie("controls/constants/roll-factor",
+ tie("controls/constants/roll-factor",
SGRawValuePointer<double>(&_roll_factor));
- props->tie("controls/constants/roll",
+ tie("controls/constants/roll",
SGRawValuePointer<double>(&_roll_constant));
- props->tie("controls/constants/rudder",
+ tie("controls/constants/rudder",
SGRawValuePointer<double>(&_rudder_constant));
- props->tie("controls/constants/speed",
+ tie("controls/constants/speed",
SGRawValuePointer<double>(&_speed_constant));
- props->tie("waypoint/range-nm",
+ tie("waypoint/range-nm",
SGRawValuePointer<double>(&_wp_range));
- props->tie("waypoint/brg-deg",
+ tie("waypoint/brg-deg",
SGRawValuePointer<double>(&_course));
- props->tie("waypoint/rangerate-nm-sec",
+ tie("waypoint/rangerate-nm-sec",
SGRawValuePointer<double>(&_range_rate));
- props->tie("waypoint/new",
+ tie("waypoint/new",
SGRawValuePointer<bool>(&_new_waypoint));
- props->tie("waypoint/missed",
+ tie("waypoint/missed",
SGRawValuePointer<bool>(&_missed));
- props->tie("waypoint/missed-count-sec",
+ tie("waypoint/missed-count-sec",
SGRawValuePointer<double>(&_missed_count));
- props->tie("waypoint/missed-range-nm",
+ tie("waypoint/missed-range-nm",
SGRawValuePointer<double>(&_missed_range));
- props->tie("waypoint/missed-time-sec",
+ tie("waypoint/missed-time-sec",
SGRawValuePointer<double>(&_missed_time_sec));
- props->tie("waypoint/wait-count-sec",
+ tie("waypoint/wait-count-sec",
SGRawValuePointer<double>(&_wait_count));
- props->tie("waypoint/xtrack-error-ft",
+ tie("waypoint/xtrack-error-ft",
SGRawValuePointer<double>(&_xtrack_error));
- props->tie("waypoint/waiting",
+ tie("waypoint/waiting",
SGRawValuePointer<bool>(&_waiting));
- props->tie("waypoint/lead-angle-deg",
+ tie("waypoint/lead-angle-deg",
SGRawValuePointer<double>(&_lead_angle));
- props->tie("waypoint/tunnel",
+ tie("waypoint/tunnel",
SGRawValuePointer<bool>(&_tunnel));
- props->tie("waypoint/alt-curr-m",
+ tie("waypoint/alt-curr-m",
SGRawValuePointer<double>(&_curr_alt));
- props->tie("waypoint/alt-prev-m",
+ tie("waypoint/alt-prev-m",
SGRawValuePointer<double>(&_prev_alt));
- props->tie("submodels/serviceable",
+ tie("submodels/serviceable",
SGRawValuePointer<bool>(&_serviceable));
- props->tie("controls/turn-radius-ft",
+ tie("controls/turn-radius-ft",
SGRawValuePointer<double>(&turn_radius_ft));
- props->tie("controls/turn-radius-corrected-ft",
+ tie("controls/turn-radius-corrected-ft",
SGRawValuePointer<double>(&_rd_turn_radius_ft));
- props->tie("controls/constants/lead-angle/gain",
+ tie("controls/constants/lead-angle/gain",
SGRawValuePointer<double>(&_lead_angle_gain));
- props->tie("controls/constants/lead-angle/limit-deg",
+ tie("controls/constants/lead-angle/limit-deg",
SGRawValuePointer<double>(&_lead_angle_limit));
- props->tie("controls/constants/lead-angle/proportion",
+ tie("controls/constants/lead-angle/proportion",
SGRawValuePointer<double>(&_proportion));
- props->tie("controls/fixed-turn-radius-ft",
+ tie("controls/fixed-turn-radius-ft",
SGRawValuePointer<double>(&_fixed_turn_radius));
- props->tie("controls/restart",
+ tie("controls/restart",
SGRawValuePointer<bool>(&_restart));
- props->tie("velocities/speed-kts",
- SGRawValuePointer<double>(&speed));
-}
-
-void FGAIShip::unbind() {
- FGAIBase::unbind();
- props->untie("surface-positions/rudder-pos-deg");
- props->untie("controls/heading-lock");
- props->untie("controls/tgt-speed-kts");
- props->untie("controls/tgt-heading-degs");
- props->untie("controls/constants/roll");
- props->untie("controls/constants/rudder");
- props->untie("controls/constants/roll-factor");
- props->untie("controls/constants/speed");
- props->untie("waypoint/range-nm");
- props->untie("waypoint/range-brg-deg");
- props->untie("waypoint/rangerate-nm-sec");
- props->untie("waypoint/new");
- props->untie("waypoint/missed");
- props->untie("waypoint/missed-count-sec");
- props->untie("waypoint/missed-time-sec");
- props->untie("waypoint/missed-range");
- props->untie("waypoint/wait-count-sec");
- props->untie("waypoint/lead-angle-deg");
- props->untie("waypoint/xtrack-error-ft");
- props->untie("waypoint/waiting");
- props->untie("waypoint/tunnel");
- props->untie("waypoint/alt-curr-m");
- props->untie("waypoint/alt-prev-m");
- props->untie("submodels/serviceable");
- props->untie("controls/turn-radius-ft");
- props->untie("controls/turn-radius-corrected-ft");
- props->untie("controls/constants/lead-angle/gain");
- props->untie("controls/constants/lead-angle/limit-deg");
- props->untie("controls/constants/lead-angle/proportion");
- props->untie("controls/fixed-turn-radius-ft");
- props->untie("controls/constants/speed");
- props->untie("controls/restart");
- props->untie("velocities/speed-kts");
-
+ tie("velocities/speed-kts",
+ SGRawValuePointer<double>(&speed));
}
void FGAIShip::update(double dt) {
virtual bool init(bool search_in_AI_path=false);
virtual void bind();
- virtual void unbind();
virtual void update(double dt);
virtual void reinit();
void FGAITanker::bind() {
FGAIAircraft::bind();
- props->tie("refuel/contact", SGRawValuePointer<bool>(&contact));
- props->tie("position/altitude-agl-ft",SGRawValuePointer<double>(&altitude_agl_ft));
+ tie("refuel/contact", SGRawValuePointer<bool>(&contact));
+ tie("position/altitude-agl-ft",SGRawValuePointer<double>(&altitude_agl_ft));
+
props->setStringValue("navaids/tacan/channel-ID", TACAN_channel_id.c_str());
props->setStringValue("name", _name.c_str());
props->setBoolValue("tanker", true);
}
-void FGAITanker::unbind() {
- FGAIAircraft::unbind();
- props->untie("refuel/contact");
- props->untie("position/altitude-agl-ft");
-
-}
-
void FGAITanker::setTACANChannelID(const string& id) {
TACAN_channel_id = id;
}
virtual void readFromScenario(SGPropertyNode* scFileNode);
virtual void bind();
- virtual void unbind();
virtual const char* getTypeString(void) const { return "tanker"; }
}
void FGAIThermal::bind() {
- props->tie("position/altitude-agl-ft", // for debug and tweak
+ FGAIBase::bind();
+ tie("position/altitude-agl-ft", // for debug and tweak
SGRawValuePointer<double>(&altitude_agl_ft));
- props->tie("alt-rel", // for debug and tweak
+ tie("alt-rel", // for debug and tweak
SGRawValuePointer<double>(&alt_rel));
- props->tie("time", // for debug and tweak
+ tie("time", // for debug and tweak
SGRawValuePointer<double>(&time));
- props->tie("xx", // for debug and tweak
+ tie("xx", // for debug and tweak
SGRawValuePointer<double>(&xx));
- props->tie("is-forming", // for debug abd tweak
+ tie("is-forming", // for debug abd tweak
SGRawValuePointer<bool>(&is_forming));
- props->tie("is-formed", // for debug abd tweak
+ tie("is-formed", // for debug abd tweak
SGRawValuePointer<bool>(&is_formed));
- props->tie("is-dying", // for debug abd tweak
+ tie("is-dying", // for debug abd tweak
SGRawValuePointer<bool>(&is_dying));
- props->tie("is-dead", // for debug abd tweak
+ tie("is-dead", // for debug abd tweak
SGRawValuePointer<bool>(&is_dead));
- FGAIBase::bind();
}
-void FGAIThermal::unbind() {
- props->untie("position/altitude-agl-ft");
- props->untie("alt-rel");
- props->untie("time");
- props->untie("is-forming");
- props->untie("is-formed");
- props->untie("is-dying");
- props->untie("is-dead");
- props->untie("xx");
- FGAIBase::unbind();
-}
-
-
void FGAIThermal::update(double dt) {
FGAIBase::update(dt);
Run(dt);
class FGAIThermal : public FGAIBase {
public:
-
FGAIThermal();
~FGAIThermal();
-
- void readFromScenario(SGPropertyNode* scFileNode);
+
+ void readFromScenario(SGPropertyNode* scFileNode);
virtual bool init(bool search_in_AI_path=false);
- virtual void bind();
- virtual void unbind();
+ virtual void bind();
virtual void update(double dt);
inline void setMaxStrength( double s ) { max_strength = s; };
- inline void setDiameter( double d ) { diameter = d; };
- inline void setHeight( double h ) { height = h; };
- inline void setMaxUpdraft( double lift ) { v_up_max = lift; };
+ inline void setDiameter( double d ) { diameter = d; };
+ inline void setHeight( double h ) { height = h; };
+ inline void setMaxUpdraft( double lift ) { v_up_max = lift; };
inline void setMinUpdraft( double sink ) { v_up_min = sink; };
inline void setR_up_frac( double r ) { r_up_frac = r; };
-
+
inline double getStrength() const { return strength; };
- inline double getDiameter() const { return diameter; };
- inline double getHeight() const { return height; };
- inline double getV_up_max() const { return v_up_max; };
+ inline double getDiameter() const { return diameter; };
+ inline double getHeight() const { return height; };
+ inline double getV_up_max() const { return v_up_max; };
inline double getV_up_min() const { return v_up_min; };
inline double getR_up_frac() const { return r_up_frac; };
- virtual const char* getTypeString(void) const { return "thermal"; }
+ virtual const char* getTypeString(void) const { return "thermal"; }
void getGroundElev(double dt);
-
private:
-
void Run(double dt);
double get_strength_fac(double alt_frac);
double max_strength;
- double strength;
- double diameter;
- double height;
- double factor;
+ double strength;
+ double diameter;
+ double height;
+ double factor;
double alt_rel;
double alt;
double v_up_max;
double v_up_min;
- double r_up_frac;
+ double r_up_frac;
double cycle_timer;
double dt_count;
double time;
};
-
-
#endif // _FG_AIThermal_HXX
props->untie("controls/slave-to-ac");
- props->tie("id", SGRawValueMethods<FGAIBase,int>(*this,
+ tie("id", SGRawValueMethods<FGAIBase,int>(*this,
&FGAIBase::getID));
- props->tie("subID", SGRawValueMethods<FGAIBase,int>(*this,
+ tie("subID", SGRawValueMethods<FGAIBase,int>(*this,
&FGAIBase::_getSubID));
- props->tie("position/altitude-ft",
+ tie("position/altitude-ft",
SGRawValueMethods<FGAIBase,double>(*this,
&FGAIBase::_getElevationFt,
&FGAIBase::_setAltitude));
- props->tie("position/latitude-deg",
+ tie("position/latitude-deg",
SGRawValueMethods<FGAIBase,double>(*this,
&FGAIBase::_getLatitude,
&FGAIBase::_setLatitude));
- props->tie("position/longitude-deg",
+ tie("position/longitude-deg",
SGRawValueMethods<FGAIBase,double>(*this,
&FGAIBase::_getLongitude,
&FGAIBase::_setLongitude));
- props->tie("controls/break", SGRawValuePointer<bool>(&_break));
- props->tie("controls/join", SGRawValuePointer<bool>(&_join));
+ tie("controls/break", SGRawValuePointer<bool>(&_break));
+ tie("controls/join", SGRawValuePointer<bool>(&_join));
- props->tie("controls/formate-to-ac",
+ tie("controls/formate-to-ac",
SGRawValueMethods<FGAIWingman,bool>
(*this, &FGAIWingman::getFormate, &FGAIWingman::setFormate));
- props->tie("controls/tgt-heading-deg",
+ tie("controls/tgt-heading-deg",
SGRawValueMethods<FGAIWingman,double>
(*this, &FGAIWingman::getTgtHdg, &FGAIWingman::setTgtHdg));
- props->tie("controls/tgt-speed-kt",
+ tie("controls/tgt-speed-kt",
SGRawValueMethods<FGAIWingman,double>
(*this, &FGAIWingman::getTgtSpd, &FGAIWingman::setTgtSpd));
- props->tie("controls/break-deg-rel",
+ tie("controls/break-deg-rel",
SGRawValueMethods<FGAIWingman,double>
(*this, &FGAIWingman::getBrkAng, &FGAIWingman::setBrkAng));
- props->tie("controls/coefficients/heading",
+ tie("controls/coefficients/heading",
SGRawValuePointer<double>(&_coeff_hdg));
- props->tie("controls/coefficients/pitch",
+ tie("controls/coefficients/pitch",
SGRawValuePointer<double>(&_coeff_pch));
- props->tie("controls/coefficients/bank",
+ tie("controls/coefficients/bank",
SGRawValuePointer<double>(&_coeff_bnk));
- props->tie("controls/coefficients/speed",
+ tie("controls/coefficients/speed",
SGRawValuePointer<double>(&_coeff_spd));
- props->tie("orientation/pitch-deg", SGRawValuePointer<double>(&pitch));
- props->tie("orientation/roll-deg", SGRawValuePointer<double>(&roll));
- props->tie("orientation/true-heading-deg", SGRawValuePointer<double>(&hdg));
+ tie("orientation/pitch-deg", SGRawValuePointer<double>(&pitch));
+ tie("orientation/roll-deg", SGRawValuePointer<double>(&roll));
+ tie("orientation/true-heading-deg", SGRawValuePointer<double>(&hdg));
- props->tie("submodels/serviceable", SGRawValuePointer<bool>(&serviceable));
+ tie("submodels/serviceable", SGRawValuePointer<bool>(&serviceable));
- props->tie("load/rel-brg-to-user-deg",
+ tie("load/rel-brg-to-user-deg",
SGRawValueMethods<FGAIBallistic,double>
(*this, &FGAIBallistic::getRelBrgHitchToUser));
- props->tie("load/elev-to-user-deg",
+ tie("load/elev-to-user-deg",
SGRawValueMethods<FGAIBallistic,double>
(*this, &FGAIBallistic::getElevHitchToUser));
- props->tie("velocities/vertical-speed-fps",
+ tie("velocities/vertical-speed-fps",
SGRawValuePointer<double>(&vs));
- props->tie("velocities/true-airspeed-kt",
+ tie("velocities/true-airspeed-kt",
SGRawValuePointer<double>(&speed));
- props->tie("velocities/speed-east-fps",
+ tie("velocities/speed-east-fps",
SGRawValuePointer<double>(&_speed_east_fps));
- props->tie("velocities/speed-north-fps",
+ tie("velocities/speed-north-fps",
SGRawValuePointer<double>(&_speed_north_fps));
- props->tie("position/x-offset",
+ tie("position/x-offset",
SGRawValueMethods<FGAIBase,double>(*this, &FGAIBase::_getXOffset, &FGAIBase::setXoffset));
- props->tie("position/y-offset",
+ tie("position/y-offset",
SGRawValueMethods<FGAIBase,double>(*this, &FGAIBase::_getYOffset, &FGAIBase::setYoffset));
- props->tie("position/z-offset",
+ tie("position/z-offset",
SGRawValueMethods<FGAIBase,double>(*this, &FGAIBase::_getZOffset, &FGAIBase::setZoffset));
- props->tie("position/tgt-x-offset",
+ tie("position/tgt-x-offset",
SGRawValueMethods<FGAIBallistic,double>(*this, &FGAIBallistic::getTgtXOffset, &FGAIBallistic::setTgtXOffset));
- props->tie("position/tgt-y-offset",
+ tie("position/tgt-y-offset",
SGRawValueMethods<FGAIBallistic,double>(*this, &FGAIBallistic::getTgtYOffset, &FGAIBallistic::setTgtYOffset));
- props->tie("position/tgt-z-offset",
+ tie("position/tgt-z-offset",
SGRawValueMethods<FGAIBallistic,double>(*this, &FGAIBallistic::getTgtZOffset, &FGAIBallistic::setTgtZOffset));
}
-void FGAIWingman::unbind() {
- FGAIBallistic::unbind();
-
- props->untie("id");
- props->untie("SubID");
-
- props->untie("orientation/pitch-deg");
- props->untie("orientation/roll-deg");
- props->untie("orientation/true-heading-deg");
-
- props->untie("controls/formate-to-ac");
- props->untie("controls/break");
- props->untie("controls/join");
- props->untie("controls/tgt-heading-deg");
- props->untie("controls/tgt-speed-kt");
- props->untie("controls/break-deg-rel");
- props->untie("controls/coefficients/heading");
- props->untie("controls/coefficients/pitch");
- props->untie("controls/coefficients/bank");
- props->untie("controls/coefficients/speed");
-
- props->untie("submodels/serviceable");
-
- props->untie("velocities/true-airspeed-kt");
- props->untie("velocities/vertical-speed-fps");
- props->untie("velocities/speed_east_fps");
- props->untie("velocities/speed_north_fps");
-
- props->untie("load/rel-brg-to-user-deg");
- props->untie("load/elev-to-user-deg");
-
- props->untie("position/altitude-ft");
- props->untie("position/latitude-deg");
- props->untie("position/longitude-deg");
- props->untie("position/x-offset");
- props->untie("position/y-offset");
- props->untie("position/z-offset");
- props->untie("position/tgt-x-offset");
- props->untie("position/tgt-y-offset");
- props->untie("position/tgt-z-offset");
-}
-
bool FGAIWingman::init(bool search_in_AI_path) {
if (!FGAIBallistic::init(search_in_AI_path))
return false;
bool init(bool search_in_AI_path=false);
virtual void bind();
- virtual void unbind();
virtual void reinit();
virtual void update (double dt);
{
bound = true;
- // Aircraft position
- fgTie("/position/latitude-deg", this,
- &FGInterface::get_Latitude_deg,
- &FGInterface::set_Latitude_deg,
- false);
+ _tiedProperties.setRoot(globals->get_props());
+ // Aircraft position
+ _tiedProperties.Tie("/position/latitude-deg", this,
+ &FGInterface::get_Latitude_deg,
+ &FGInterface::set_Latitude_deg,
+ false);
fgSetArchivable("/position/latitude-deg");
- fgTie("/position/longitude-deg", this,
- &FGInterface::get_Longitude_deg,
- &FGInterface::set_Longitude_deg,
- false);
+ _tiedProperties.Tie("/position/longitude-deg", this,
+ &FGInterface::get_Longitude_deg,
+ &FGInterface::set_Longitude_deg,
+ false);
fgSetArchivable("/position/longitude-deg");
- fgTie("/position/altitude-ft", this,
- &FGInterface::get_Altitude,
- &FGInterface::set_Altitude,
- false);
+ _tiedProperties.Tie("/position/altitude-ft", this,
+ &FGInterface::get_Altitude,
+ &FGInterface::set_Altitude,
+ false);
fgSetArchivable("/position/altitude-ft");
- fgTie("/position/altitude-agl-ft", this,
- &FGInterface::get_Altitude_AGL, &FGInterface::set_AltitudeAGL, false);
+ _tiedProperties.Tie("/position/altitude-agl-ft", this,
+ &FGInterface::get_Altitude_AGL, &FGInterface::set_AltitudeAGL, false);
fgSetArchivable("/position/ground-elev-ft");
- fgTie("/position/ground-elev-ft", this,
- &FGInterface::get_Runway_altitude); // read-only
+ _tiedProperties.Tie("/position/ground-elev-ft", this,
+ &FGInterface::get_Runway_altitude); // read-only
fgSetArchivable("/position/ground-elev-m");
- fgTie("/position/ground-elev-m", this,
- &FGInterface::get_Runway_altitude_m); // read-only
- fgTie("/environment/ground-elevation-m", this,
- &FGInterface::get_Runway_altitude_m); // read-only
+ _tiedProperties.Tie("/position/ground-elev-m", this,
+ &FGInterface::get_Runway_altitude_m); // read-only
+ _tiedProperties.Tie("/environment/ground-elevation-m", this,
+ &FGInterface::get_Runway_altitude_m); // read-only
fgSetArchivable("/position/sea-level-radius-ft");
- fgTie("/position/sea-level-radius-ft", this,
- &FGInterface::get_Sea_level_radius,
- &FGInterface::_set_Sea_level_radius, false);
-
- // Orientation
- fgTie("/orientation/roll-deg", this,
- &FGInterface::get_Phi_deg,
- &FGInterface::set_Phi_deg, false);
+ _tiedProperties.Tie("/position/sea-level-radius-ft", this,
+ &FGInterface::get_Sea_level_radius,
+ &FGInterface::_set_Sea_level_radius, false);
+
+ // Orientation
+ _tiedProperties.Tie("/orientation/roll-deg", this,
+ &FGInterface::get_Phi_deg,
+ &FGInterface::set_Phi_deg, false);
fgSetArchivable("/orientation/roll-deg");
- fgTie("/orientation/pitch-deg", this,
- &FGInterface::get_Theta_deg,
- &FGInterface::set_Theta_deg, false);
+ _tiedProperties.Tie("/orientation/pitch-deg", this,
+ &FGInterface::get_Theta_deg,
+ &FGInterface::set_Theta_deg, false);
fgSetArchivable("/orientation/pitch-deg");
- fgTie("/orientation/heading-deg", this,
- &FGInterface::get_Psi_deg,
- &FGInterface::set_Psi_deg, false);
+ _tiedProperties.Tie("/orientation/heading-deg", this,
+ &FGInterface::get_Psi_deg,
+ &FGInterface::set_Psi_deg, false);
fgSetArchivable("/orientation/heading-deg");
- fgTie("/orientation/track-deg", this,
- &FGInterface::get_Track); // read-only
+ _tiedProperties.Tie("/orientation/track-deg", this,
+ &FGInterface::get_Track); // read-only
// Body-axis "euler rates" (rotation speed, but in a funny
// representation).
- fgTie("/orientation/roll-rate-degps", this,
- &FGInterface::get_Phi_dot_degps,
- &FGInterface::set_Phi_dot_degps, false);
- fgTie("/orientation/pitch-rate-degps", this,
- &FGInterface::get_Theta_dot_degps,
- &FGInterface::set_Theta_dot_degps, false);
- fgTie("/orientation/yaw-rate-degps", this,
- &FGInterface::get_Psi_dot_degps,
- &FGInterface::set_Psi_dot_degps, false);
-
- fgTie("/orientation/p-body", this, &FGInterface::get_P_body); // read-only
- fgTie("/orientation/q-body", this, &FGInterface::get_Q_body); // read-only
- fgTie("/orientation/r-body", this, &FGInterface::get_R_body); // read-only
-
- // Ground speed knots
- fgTie("/velocities/groundspeed-kt", this,
- &FGInterface::get_V_ground_speed_kt,
- &FGInterface::set_V_ground_speed_kt); // read-only
-
- // Calibrated airspeed
- fgTie("/velocities/airspeed-kt", this,
- &FGInterface::get_V_calibrated_kts,
- &FGInterface::set_V_calibrated_kts,
- false);
-
- fgTie("/velocities/equivalent-kt", this,
- &FGInterface::get_V_equiv_kts); // read-only
-
- // Mach number
- fgTie("/velocities/mach", this,
- &FGInterface::get_Mach_number,
- &FGInterface::set_Mach_number,
- false);
-
- // Local velocities
-// fgTie("/velocities/speed-north-fps", this,
-// &FGInterface::get_V_north,
-// &FGInterface::set_V_north);
+ _tiedProperties.Tie("/orientation/roll-rate-degps", this,
+ &FGInterface::get_Phi_dot_degps,
+ &FGInterface::set_Phi_dot_degps, false);
+ _tiedProperties.Tie("/orientation/pitch-rate-degps", this,
+ &FGInterface::get_Theta_dot_degps,
+ &FGInterface::set_Theta_dot_degps, false);
+ _tiedProperties.Tie("/orientation/yaw-rate-degps", this,
+ &FGInterface::get_Psi_dot_degps,
+ &FGInterface::set_Psi_dot_degps, false);
+
+ _tiedProperties.Tie("/orientation/p-body", this, &FGInterface::get_P_body); // read-only
+ _tiedProperties.Tie("/orientation/q-body", this, &FGInterface::get_Q_body); // read-only
+ _tiedProperties.Tie("/orientation/r-body", this, &FGInterface::get_R_body); // read-only
+
+ // Ground speed knots
+ _tiedProperties.Tie("/velocities/groundspeed-kt", this,
+ &FGInterface::get_V_ground_speed_kt,
+ &FGInterface::set_V_ground_speed_kt); // read-only
+
+ // Calibrated airspeed
+ _tiedProperties.Tie("/velocities/airspeed-kt", this,
+ &FGInterface::get_V_calibrated_kts,
+ &FGInterface::set_V_calibrated_kts,
+ false);
+
+ _tiedProperties.Tie("/velocities/equivalent-kt", this,
+ &FGInterface::get_V_equiv_kts); // read-only
+
+ // Mach number
+ _tiedProperties.Tie("/velocities/mach", this,
+ &FGInterface::get_Mach_number,
+ &FGInterface::set_Mach_number,
+ false);
+
+ // Local velocities
+// _tiedProperties.Tie("/velocities/speed-north-fps", this,
+// &FGInterface::get_V_north,
+// &FGInterface::set_V_north);
// fgSetArchivable("/velocities/speed-north-fps");
-// fgTie("/velocities/speed-east-fps", this,
-// &FGInterface::get_V_east,
-// &FGInterface::set_V_east);
+// _tiedProperties.Tie("/velocities/speed-east-fps", this,
+// &FGInterface::get_V_east,
+// &FGInterface::set_V_east);
// fgSetArchivable("/velocities/speed-east-fps");
-// fgTie("/velocities/speed-down-fps", this,
-// &FGInterface::get_V_down,
-// &FGInterface::set_V_down);
+// _tiedProperties.Tie("/velocities/speed-down-fps", this,
+// &FGInterface::get_V_down,
+// &FGInterface::set_V_down);
// fgSetArchivable("/velocities/speed-down-fps");
- // FIXME: Temporarily read-only, until the
- // incompatibilities between JSBSim and
- // LaRCSim are fixed (LaRCSim adds the
- // earth's rotation to the east velocity).
- fgTie("/velocities/speed-north-fps", this,
- &FGInterface::get_V_north, &FGInterface::set_V_north, false);
- fgTie("/velocities/speed-east-fps", this,
- &FGInterface::get_V_east, &FGInterface::set_V_east, false);
- fgTie("/velocities/speed-down-fps", this,
- &FGInterface::get_V_down, &FGInterface::set_V_down, false);
-
- fgTie("/velocities/north-relground-fps", this,
- &FGInterface::get_V_north_rel_ground); // read-only
- fgTie("/velocities/east-relground-fps", this,
- &FGInterface::get_V_east_rel_ground); // read-only
- fgTie("/velocities/down-relground-fps", this,
- &FGInterface::get_V_down_rel_ground); // read-only
-
-
- // Relative wind
- // FIXME: temporarily archivable, until
- // the NED problem is fixed.
- fgTie("/velocities/uBody-fps", this,
- &FGInterface::get_uBody,
- &FGInterface::set_uBody,
- false);
+
+ // FIXME: Temporarily read-only, until the
+ // incompatibilities between JSBSim and
+ // LaRCSim are fixed (LaRCSim adds the
+ // earth's rotation to the east velocity).
+ _tiedProperties.Tie("/velocities/speed-north-fps", this,
+ &FGInterface::get_V_north, &FGInterface::set_V_north, false);
+ _tiedProperties.Tie("/velocities/speed-east-fps", this,
+ &FGInterface::get_V_east, &FGInterface::set_V_east, false);
+ _tiedProperties.Tie("/velocities/speed-down-fps", this,
+ &FGInterface::get_V_down, &FGInterface::set_V_down, false);
+
+ _tiedProperties.Tie("/velocities/north-relground-fps", this,
+ &FGInterface::get_V_north_rel_ground); // read-only
+ _tiedProperties.Tie("/velocities/east-relground-fps", this,
+ &FGInterface::get_V_east_rel_ground); // read-only
+ _tiedProperties.Tie("/velocities/down-relground-fps", this,
+ &FGInterface::get_V_down_rel_ground); // read-only
+
+ // Relative wind
+ // FIXME: temporarily archivable, until the NED problem is fixed.
+ _tiedProperties.Tie("/velocities/uBody-fps", this,
+ &FGInterface::get_uBody,
+ &FGInterface::set_uBody,
+ false);
fgSetArchivable("/velocities/uBody-fps");
- fgTie("/velocities/vBody-fps", this,
- &FGInterface::get_vBody,
- &FGInterface::set_vBody,
- false);
+ _tiedProperties.Tie("/velocities/vBody-fps", this,
+ &FGInterface::get_vBody,
+ &FGInterface::set_vBody,
+ false);
fgSetArchivable("/velocities/vBody-fps");
- fgTie("/velocities/wBody-fps", this,
- &FGInterface::get_wBody,
- &FGInterface::set_wBody,
- false);
+ _tiedProperties.Tie("/velocities/wBody-fps", this,
+ &FGInterface::get_wBody,
+ &FGInterface::set_wBody,
+ false);
fgSetArchivable("/velocities/wBody-fps");
- // Climb and slip (read-only)
- fgTie("/velocities/vertical-speed-fps", this,
- &FGInterface::get_Climb_Rate,
- &FGInterface::set_Climb_Rate, false );
- fgTie("/velocities/glideslope", this,
- &FGInterface::get_Gamma_vert_rad,
- &FGInterface::set_Gamma_vert_rad, false );
- fgTie("/orientation/side-slip-rad", this,
- &FGInterface::get_Beta, &FGInterface::_set_Beta, false);
- fgTie("/orientation/side-slip-deg", this,
- &FGInterface::get_Beta_deg); // read-only
- fgTie("/orientation/alpha-deg", this,
- &FGInterface::get_Alpha_deg, &FGInterface::set_Alpha_deg, false);
- fgTie("/accelerations/nlf", this,
- &FGInterface::get_Nlf); // read-only
-
- // NED accelerations
- fgTie("/accelerations/ned/north-accel-fps_sec",
- this, &FGInterface::get_V_dot_north); // read-only
- fgTie("/accelerations/ned/east-accel-fps_sec",
- this, &FGInterface::get_V_dot_east); // read-only
- fgTie("/accelerations/ned/down-accel-fps_sec",
- this, &FGInterface::get_V_dot_down); // read-only
-
- // Pilot accelerations
- fgTie("/accelerations/pilot/x-accel-fps_sec",
- this, &FGInterface::get_A_X_pilot, &FGInterface::set_A_X_pilot, false);
- fgTie("/accelerations/pilot/y-accel-fps_sec",
- this, &FGInterface::get_A_Y_pilot, &FGInterface::set_A_Y_pilot, false);
- fgTie("/accelerations/pilot/z-accel-fps_sec",
- this, &FGInterface::get_A_Z_pilot, &FGInterface::set_A_Z_pilot, false);
-
- fgTie("/accelerations/n-z-cg-fps_sec",
- this, &FGInterface::get_N_Z_cg); // read-only
-
+ // Climb and slip (read-only)
+ _tiedProperties.Tie("/velocities/vertical-speed-fps", this,
+ &FGInterface::get_Climb_Rate,
+ &FGInterface::set_Climb_Rate, false );
+ _tiedProperties.Tie("/velocities/glideslope", this,
+ &FGInterface::get_Gamma_vert_rad,
+ &FGInterface::set_Gamma_vert_rad, false );
+ _tiedProperties.Tie("/orientation/side-slip-rad", this,
+ &FGInterface::get_Beta, &FGInterface::_set_Beta, false);
+ _tiedProperties.Tie("/orientation/side-slip-deg", this,
+ &FGInterface::get_Beta_deg); // read-only
+ _tiedProperties.Tie("/orientation/alpha-deg", this,
+ &FGInterface::get_Alpha_deg, &FGInterface::set_Alpha_deg, false);
+ _tiedProperties.Tie("/accelerations/nlf", this,
+ &FGInterface::get_Nlf); // read-only
+
+ // NED accelerations
+ _tiedProperties.Tie("/accelerations/ned/north-accel-fps_sec",
+ this, &FGInterface::get_V_dot_north); // read-only
+ _tiedProperties.Tie("/accelerations/ned/east-accel-fps_sec",
+ this, &FGInterface::get_V_dot_east); // read-only
+ _tiedProperties.Tie("/accelerations/ned/down-accel-fps_sec",
+ this, &FGInterface::get_V_dot_down); // read-only
+
+ // Pilot accelerations
+ _tiedProperties.Tie("/accelerations/pilot/x-accel-fps_sec",
+ this, &FGInterface::get_A_X_pilot, &FGInterface::set_A_X_pilot, false);
+ _tiedProperties.Tie("/accelerations/pilot/y-accel-fps_sec",
+ this, &FGInterface::get_A_Y_pilot, &FGInterface::set_A_Y_pilot, false);
+ _tiedProperties.Tie("/accelerations/pilot/z-accel-fps_sec",
+ this, &FGInterface::get_A_Z_pilot, &FGInterface::set_A_Z_pilot, false);
+
+ _tiedProperties.Tie("/accelerations/n-z-cg-fps_sec",
+ this, &FGInterface::get_N_Z_cg); // read-only
}
void
FGInterface::unbind ()
{
- if (!bound) {
- return;
- }
-
+ _tiedProperties.Untie();
bound = false;
-
- fgUntie("/position/latitude-deg");
- fgUntie("/position/longitude-deg");
- fgUntie("/position/altitude-ft");
- fgUntie("/position/altitude-agl-ft");
- fgUntie("/position/ground-elev-ft");
- fgUntie("/position/ground-elev-m");
- fgUntie("/environment/ground-elevation-m");
- fgUntie("/position/sea-level-radius-ft");
- fgUntie("/orientation/roll-deg");
- fgUntie("/orientation/pitch-deg");
- fgUntie("/orientation/heading-deg");
- fgUntie("/orientation/track-deg");
- fgUntie("/orientation/roll-rate-degps");
- fgUntie("/orientation/pitch-rate-degps");
- fgUntie("/orientation/yaw-rate-degps");
- fgUntie("/orientation/p-body");
- fgUntie("/orientation/q-body");
- fgUntie("/orientation/r-body");
- fgUntie("/orientation/side-slip-rad");
- fgUntie("/orientation/side-slip-deg");
- fgUntie("/orientation/alpha-deg");
- fgUntie("/velocities/airspeed-kt");
- fgUntie("/velocities/groundspeed-kt");
- fgUntie("/velocities/equivalent-kt");
- fgUntie("/velocities/mach");
- fgUntie("/velocities/speed-north-fps");
- fgUntie("/velocities/speed-east-fps");
- fgUntie("/velocities/speed-down-fps");
- fgUntie("/velocities/north-relground-fps");
- fgUntie("/velocities/east-relground-fps");
- fgUntie("/velocities/down-relground-fps");
- fgUntie("/velocities/uBody-fps");
- fgUntie("/velocities/vBody-fps");
- fgUntie("/velocities/wBody-fps");
- fgUntie("/velocities/vertical-speed-fps");
- fgUntie("/velocities/glideslope");
- fgUntie("/accelerations/nlf");
- fgUntie("/accelerations/pilot/x-accel-fps_sec");
- fgUntie("/accelerations/pilot/y-accel-fps_sec");
- fgUntie("/accelerations/pilot/z-accel-fps_sec");
- fgUntie("/accelerations/ned/north-accel-fps_sec");
- fgUntie("/accelerations/ned/east-accel-fps_sec");
- fgUntie("/accelerations/ned/down-accel-fps_sec");
- fgUntie("/accelerations/n-z-cg-fps_sec");
}
/**
void FGInterface::_updateGeocentricPosition( double lat, double lon,
- double alt )
+ double alt )
{
_updatePosition(SGGeoc::fromRadFt(lon, lat, get_Sea_level_radius() + alt));
}
}
void FGInterface::set_Velocities_Local( double north,
- double east,
- double down ){
+ double east,
+ double down ){
v_local_v[0] = north;
v_local_v[1] = east;
v_local_v[2] = down;
}
void FGInterface::set_Velocities_Wind_Body( double u,
- double v,
- double w){
+ double v,
+ double w){
v_wind_body_v[0] = u;
v_wind_body_v[1] = v;
v_wind_body_v[2] = w;
// Euler angles
void FGInterface::set_Euler_Angles( double phi,
- double theta,
- double psi ) {
+ double theta,
+ double psi ) {
euler_angles_v[0] = phi;
euler_angles_v[1] = theta;
- euler_angles_v[2] = psi;
+ euler_angles_v[2] = psi;
}
// Flight Path
void FGInterface::set_Density(double rho) { density = rho; }
void FGInterface::set_Velocities_Local_Airmass (double wnorth,
- double weast,
- double wdown ) {
+ double weast,
+ double wdown ) {
v_local_airmass_v[0] = wnorth;
v_local_airmass_v[1] = weast;
v_local_airmass_v[2] = wdown;
}
-void FGInterface::_busdump(void) {
-
+void FGInterface::_busdump(void)
+{
SG_LOG(SG_FLIGHT,SG_INFO,"d_cg_rp_body_v: " << d_cg_rp_body_v);
SG_LOG(SG_FLIGHT,SG_INFO,"v_dot_local_v: " << v_dot_local_v);
SG_LOG(SG_FLIGHT,SG_INFO,"v_dot_body_v: " << v_dot_body_v);
#include <simgear/compiler.h>
#include <simgear/constants.h>
#include <simgear/structure/subsystem_mgr.hxx>
+#include <simgear/props/tiedpropertylist.hxx>
#include <FDM/groundcache.hxx>
using std::list;
bool inited;
// Have we bound to the property system
- bool bound;
+ bool bound;
// periodic update management variable. This is a scheme to run
// the fdm with a fixed delta-t. We control how many iteration of
double altitude_agl;
double track;
+ simgear::TiedPropertyList _tiedProperties;
+
// the ground cache object itself.
FGGroundCache ground_cache;
void FGKeyboardInput::bind()
{
- fgTie("/devices/status/keyboard", getModifiers);
- fgTie("/devices/status/keyboard/shift", getModShift);
- fgTie("/devices/status/keyboard/ctrl", getModCtrl);
- fgTie("/devices/status/keyboard/alt", getModAlt);
- fgTie("/devices/status/keyboard/meta", getModMeta);
- fgTie("/devices/status/keyboard/super", getModSuper);
- fgTie("/devices/status/keyboard/hyper", getModHyper);
-
- _key_event->tie("key", SGRawValuePointer<int>(&_key_code));
- _key_event->tie("pressed", SGRawValuePointer<bool>(&_key_pressed));
- _key_event->tie("modifier", SGRawValuePointer<int>(&_key_modifiers));
- _key_event->tie("modifier/shift", SGRawValuePointer<bool>(&_key_shift));
- _key_event->tie("modifier/ctrl", SGRawValuePointer<bool>(&_key_ctrl));
- _key_event->tie("modifier/alt", SGRawValuePointer<bool>(&_key_alt));
- _key_event->tie("modifier/meta", SGRawValuePointer<bool>(&_key_meta));
- _key_event->tie("modifier/super", SGRawValuePointer<bool>(&_key_super));
- _key_event->tie("modifier/hyper", SGRawValuePointer<bool>(&_key_hyper));
+ _tiedProperties.setRoot(fgGetNode("/device/status", true));
+ _tiedProperties.Tie("keyboard", getModifiers);
+ _tiedProperties.Tie("keyboard/shift", getModShift);
+ _tiedProperties.Tie("keyboard/ctrl", getModCtrl);
+ _tiedProperties.Tie("keyboard/alt", getModAlt);
+ _tiedProperties.Tie("keyboard/meta", getModMeta);
+ _tiedProperties.Tie("keyboard/super", getModSuper);
+ _tiedProperties.Tie("keyboard/hyper", getModHyper);
+
+ _tiedProperties.Tie(_key_event->getNode("key", true), SGRawValuePointer<int>(&_key_code));
+ _tiedProperties.Tie(_key_event->getNode("pressed", true), SGRawValuePointer<bool>(&_key_pressed));
+ _tiedProperties.Tie(_key_event->getNode("modifier", true), SGRawValuePointer<int>(&_key_modifiers));
+ _tiedProperties.Tie(_key_event->getNode("modifier/shift", true), SGRawValuePointer<bool>(&_key_shift));
+ _tiedProperties.Tie(_key_event->getNode("modifier/ctrl", true), SGRawValuePointer<bool>(&_key_ctrl));
+ _tiedProperties.Tie(_key_event->getNode("modifier/alt", true), SGRawValuePointer<bool>(&_key_alt));
+ _tiedProperties.Tie(_key_event->getNode("modifier/meta", true), SGRawValuePointer<bool>(&_key_meta));
+ _tiedProperties.Tie(_key_event->getNode("modifier/super", true), SGRawValuePointer<bool>(&_key_super));
+ _tiedProperties.Tie(_key_event->getNode("modifier/hyper", true), SGRawValuePointer<bool>(&_key_hyper));
}
void FGKeyboardInput::unbind()
{
- fgUntie("/devices/status/keyboard");
- fgUntie("/devices/status/keyboard/shift");
- fgUntie("/devices/status/keyboard/ctrl");
- fgUntie("/devices/status/keyboard/alt");
- fgUntie("/devices/status/keyboard/meta");
- fgUntie("/devices/status/keyboard/super");
- fgUntie("/devices/status/keyboard/hyper");
-
- _key_event->untie("key");
- _key_event->untie("pressed");
- _key_event->untie("modifier");
- _key_event->untie("modifier/shift");
- _key_event->untie("modifier/ctrl");
- _key_event->untie("modifier/alt");
- _key_event->untie("modifier/meta");
- _key_event->untie("modifier/super");
- _key_event->untie("modifier/hyper");
+ _tiedProperties.Untie();
}
void FGKeyboardInput::update( double dt )
#ifndef _FGKEYBOARDINPUT_HXX
#define _FGKEYBOARDINPUT_HXX
-#ifndef __cplusplus
+#ifndef __cplusplus
# error This library requires C++
#endif
#include "FGCommonInput.hxx"
#include "FGButton.hxx"
#include <simgear/structure/subsystem_mgr.hxx>
+#include <simgear/props/tiedpropertylist.hxx>
////////////////////////////////////////////////////////////////////////
// The Keyboard Input Class
bool _key_meta;
bool _key_super;
bool _key_hyper;
+ simgear::TiedPropertyList _tiedProperties;
};
#endif
}
void DCLGPS::bind() {
- fgTie("/instrumentation/gps/waypoint-alert", this, &DCLGPS::GetWaypointAlert);
- fgTie("/instrumentation/gps/leg-mode", this, &DCLGPS::GetLegMode);
- fgTie("/instrumentation/gps/obs-mode", this, &DCLGPS::GetOBSMode);
- fgTie("/instrumentation/gps/approach-arm", this, &DCLGPS::GetApproachArm);
- fgTie("/instrumentation/gps/approach-active", this, &DCLGPS::GetApproachActive);
- fgTie("/instrumentation/gps/cdi-deflection", this, &DCLGPS::GetCDIDeflection);
- fgTie("/instrumentation/gps/to-flag", this, &DCLGPS::GetToFlag);
+ _tiedProperties.setRoot(fgGetNode("/instrumentation/gps", true));
+ _tiedProperties.Tie("waypoint-alert", this, &DCLGPS::GetWaypointAlert);
+ _tiedProperties.Tie("leg-mode", this, &DCLGPS::GetLegMode);
+ _tiedProperties.Tie("obs-mode", this, &DCLGPS::GetOBSMode);
+ _tiedProperties.Tie("approach-arm", this, &DCLGPS::GetApproachArm);
+ _tiedProperties.Tie("approach-active", this, &DCLGPS::GetApproachActive);
+ _tiedProperties.Tie("cdi-deflection", this, &DCLGPS::GetCDIDeflection);
+ _tiedProperties.Tie("to-flag", this, &DCLGPS::GetToFlag);
}
void DCLGPS::unbind() {
- fgUntie("/instrumentation/gps/waypoint-alert");
- fgUntie("/instrumentation/gps/leg-mode");
- fgUntie("/instrumentation/gps/obs-mode");
- fgUntie("/instrumentation/gps/approach-arm");
- fgUntie("/instrumentation/gps/approach-active");
- fgUntie("/instrumentation/gps/cdi-deflection");
+ _tiedProperties.Untie();
}
void DCLGPS::update(double dt) {
#include <simgear/structure/subsystem_mgr.hxx>
#include <simgear/props/props.hxx>
+#include <simgear/props/tiedpropertylist.hxx>
#include <Navaids/positioned.hxx>
class SGTime;
// Configuration that affects flightplan operation
bool _turnAnticipationEnabled;
-
+
// Magvar stuff. Might get some of this stuff (such as time) from FG in future.
SGTime* _time;
-
- std::list<std::string> _messageStack;
-
+
+ std::list<std::string> _messageStack;
+
virtual void CreateFlightPlan(GPSFlightPlan* fp, std::vector<std::string> ids, std::vector<GPSWpType> wps);
// Orientate the GPS unit to a flightplan - ie. figure out from current position
// More hackery since we aren't actually storing an approach class... Doh!
std::string _approachAbbrev;
std::string _approachRwyStr;
+private:
+ simgear::TiedPropertyList _tiedProperties;
};
#endif // _DCLGPS_HXX
GPS::bind()
{
_config.bind(this, _gpsNode->getChild("config", 0, true));
+
// basic GPS outputs
tie(_gpsNode, "selected-course-deg", SGRawValueMethods<GPS, double>
(*this, &GPS::getSelectedCourse, &GPS::setSelectedCourse));
-
+
tie(_gpsNode, "desired-course-deg", SGRawValueMethods<GPS, double>
(*this, &GPS::getDesiredCourse, NULL));
_desiredCourseNode = _gpsNode->getChild("desired-course-deg", 0, true);
tie(_gpsNode, "indicated-ground-speed-kt", SGRawValueMethods<GPS, double>
(*this, &GPS::getGroundspeedKts, NULL));
-// command system
+// command system
tie(_gpsNode, "mode", SGRawValueMethods<GPS, const char*>(*this, &GPS::getMode, NULL));
tie(_gpsNode, "command", SGRawValueMethods<GPS, const char*>(*this, &GPS::getCommand, &GPS::setCommand));
void
GPS::unbind()
{
- for (unsigned int t=0; t<_tiedNodes.size(); ++t) {
- _tiedNodes[t]->untie();
- }
- _tiedNodes.clear();
+ _tiedProperties.Untie();
}
void
#include <simgear/props/props.hxx>
#include <simgear/structure/subsystem_mgr.hxx>
+#include <simgear/props/tiedpropertylist.hxx>
#include <simgear/math/SGMath.hxx>
#include <Navaids/positioned.hxx>
SGGeodProperty()
{
}
-
- void init(SGPropertyNode* base, const char* lonStr, const char* latStr, const char* altStr = NULL);
- void init(const char* lonStr, const char* latStr, const char* altStr = NULL);
- void clear();
- void operator=(const SGGeod& geod);
+
+ void init(SGPropertyNode* base, const char* lonStr, const char* latStr, const char* altStr = NULL);
+ void init(const char* lonStr, const char* latStr, const char* altStr = NULL);
+ void clear();
+ void operator=(const SGGeod& geod);
SGGeod get() const;
+
private:
SGPropertyNode_ptr _lon, _lat, _alt;
};
* /instrumentation/gps/trip-odometer
* /instrumentation/gps/true-bug-error-deg
* /instrumentation/gps/magnetic-bug-error-deg
-
*/
class GPS : public SGSubsystem, public flightgear::RNAV
{
// SGSubsystem interface
virtual void init ();
virtual void update (double delta_time_sec);
-
+
virtual void bind();
virtual void unbind();
virtual double magvarDeg();
virtual double selectedMagCourse();
virtual double overflightArmDistanceM();
-
+
private:
friend class GPSListener;
friend class SearchFilter;
-
+
/**
* Configuration manager, track data relating to aircraft installation
*/
{
public:
Config();
-
+
void bind(GPS* aOwner, SGPropertyNode* aCfg);
-
- bool turnAnticipationEnabled() const
- { return _enableTurnAnticipation; }
-
+
+ bool turnAnticipationEnabled() const { return _enableTurnAnticipation; }
+
/**
* Desired turn rate in degrees/second. From this we derive the turn
* radius and hence how early we need to anticipate it.
*/
- double turnRateDegSec() const
- { return _turnRate; }
-
+ double turnRateDegSec() const { return _turnRate; }
+
/**
* Distance at which we arm overflight sequencing. Once inside this
* distance, a change of the wp1 'TO' flag to false will be considered
* overlight of the wp.
*/
- double overflightArmDistanceNm() const
- { return _overflightArmDistance; }
-
+ double overflightArmDistanceNm() const { return _overflightArmDistance; }
+
/**
* Time before the next WP to activate an external annunciator
*/
- double waypointAlertTime() const
- { return _waypointAlertTime; }
-
- bool requireHardSurface() const
- { return _requireHardSurface; }
-
- double minRunwayLengthFt() const
- { return _minRunwayLengthFt; }
-
- bool cdiDeflectionIsAngular() const
- { return (_cdiMaxDeflectionNm <= 0.0); }
-
+ double waypointAlertTime() const { return _waypointAlertTime; }
+
+ bool requireHardSurface() const { return _requireHardSurface; }
+
+ double minRunwayLengthFt() const { return _minRunwayLengthFt; }
+
+ bool cdiDeflectionIsAngular() const { return (_cdiMaxDeflectionNm <= 0.0); }
+
double cdiDeflectionLinearPeg() const
{
assert(_cdiMaxDeflectionNm > 0.0);
return _cdiMaxDeflectionNm;
}
-
- bool driveAutopilot() const
- { return _driveAutopilot; }
-
- bool courseSelectable() const
- { return _courseSelectable; }
+
+ bool driveAutopilot() const { return _driveAutopilot; }
+
+ bool courseSelectable() const { return _courseSelectable; }
+
private:
bool _enableTurnAnticipation;
-
+
// desired turn rate in degrees per second
double _turnRate;
-
+
// distance from waypoint to arm overflight sequencing (in nm)
double _overflightArmDistance;
-
- // time before reaching a waypoint to trigger annunicator light/sound
+
+ // time before reaching a waypoint to trigger annunciator light/sound
// (in seconds)
double _waypointAlertTime;
-
+
// minimum runway length to require when filtering
double _minRunwayLengthFt;
-
+
// should we require a hard-surfaced runway when filtering?
bool _requireHardSurface;
-
+
double _cdiMaxDeflectionNm;
-
+
// should we drive the autopilot directly or not?
bool _driveAutopilot;
-
+
// is selected-course-deg read to set desired-course or not?
bool _courseSelectable;
};
-
+
class SearchFilter : public FGPositioned::Filter
{
- public:
+ public:
virtual bool pass(FGPositioned* aPos) const;
-
+
virtual FGPositioned::Type minType() const;
virtual FGPositioned::Type maxType() const;
};
-
- /**
- * reset all output properties to default / non-service values
- */
+
+ /** reset all output properties to default / non-service values */
void clearOutput();
void updateBasicData(double dt);
void routeManagerSequenced();
void routeEdited();
void routeFinished();
-
- void updateTurn();
- void updateOverflight();
+
+ void updateTurn();
+ void updateOverflight();
void beginTurn();
void endTurn();
-
+
double computeTurnProgress(double aBearing) const;
void computeTurnData();
void updateTurnData();
double computeTurnRadiusNm(double aGroundSpeedKts) const;
+
+ /** Update one-shot things when WP1 / leg data change */
+ void wp1Changed();
+
+// scratch maintenance utilities
+ void setScratchFromPositioned(FGPositioned* aPos, int aIndex);
+ void setScratchFromCachedSearchResult();
+ void setScratchFromRouteWaypoint(int aIndex);
+
+ /** Add airport-specific information to a scratch result */
+ void addAirportToScratch(FGAirport* aAirport);
- /**
- * Update one-shot things when WP1 / leg data change
- */
- void wp1Changed();
-
-// scratch maintenence utilities
- void setScratchFromPositioned(FGPositioned* aPos, int aIndex);
- void setScratchFromCachedSearchResult();
- void setScratchFromRouteWaypoint(int aIndex);
-
- /**
- * Add airport-specific information to a scratch result
- */
- void addAirportToScratch(FGAirport* aAirport);
-
- void clearScratch();
-
- /**
- * Predicate, determine if the lon/lat position in the scratch is
- * valid or not.
- */
- bool isScratchPositionValid() const;
-
- FGPositioned::Filter* createFilter(FGPositioned::Type aTy);
-
- /**
- * Search kernel - called each time we step through a result
- */
- void performSearch();
+ void clearScratch();
+
+ /** Predicate, determine if the lon/lat position in the scratch is
+ * valid or not. */
+ bool isScratchPositionValid() const;
+
+ FGPositioned::Filter* createFilter(FGPositioned::Type aTy);
+ /** Search kernel - called each time we step through a result */
+ void performSearch();
+
// command handlers
- void selectLegMode();
- void selectOBSMode();
- void directTo();
- void loadRouteWaypoint();
- void loadNearest();
- void search();
- void nextResult();
- void previousResult();
- void defineWaypoint();
- void insertWaypointAtIndex(int aIndex);
- void removeWaypointAtIndex(int aIndex);
-
+ void selectLegMode();
+ void selectOBSMode();
+ void directTo();
+ void loadRouteWaypoint();
+ void loadNearest();
+ void search();
+ void nextResult();
+ void previousResult();
+ void defineWaypoint();
+ void insertWaypointAtIndex(int aIndex);
+ void removeWaypointAtIndex(int aIndex);
+
// tied-property getter/setters
- void setCommand(const char* aCmd);
- const char* getCommand() const { return ""; }
-
- const char* getMode() const { return _mode.c_str(); }
-
- bool getScratchValid() const { return _scratchValid; }
- double getScratchDistance() const;
- double getScratchMagBearing() const;
- double getScratchTrueBearing() const;
- bool getScratchHasNext() const;
-
- double getSelectedCourse() const { return _selectedCourse; }
- void setSelectedCourse(double crs);
- double getDesiredCourse() const { return _desiredCourse; }
-
- double getCDIDeflection() const;
-
- double getLegDistance() const;
- double getLegCourse() const;
- double getLegMagCourse() const;
-
- double getTrueTrack() const { return _last_true_track; }
- double getMagTrack() const;
- double getGroundspeedKts() const { return _last_speed_kts; }
- double getVerticalSpeed() const { return _last_vertical_speed; }
-
- //bool getLegMode() const { return _mode == "leg"; }
- //bool getObsMode() const { return _mode == "obs"; }
-
- const char* getWP0Ident() const;
- const char* getWP0Name() const;
-
- const char* getWP1Ident() const;
- const char* getWP1Name() const;
-
- double getWP1Distance() const;
- double getWP1TTW() const;
- const char* getWP1TTWString() const;
- double getWP1Bearing() const;
- double getWP1MagBearing() const;
- double getWP1CourseDeviation() const;
- double getWP1CourseErrorNm() const;
- bool getWP1ToFlag() const;
- bool getWP1FromFlag() const;
-
- // true-bearing-error and mag-bearing-error
-
+ void setCommand(const char* aCmd);
+ const char* getCommand() const { return ""; }
+
+ const char* getMode() const { return _mode.c_str(); }
+
+ bool getScratchValid() const { return _scratchValid; }
+ double getScratchDistance() const;
+ double getScratchMagBearing() const;
+ double getScratchTrueBearing() const;
+ bool getScratchHasNext() const;
+
+ double getSelectedCourse() const { return _selectedCourse; }
+ void setSelectedCourse(double crs);
+ double getDesiredCourse() const { return _desiredCourse; }
+
+ double getCDIDeflection() const;
+
+ double getLegDistance() const;
+ double getLegCourse() const;
+ double getLegMagCourse() const;
+
+ double getTrueTrack() const { return _last_true_track; }
+ double getMagTrack() const;
+ double getGroundspeedKts() const { return _last_speed_kts; }
+ double getVerticalSpeed() const { return _last_vertical_speed; }
+
+ //bool getLegMode() const { return _mode == "leg"; }
+ //bool getObsMode() const { return _mode == "obs"; }
- /**
- * Tied-properties helper, record nodes which are tied for easy un-tie-ing
- */
- template <typename T>
- void tie(SGPropertyNode* aNode, const char* aRelPath, const SGRawValue<T>& aRawValue)
- {
- SGPropertyNode* nd = aNode->getNode(aRelPath, true);
- _tiedNodes.push_back(nd);
- nd->tie(aRawValue);
- }
-
- /// helper, tie the lat/lon/elev of a SGGeod to the named children of aNode
- void tieSGGeod(SGPropertyNode* aNode, SGGeod& aRef,
- const char* lonStr, const char* latStr, const char* altStr);
+ const char* getWP0Ident() const;
+ const char* getWP0Name() const;
+
+ const char* getWP1Ident() const;
+ const char* getWP1Name() const;
+
+ double getWP1Distance() const;
+ double getWP1TTW() const;
+ const char* getWP1TTWString() const;
+ double getWP1Bearing() const;
+ double getWP1MagBearing() const;
+ double getWP1CourseDeviation() const;
+ double getWP1CourseErrorNm() const;
+ bool getWP1ToFlag() const;
+ bool getWP1FromFlag() const;
+
+ // true-bearing-error and mag-bearing-error
+
+
+ /**
+ * Tied-properties helper, record nodes which are tied for easy un-tie-ing
+ */
+ template <typename T>
+ void tie(SGPropertyNode* aNode, const char* aRelPath, const SGRawValue<T>& aRawValue)
+ {
+ _tiedProperties.Tie(aNode->getNode(aRelPath, true), aRawValue);
+ }
+
+ /** helper, tie the lat/lon/elev of a SGGeod to the named children of aNode */
+ void tieSGGeod(SGPropertyNode* aNode, SGGeod& aRef,
+ const char* lonStr, const char* latStr, const char* altStr);
- /// helper, tie a SGGeod to proeprties, but read-only
- void tieSGGeodReadOnly(SGPropertyNode* aNode, SGGeod& aRef,
- const char* lonStr, const char* latStr, const char* altStr);
+ /** helper, tie a SGGeod to proeprties, but read-only */
+ void tieSGGeodReadOnly(SGPropertyNode* aNode, SGGeod& aRef,
+ const char* lonStr, const char* latStr, const char* altStr);
// members
- SGPropertyNode_ptr _gpsNode;
- SGPropertyNode_ptr _currentWayptNode;
- SGPropertyNode_ptr _magvar_node;
- SGPropertyNode_ptr _serviceable_node;
- SGPropertyNode_ptr _electrical_node;
- SGPropertyNode_ptr _tracking_bug_node;
- SGPropertyNode_ptr _raim_node;
-
- SGPropertyNode_ptr _odometer_node;
+ SGPropertyNode_ptr _gpsNode;
+ SGPropertyNode_ptr _currentWayptNode;
+ SGPropertyNode_ptr _magvar_node;
+ SGPropertyNode_ptr _serviceable_node;
+ SGPropertyNode_ptr _electrical_node;
+ SGPropertyNode_ptr _tracking_bug_node;
+ SGPropertyNode_ptr _raim_node;
+
+ SGPropertyNode_ptr _odometer_node;
SGPropertyNode_ptr _trip_odometer_node;
SGPropertyNode_ptr _true_bug_error_node;
SGPropertyNode_ptr _magnetic_bug_error_node;
SGPropertyNode_ptr _eastWestVelocity;
SGPropertyNode_ptr _northSouthVelocity;
-
+
SGPropertyNode_ptr _ref_navaid_id_node;
SGPropertyNode_ptr _ref_navaid_bearing_node;
SGPropertyNode_ptr _ref_navaid_distance_node;
SGPropertyNode_ptr _ref_navaid_mag_bearing_node;
SGPropertyNode_ptr _ref_navaid_frequency_node;
SGPropertyNode_ptr _ref_navaid_name_node;
-
+
SGPropertyNode_ptr _route_active_node;
SGPropertyNode_ptr _route_current_wp_node;
SGPropertyNode_ptr _routeDistanceNm;
SGPropertyNode_ptr _routeETE;
- SGPropertyNode_ptr _routeEditedSignal;
- SGPropertyNode_ptr _routeFinishedSignal;
- SGPropertyNode_ptr _desiredCourseNode;
-
+ SGPropertyNode_ptr _routeEditedSignal;
+ SGPropertyNode_ptr _routeFinishedSignal;
+ SGPropertyNode_ptr _desiredCourseNode;
+
double _selectedCourse;
double _desiredCourse;
-
+
bool _dataValid;
SGGeod _last_pos;
bool _lastPosValid;
double _last_vertical_speed;
double _lastEWVelocity;
double _lastNSVelocity;
-
+
std::string _mode;
GPSListener* _listener;
Config _config;
FGRouteMgr* _routeMgr;
-
+
bool _ref_navaid_set;
double _ref_navaid_elapsed;
FGPositionedRef _ref_navaid;
-
+
std::string _name;
int _num;
-
- SGGeodProperty _position;
- SGGeod _wp0_position;
- SGGeod _indicated_pos;
- double _legDistanceNm;
-
+
+ SGGeodProperty _position;
+ SGGeod _wp0_position;
+ SGGeod _indicated_pos;
+ double _legDistanceNm;
+
// scratch data
- SGGeod _scratchPos;
- SGPropertyNode_ptr _scratchNode;
- bool _scratchValid;
-
+ SGGeod _scratchPos;
+ SGPropertyNode_ptr _scratchNode;
+ bool _scratchValid;
+
// search data
- int _searchResultIndex;
- std::string _searchQuery;
- FGPositioned::Type _searchType;
- bool _searchExact;
- FGPositioned::List _searchResults;
- bool _searchIsRoute; ///< set if 'search' is actually the current route
- bool _searchHasNext; ///< is there a result after this one?
- bool _searchNames; ///< set if we're searching names instead of idents
-
- // turn data
+ int _searchResultIndex;
+ std::string _searchQuery;
+ FGPositioned::Type _searchType;
+ bool _searchExact;
+ FGPositioned::List _searchResults;
+ bool _searchIsRoute; ///< set if 'search' is actually the current route
+ bool _searchHasNext; ///< is there a result after this one?
+ bool _searchNames; ///< set if we're searching names instead of idents
+
+// turn data
bool _computeTurnData; ///< do we need to update the turn data?
bool _anticipateTurn; ///< are we anticipating the next turn or not?
bool _inTurn; // is a turn in progress?
double _turnRadius; // radius of turn in nm
SGGeod _turnPt;
SGGeod _turnCentre;
-
- std::auto_ptr<flightgear::WayptController> _wayptController;
-
- SGPropertyNode_ptr _realismSimpleGps; ///< should the GPS be simple or realistic?
- flightgear::WayptRef _prevWaypt;
- flightgear::WayptRef _currentWaypt;
-
+
+ std::auto_ptr<flightgear::WayptController> _wayptController;
+
+ SGPropertyNode_ptr _realismSimpleGps; ///< should the GPS be simple or realistic?
+ flightgear::WayptRef _prevWaypt;
+ flightgear::WayptRef _currentWaypt;
+
// autopilot drive properties
- SGPropertyNode_ptr _apDrivingFlag;
- SGPropertyNode_ptr _apTrueHeading;
- SGPropertyNode_ptr _apTargetAltitudeFt;
- SGPropertyNode_ptr _apAltitudeLock;
-
- std::vector<SGPropertyNode_ptr> _tiedNodes;
-};
+ SGPropertyNode_ptr _apDrivingFlag;
+ SGPropertyNode_ptr _apTrueHeading;
+ SGPropertyNode_ptr _apTargetAltitudeFt;
+ SGPropertyNode_ptr _apAltitudeLock;
+
+ simgear::TiedPropertyList _tiedProperties;
+};
#endif // __INSTRUMENTS_GPS_HXX
void FGKR_87::bind () {
+ _tiedProperties.setRoot(fgGetNode("/instrumentation/kr-87", true));
// internal values
- fgTie("/instrumentation/kr-87/internal/valid", this, &FGKR_87::get_valid);
- fgTie("/instrumentation/kr-87/internal/inrange", this,
- &FGKR_87::get_inrange);
- fgTie("/instrumentation/kr-87/internal/dist", this,
- &FGKR_87::get_dist);
- fgTie("/instrumentation/kr-87/internal/heading", this,
- &FGKR_87::get_heading);
+ _tiedProperties.Tie("internal/valid", this, &FGKR_87::get_valid);
+ _tiedProperties.Tie("internal/inrange", this,
+ &FGKR_87::get_inrange);
+ _tiedProperties.Tie("internal/dist", this,
+ &FGKR_87::get_dist);
+ _tiedProperties.Tie("internal/heading", this,
+ &FGKR_87::get_heading);
// modes
- fgTie("/instrumentation/kr-87/modes/ant", this,
- &FGKR_87::get_ant_mode);
- fgTie("/instrumentation/kr-87/modes/stby", this,
- &FGKR_87::get_stby_mode);
- fgTie("/instrumentation/kr-87/modes/timer", this,
- &FGKR_87::get_timer_mode);
- fgTie("/instrumentation/kr-87/modes/count", this,
- &FGKR_87::get_count_mode);
+ _tiedProperties.Tie("modes/ant", this,
+ &FGKR_87::get_ant_mode);
+ _tiedProperties.Tie("modes/stby", this,
+ &FGKR_87::get_stby_mode);
+ _tiedProperties.Tie("modes/timer", this,
+ &FGKR_87::get_timer_mode);
+ _tiedProperties.Tie("modes/count", this,
+ &FGKR_87::get_count_mode);
// input and buttons
- fgTie("/instrumentation/kr-87/inputs/rotation-deg", this,
- &FGKR_87::get_rotation, &FGKR_87::set_rotation);
+ _tiedProperties.Tie("inputs/rotation-deg", this,
+ &FGKR_87::get_rotation, &FGKR_87::set_rotation);
fgSetArchivable("/instrumentation/kr-87/inputs/rotation-deg");
- fgTie("/instrumentation/kr-87/inputs/power-btn", this,
- &FGKR_87::get_power_btn,
- &FGKR_87::set_power_btn);
+ _tiedProperties.Tie("inputs/power-btn", this,
+ &FGKR_87::get_power_btn,
+ &FGKR_87::set_power_btn);
fgSetArchivable("/instrumentation/kr-87/inputs/power-btn");
- fgTie("/instrumentation/kr-87/inputs/audio-btn", this,
- &FGKR_87::get_audio_btn,
- &FGKR_87::set_audio_btn);
+ _tiedProperties.Tie("inputs/audio-btn", this,
+ &FGKR_87::get_audio_btn,
+ &FGKR_87::set_audio_btn);
fgSetArchivable("/instrumentation/kr-87/inputs/audio-btn");
- fgTie("/instrumentation/kr-87/inputs/volume", this,
- &FGKR_87::get_vol_btn,
- &FGKR_87::set_vol_btn);
+ _tiedProperties.Tie("inputs/volume", this,
+ &FGKR_87::get_vol_btn,
+ &FGKR_87::set_vol_btn);
fgSetArchivable("/instrumentation/kr-87/inputs/volume");
- fgTie("/instrumentation/kr-87/inputs/adf-btn", this,
- &FGKR_87::get_adf_btn,
- &FGKR_87::set_adf_btn);
- fgTie("/instrumentation/kr-87/inputs/bfo-btn", this,
- &FGKR_87::get_bfo_btn,
- &FGKR_87::set_bfo_btn);
- fgTie("/instrumentation/kr-87/inputs/frq-btn", this,
- &FGKR_87::get_frq_btn,
- &FGKR_87::set_frq_btn);
- fgTie("/instrumentation/kr-87/inputs/flt-et-btn", this,
- &FGKR_87::get_flt_et_btn,
- &FGKR_87::set_flt_et_btn);
- fgTie("/instrumentation/kr-87/inputs/set-rst-btn", this,
- &FGKR_87::get_set_rst_btn,
- &FGKR_87::set_set_rst_btn);
+ _tiedProperties.Tie("inputs/adf-btn", this,
+ &FGKR_87::get_adf_btn,
+ &FGKR_87::set_adf_btn);
+ _tiedProperties.Tie("inputs/bfo-btn", this,
+ &FGKR_87::get_bfo_btn,
+ &FGKR_87::set_bfo_btn);
+ _tiedProperties.Tie("inputs/frq-btn", this,
+ &FGKR_87::get_frq_btn,
+ &FGKR_87::set_frq_btn);
+ _tiedProperties.Tie("inputs/flt-et-btn", this,
+ &FGKR_87::get_flt_et_btn,
+ &FGKR_87::set_flt_et_btn);
+ _tiedProperties.Tie("inputs/set-rst-btn", this,
+ &FGKR_87::get_set_rst_btn,
+ &FGKR_87::set_set_rst_btn);
// outputs
- fgTie("/instrumentation/kr-87/outputs/selected-khz", this,
- &FGKR_87::get_freq, &FGKR_87::set_freq);
+ _tiedProperties.Tie("outputs/selected-khz", this,
+ &FGKR_87::get_freq, &FGKR_87::set_freq);
fgSetArchivable("/instrumentation/kr-87/outputs/selected-khz");
- fgTie("/instrumentation/kr-87/outputs/standby-khz", this,
- &FGKR_87::get_stby_freq, &FGKR_87::set_stby_freq);
+ _tiedProperties.Tie("outputs/standby-khz", this,
+ &FGKR_87::get_stby_freq, &FGKR_87::set_stby_freq);
fgSetArchivable("/instrumentation/kr-87/outputs/standby-khz");
- fgTie("/instrumentation/kr-87/outputs/needle-deg", this,
- &FGKR_87::get_needle_deg);
- fgTie("/instrumentation/kr-87/outputs/flight-timer", this,
- &FGKR_87::get_flight_timer);
- fgTie("/instrumentation/kr-87/outputs/elapsed-timer", this,
- &FGKR_87::get_elapsed_timer,
- &FGKR_87::set_elapsed_timer);
+ _tiedProperties.Tie("outputs/needle-deg", this,
+ &FGKR_87::get_needle_deg);
+ _tiedProperties.Tie("outputs/flight-timer", this,
+ &FGKR_87::get_flight_timer);
+ _tiedProperties.Tie("outputs/elapsed-timer", this,
+ &FGKR_87::get_elapsed_timer,
+ &FGKR_87::set_elapsed_timer);
// annunciators
- fgTie("/instrumentation/kr-87/annunciators/ant", this,
- &FGKR_87::get_ant_ann );
- fgTie("/instrumentation/kr-87/annunciators/adf", this,
- &FGKR_87::get_adf_ann );
- fgTie("/instrumentation/kr-87/annunciators/bfo", this,
- &FGKR_87::get_bfo_ann );
- fgTie("/instrumentation/kr-87/annunciators/frq", this,
- &FGKR_87::get_frq_ann );
- fgTie("/instrumentation/kr-87/annunciators/flt", this,
- &FGKR_87::get_flt_ann );
- fgTie("/instrumentation/kr-87/annunciators/et", this,
- &FGKR_87::get_et_ann );
+ _tiedProperties.Tie("annunciators/ant", this,
+ &FGKR_87::get_ant_ann );
+ _tiedProperties.Tie("annunciators/adf", this,
+ &FGKR_87::get_adf_ann );
+ _tiedProperties.Tie("annunciators/bfo", this,
+ &FGKR_87::get_bfo_ann );
+ _tiedProperties.Tie("annunciators/frq", this,
+ &FGKR_87::get_frq_ann );
+ _tiedProperties.Tie("annunciators/flt", this,
+ &FGKR_87::get_flt_ann );
+ _tiedProperties.Tie("annunciators/et", this,
+ &FGKR_87::get_et_ann );
}
void FGKR_87::unbind () {
- // internal values
- fgUntie("/instrumentation/kr-87/internal/valid");
- fgUntie("/instrumentation/kr-87/internal/inrange");
- fgUntie("/instrumentation/kr-87/internal/dist");
- fgUntie("/instrumentation/kr-87/internal/heading");
-
- // modes
- fgUntie("/instrumentation/kr-87/modes/ant");
- fgUntie("/instrumentation/kr-87/modes/stby");
- fgUntie("/instrumentation/kr-87/modes/timer");
- fgUntie("/instrumentation/kr-87/modes/count");
-
- // input and buttons
- fgUntie("/instrumentation/kr-87/inputs/rotation-deg");
- fgUntie("/instrumentation/kr-87/inputs/power-btn");
- fgUntie("/instrumentation/kr-87/inputs/volume");
- fgUntie("/instrumentation/kr-87/inputs/adf-btn");
- fgUntie("/instrumentation/kr-87/inputs/bfo-btn");
- fgUntie("/instrumentation/kr-87/inputs/frq-btn");
- fgUntie("/instrumentation/kr-87/inputs/flt-et-btn");
- fgUntie("/instrumentation/kr-87/inputs/set-rst-btn");
- fgUntie("/instrumentation/kr-87/inputs/ident-btn");
-
- // outputs
- fgUntie("/instrumentation/kr-87/outputs/selected-khz");
- fgUntie("/instrumentation/kr-87/outputs/standby-khz");
- fgUntie("/instrumentation/kr-87/outputs/needle-deg");
- fgUntie("/instrumentation/kr-87/outputs/flight-timer");
- fgUntie("/instrumentation/kr-87/outputs/elapsed-timer");
-
- // annunciators
- fgUntie("/instrumentation/kr-87/annunciators/ant");
- fgUntie("/instrumentation/kr-87/annunciators/adf");
- fgUntie("/instrumentation/kr-87/annunciators/bfo");
- fgUntie("/instrumentation/kr-87/annunciators/frq");
- fgUntie("/instrumentation/kr-87/annunciators/flt");
- fgUntie("/instrumentation/kr-87/annunciators/et");
+ _tiedProperties.Untie();
}
#include <simgear/compiler.h>
#include <simgear/structure/subsystem_mgr.hxx>
+#include <simgear/props/tiedpropertylist.hxx>
#include <simgear/timing/timestamp.hxx>
#include <Navaids/navlist.hxx>
class FGKR_87 : public SGSubsystem
{
+private:
SGPropertyNode_ptr bus_power;
SGPropertyNode_ptr serviceable;
double _time_before_search_sec;
SGSharedPtr<SGSampleGroup> _sgr;
+ simgear::TiedPropertyList _tiedProperties;
public:
-
FGKR_87( SGPropertyNode *node );
~FGKR_87();
alt_node = fgGetNode("/position/altitude-ft", true);
bus_power = fgGetNode("/systems/electrical/outputs/transponder", true);
serviceable_node = (node->getChild("inputs", 0, true))
- ->getChild("serviceable", 0, true);
+ ->getChild("serviceable", 0, true);
serviceable_node->setBoolValue(true);
}
-void FGKT_70::bind () {
+void FGKT_70::bind ()
+{
std::ostringstream temp;
string branch;
temp << num;
branch = "/instrumentation/" + name + "[" + temp.str() + "]";
+ _tiedProperties.setRoot(fgGetNode(branch, true));
+
// internal values
// modes
-
// input and buttons
- fgTie((branch + "/inputs/ident-btn").c_str(), this,
- &FGKT_70::get_ident_btn, &FGKT_70::set_ident_btn);
+ _tiedProperties.Tie("inputs/ident-btn", this,
+ &FGKT_70::get_ident_btn, &FGKT_70::set_ident_btn);
fgSetArchivable((branch + "/inputs/rotation-deg").c_str());
- fgTie((branch + "/inputs/digit1").c_str(), this,
- &FGKT_70::get_digit1, &FGKT_70::set_digit1);
+ _tiedProperties.Tie("inputs/digit1", this,
+ &FGKT_70::get_digit1, &FGKT_70::set_digit1);
fgSetArchivable((branch + "/inputs/digit1").c_str());
- fgTie((branch + "/inputs/digit2").c_str(), this,
- &FGKT_70::get_digit2, &FGKT_70::set_digit2);
+ _tiedProperties.Tie("inputs/digit2", this,
+ &FGKT_70::get_digit2, &FGKT_70::set_digit2);
fgSetArchivable((branch + "/inputs/digit2").c_str());
- fgTie((branch + "/inputs/digit3").c_str(), this,
- &FGKT_70::get_digit3, &FGKT_70::set_digit3);
+ _tiedProperties.Tie("inputs/digit3", this,
+ &FGKT_70::get_digit3, &FGKT_70::set_digit3);
fgSetArchivable((branch + "/inputs/digit3").c_str());
- fgTie((branch + "/inputs/digit4").c_str(), this,
- &FGKT_70::get_digit4, &FGKT_70::set_digit4);
+ _tiedProperties.Tie("inputs/digit4", this,
+ &FGKT_70::get_digit4, &FGKT_70::set_digit4);
fgSetArchivable((branch + "/inputs/digit4").c_str());
- fgTie((branch + "/inputs/func-knob").c_str(), this,
- &FGKT_70::get_func_knob, &FGKT_70::set_func_knob);
+ _tiedProperties.Tie("inputs/func-knob", this,
+ &FGKT_70::get_func_knob, &FGKT_70::set_func_knob);
fgSetArchivable((branch + "/inputs/func-knob").c_str());
// outputs
- fgTie((branch + "/outputs/id-code").c_str(), this,
- &FGKT_70::get_id_code, &FGKT_70::set_id_code);
+ _tiedProperties.Tie("outputs/id-code", this,
+ &FGKT_70::get_id_code, &FGKT_70::set_id_code);
fgSetArchivable((branch + "/outputs/id-code").c_str());
- fgTie((branch + "/outputs/flight-level").c_str(), this,
- &FGKT_70::get_flight_level);
+ _tiedProperties.Tie("outputs/flight-level", this,
+ &FGKT_70::get_flight_level);
// annunciators
- fgTie((branch + "/annunciators/fl").c_str(), this,
- &FGKT_70::get_fl_ann );
- fgTie((branch + "/annunciators/alt").c_str(), this,
- &FGKT_70::get_alt_ann );
- fgTie((branch + "/annunciators/gnd").c_str(), this,
- &FGKT_70::get_gnd_ann );
- fgTie((branch + "/annunciators/on").c_str(), this,
- &FGKT_70::get_on_ann );
- fgTie((branch + "/annunciators/sby").c_str(), this,
- &FGKT_70::get_sby_ann );
- fgTie((branch + "/annunciators/reply").c_str(), this,
- &FGKT_70::get_reply_ann );
+ _tiedProperties.Tie("annunciators/fl", this,
+ &FGKT_70::get_fl_ann );
+ _tiedProperties.Tie("annunciators/alt", this,
+ &FGKT_70::get_alt_ann );
+ _tiedProperties.Tie("annunciators/gnd", this,
+ &FGKT_70::get_gnd_ann );
+ _tiedProperties.Tie("annunciators/on", this,
+ &FGKT_70::get_on_ann );
+ _tiedProperties.Tie("annunciators/sby", this,
+ &FGKT_70::get_sby_ann );
+ _tiedProperties.Tie("annunciators/reply", this,
+ &FGKT_70::get_reply_ann );
}
void FGKT_70::unbind () {
- std::ostringstream temp;
- string branch;
- temp << num;
- branch = "/instrumentation/" + name + "[" + temp.str() + "]";
- // internal values
-
- // modes
-
- // input and buttons
- fgUntie((branch + "/inputs/ident-btn").c_str());
- fgUntie((branch + "/inputs/digit1").c_str());
- fgUntie((branch + "/inputs/digit2").c_str());
- fgUntie((branch + "/inputs/digit3").c_str());
- fgUntie((branch + "/inputs/digit4").c_str());
- fgUntie((branch + "/inputs/func-knob").c_str());
-
- // outputs
- fgUntie((branch + "/outputs/id-code").c_str());
- fgUntie((branch + "/outputs/flight-level").c_str());
-
- // annunciators
- fgUntie((branch + "/annunciators/fl").c_str());
- fgUntie((branch + "/annunciators/alt").c_str());
- fgUntie((branch + "/annunciators/gnd").c_str());
- fgUntie((branch + "/annunciators/on").c_str());
- fgUntie((branch + "/annunciators/sby").c_str());
- fgUntie((branch + "/annunciators/reply").c_str());
+ _tiedProperties.Untie();
}
#include <simgear/compiler.h>
#include <simgear/structure/subsystem_mgr.hxx>
+#include <simgear/props/tiedpropertylist.hxx>
#include <simgear/math/interpolater.hxx>
#include <simgear/timing/timestamp.hxx>
class FGKT_70 : public SGSubsystem
{
+private:
SGPropertyNode_ptr lon_node;
SGPropertyNode_ptr lat_node;
SGPropertyNode_ptr alt_node;
string name;
int num;
+ simgear::TiedPropertyList _tiedProperties;
public:
void
FGProperties::bind ()
{
- // Simulation
- fgTie("/sim/logging/priority", getLoggingPriority, setLoggingPriority);
- fgTie("/sim/logging/classes", getLoggingClasses, setLoggingClasses);
- fgTie("/sim/freeze/master", getFreeze, setFreeze);
+ _tiedProperties.setRoot(globals->get_props());
- fgTie("/sim/time/elapsed-sec", getElapsedTime_sec);
- fgTie("/sim/time/gmt", getDateString, setDateString);
+ // Simulation
+ _tiedProperties.Tie("/sim/logging/priority", getLoggingPriority, setLoggingPriority);
+ _tiedProperties.Tie("/sim/logging/classes", getLoggingClasses, setLoggingClasses);
+ _tiedProperties.Tie("/sim/freeze/master", getFreeze, setFreeze);
+
+ _tiedProperties.Tie("/sim/time/elapsed-sec", getElapsedTime_sec);
+ _tiedProperties.Tie("/sim/time/gmt", getDateString, setDateString);
fgSetArchivable("/sim/time/gmt");
- fgTie("/sim/time/gmt-string", getGMTString);
+ _tiedProperties.Tie("/sim/time/gmt-string", getGMTString);
- // Position
- fgTie("/position/latitude-string", getLatitudeString);
- fgTie("/position/longitude-string", getLongitudeString);
+ // Position
+ _tiedProperties.Tie("/position/latitude-string", getLatitudeString);
+ _tiedProperties.Tie("/position/longitude-string", getLongitudeString);
- // Orientation
- fgTie("/orientation/heading-magnetic-deg", getHeadingMag);
- fgTie("/orientation/track-magnetic-deg", getTrackMag);
+ // Orientation
+ _tiedProperties.Tie("/orientation/heading-magnetic-deg", getHeadingMag);
+ _tiedProperties.Tie("/orientation/track-magnetic-deg", getTrackMag);
- fgTie("/environment/magnetic-variation-deg", getMagVar);
- fgTie("/environment/magnetic-dip-deg", getMagDip);
+ _tiedProperties.Tie("/environment/magnetic-variation-deg", getMagVar);
+ _tiedProperties.Tie("/environment/magnetic-dip-deg", getMagDip);
- // Misc. Temporary junk.
- fgTie("/sim/temp/winding-ccw", getWindingCCW, setWindingCCW, false);
+ // Misc. Temporary junk.
+ _tiedProperties.Tie("/sim/temp/winding-ccw", getWindingCCW, setWindingCCW, false);
}
void
FGProperties::unbind ()
{
- // Simulation
- fgUntie("/sim/logging/priority");
- fgUntie("/sim/logging/classes");
- fgUntie("/sim/freeze/master");
-
- fgUntie("/sim/time/elapsed-sec");
- fgUntie("/sim/time/gmt");
- fgUntie("/sim/time/gmt-string");
- // Position
- fgUntie("/position/latitude-string");
- fgUntie("/position/longitude-string");
-
- // Orientation
- fgUntie("/orientation/heading-magnetic-deg");
- fgUntie("/orientation/track-magnetic-deg");
-
- // Environment
- fgUntie("/environment/magnetic-variation-deg");
- fgUntie("/environment/magnetic-dip-deg");
-
- // Misc. Temporary junk.
- fgUntie("/sim/temp/winding-ccw");
-// fgUntie("/sim/temp/full-screen");
-// fgUntie("/sim/temp/fdm-data-logging");
+ _tiedProperties.Untie();
}
void
static SGPropertyNode_ptr offset = fgGetNode("/sim/time/local-offset", true);
offset->setIntValue(globals->get_time_params()->get_local_offset());
-
// utc date/time
static SGPropertyNode_ptr uyear = fgGetNode("/sim/time/utc/year", true);
static SGPropertyNode_ptr umonth = fgGetNode("/sim/time/utc/month", true);
#include <iosfwd>
#include <simgear/structure/subsystem_mgr.hxx>
+#include <simgear/props/tiedpropertylist.hxx>
#include <simgear/math/SGMath.hxx>
#include <Main/globals.hxx>
void bind ();
void unbind ();
void update (double dt);
+
+private:
+ simgear::TiedPropertyList _tiedProperties;
};
FGViewMgr::do_bind()
{
// these are bound to the current view properties
- fgTie("/sim/current-view/heading-offset-deg", this,
- &FGViewMgr::getViewHeadingOffset_deg,
- &FGViewMgr::setViewHeadingOffset_deg);
+ _tiedProperties.setRoot(fgGetNode("/sim/current-view", true));
+ _tiedProperties.Tie("heading-offset-deg", this,
+ &FGViewMgr::getViewHeadingOffset_deg,
+ &FGViewMgr::setViewHeadingOffset_deg);
fgSetArchivable("/sim/current-view/heading-offset-deg");
- fgTie("/sim/current-view/goal-heading-offset-deg", this,
- &FGViewMgr::getViewGoalHeadingOffset_deg,
- &FGViewMgr::setViewGoalHeadingOffset_deg);
+ _tiedProperties.Tie("goal-heading-offset-deg", this,
+ &FGViewMgr::getViewGoalHeadingOffset_deg,
+ &FGViewMgr::setViewGoalHeadingOffset_deg);
fgSetArchivable("/sim/current-view/goal-heading-offset-deg");
- fgTie("/sim/current-view/pitch-offset-deg", this,
- &FGViewMgr::getViewPitchOffset_deg,
- &FGViewMgr::setViewPitchOffset_deg);
+ _tiedProperties.Tie("pitch-offset-deg", this,
+ &FGViewMgr::getViewPitchOffset_deg,
+ &FGViewMgr::setViewPitchOffset_deg);
fgSetArchivable("/sim/current-view/pitch-offset-deg");
- fgTie("/sim/current-view/goal-pitch-offset-deg", this,
- &FGViewMgr::getGoalViewPitchOffset_deg,
- &FGViewMgr::setGoalViewPitchOffset_deg);
+ _tiedProperties.Tie("goal-pitch-offset-deg", this,
+ &FGViewMgr::getGoalViewPitchOffset_deg,
+ &FGViewMgr::setGoalViewPitchOffset_deg);
fgSetArchivable("/sim/current-view/goal-pitch-offset-deg");
- fgTie("/sim/current-view/roll-offset-deg", this,
- &FGViewMgr::getViewRollOffset_deg,
- &FGViewMgr::setViewRollOffset_deg);
+ _tiedProperties.Tie("roll-offset-deg", this,
+ &FGViewMgr::getViewRollOffset_deg,
+ &FGViewMgr::setViewRollOffset_deg);
fgSetArchivable("/sim/current-view/roll-offset-deg");
- fgTie("/sim/current-view/goal-roll-offset-deg", this,
- &FGViewMgr::getGoalViewRollOffset_deg,
- &FGViewMgr::setGoalViewRollOffset_deg);
+ _tiedProperties.Tie("goal-roll-offset-deg", this,
+ &FGViewMgr::getGoalViewRollOffset_deg,
+ &FGViewMgr::setGoalViewRollOffset_deg);
fgSetArchivable("/sim/current-view/goal-roll-offset-deg");
- fgTie("/sim/current-view/view-number", this,
+ _tiedProperties.Tie("view-number", this,
&FGViewMgr::getView, &FGViewMgr::setView);
fgSetArchivable("/sim/current-view/view-number", false);
- fgTie("/sim/current-view/axes/long", this,
- (double_getter)0, &FGViewMgr::setViewAxisLong);
+ _tiedProperties.Tie("axes/long", this,
+ (double_getter)0, &FGViewMgr::setViewAxisLong);
fgSetArchivable("/sim/current-view/axes/long");
- fgTie("/sim/current-view/axes/lat", this,
- (double_getter)0, &FGViewMgr::setViewAxisLat);
+ _tiedProperties.Tie("axes/lat", this,
+ (double_getter)0, &FGViewMgr::setViewAxisLat);
fgSetArchivable("/sim/current-view/axes/lat");
- fgTie("/sim/current-view/field-of-view", this,
- &FGViewMgr::getFOV_deg, &FGViewMgr::setFOV_deg);
+ _tiedProperties.Tie("field-of-view", this,
+ &FGViewMgr::getFOV_deg, &FGViewMgr::setFOV_deg);
fgSetArchivable("/sim/current-view/field-of-view");
- fgTie("/sim/current-view/aspect-ratio-multiplier", this,
- &FGViewMgr::getARM_deg, &FGViewMgr::setARM_deg);
+ _tiedProperties.Tie("aspect-ratio-multiplier", this,
+ &FGViewMgr::getARM_deg, &FGViewMgr::setARM_deg);
fgSetArchivable("/sim/current-view/field-of-view");
- fgTie("/sim/current-view/ground-level-nearplane-m", this,
- &FGViewMgr::getNear_m, &FGViewMgr::setNear_m);
+ _tiedProperties.Tie("ground-level-nearplane-m", this,
+ &FGViewMgr::getNear_m, &FGViewMgr::setNear_m);
fgSetArchivable("/sim/current-view/ground-level-nearplane-m");
SGPropertyNode *n = fgGetNode("/sim/current-view", true);
- n->tie("viewer-x-m", SGRawValuePointer<double>(&abs_viewer_position[0]));
- n->tie("viewer-y-m", SGRawValuePointer<double>(&abs_viewer_position[1]));
- n->tie("viewer-z-m", SGRawValuePointer<double>(&abs_viewer_position[2]));
-
-// for automatic untying:
-#define x(str) ((void)tied_props.push_back(str), str)
-
- fgTie(x("/sim/current-view/debug/orientation-w"), this,
- &FGViewMgr::getCurrentViewOrientation_w);
- fgTie(x("/sim/current-view/debug/orientation-x"), this,
- &FGViewMgr::getCurrentViewOrientation_x);
- fgTie(x("/sim/current-view/debug/orientation-y"), this,
- &FGViewMgr::getCurrentViewOrientation_y);
- fgTie(x("/sim/current-view/debug/orientation-z"), this,
- &FGViewMgr::getCurrentViewOrientation_z);
-
- fgTie(x("/sim/current-view/debug/orientation_offset-w"), this,
- &FGViewMgr::getCurrentViewOrOffset_w);
- fgTie(x("/sim/current-view/debug/orientation_offset-x"), this,
- &FGViewMgr::getCurrentViewOrOffset_x);
- fgTie(x("/sim/current-view/debug/orientation_offset-y"), this,
- &FGViewMgr::getCurrentViewOrOffset_y);
- fgTie(x("/sim/current-view/debug/orientation_offset-z"), this,
- &FGViewMgr::getCurrentViewOrOffset_z);
-
- fgTie(x("/sim/current-view/debug/frame-w"), this,
- &FGViewMgr::getCurrentViewFrame_w);
- fgTie(x("/sim/current-view/debug/frame-x"), this,
- &FGViewMgr::getCurrentViewFrame_x);
- fgTie(x("/sim/current-view/debug/frame-y"), this,
- &FGViewMgr::getCurrentViewFrame_y);
- fgTie(x("/sim/current-view/debug/frame-z"), this,
- &FGViewMgr::getCurrentViewFrame_z);
-
-#undef x
+ _tiedProperties.Tie(n->getNode("viewer-x-m", true),SGRawValuePointer<double>(&abs_viewer_position[0]));
+ _tiedProperties.Tie(n->getNode("viewer-y-m", true),SGRawValuePointer<double>(&abs_viewer_position[1]));
+ _tiedProperties.Tie(n->getNode("viewer-z-m", true),SGRawValuePointer<double>(&abs_viewer_position[2]));
+
+ _tiedProperties.Tie("debug/orientation-w", this,
+ &FGViewMgr::getCurrentViewOrientation_w);
+ _tiedProperties.Tie("debug/orientation-x", this,
+ &FGViewMgr::getCurrentViewOrientation_x);
+ _tiedProperties.Tie("debug/orientation-y", this,
+ &FGViewMgr::getCurrentViewOrientation_y);
+ _tiedProperties.Tie("debug/orientation-z", this,
+ &FGViewMgr::getCurrentViewOrientation_z);
+
+ _tiedProperties.Tie("debug/orientation_offset-w", this,
+ &FGViewMgr::getCurrentViewOrOffset_w);
+ _tiedProperties.Tie("debug/orientation_offset-x", this,
+ &FGViewMgr::getCurrentViewOrOffset_x);
+ _tiedProperties.Tie("debug/orientation_offset-y", this,
+ &FGViewMgr::getCurrentViewOrOffset_y);
+ _tiedProperties.Tie("debug/orientation_offset-z", this,
+ &FGViewMgr::getCurrentViewOrOffset_z);
+
+ _tiedProperties.Tie("debug/frame-w", this,
+ &FGViewMgr::getCurrentViewFrame_w);
+ _tiedProperties.Tie("debug/frame-x", this,
+ &FGViewMgr::getCurrentViewFrame_x);
+ _tiedProperties.Tie("debug/frame-y", this,
+ &FGViewMgr::getCurrentViewFrame_y);
+ _tiedProperties.Tie("debug/frame-z", this,
+ &FGViewMgr::getCurrentViewFrame_z);
}
void
FGViewMgr::unbind ()
{
- // FIXME:
- // need to redo these bindings to the new locations (move to viewer?)
- fgUntie("/sim/current-view/heading-offset-deg");
- fgUntie("/sim/current-view/goal-heading-offset-deg");
- fgUntie("/sim/current-view/pitch-offset-deg");
- fgUntie("/sim/current-view/goal-pitch-offset-deg");
- fgUntie("/sim/current-view/field-of-view");
- fgUntie("/sim/current-view/aspect-ratio-multiplier");
- fgUntie("/sim/current-view/view-number");
- fgUntie("/sim/current-view/axes/long");
- fgUntie("/sim/current-view/axes/lat");
- fgUntie("/sim/current-view/ground-level-nearplane-m");
- fgUntie("/sim/current-view/viewer-x-m");
- fgUntie("/sim/current-view/viewer-y-m");
- fgUntie("/sim/current-view/viewer-z-m");
-
- std::list<const char*>::const_iterator it;
- for (it = tied_props.begin(); it != tied_props.end(); it++){
- fgUntie(*it);
- }
-
+ _tiedProperties.Untie();
}
void
FGViewMgr::update (double dt)
{
-
FGViewer *loop_view = (FGViewer *)get_current_view();
if (loop_view == 0) return;
#define _VIEWMGR_HXX
#include <vector>
-#include <list>
#include <simgear/compiler.h>
#include <simgear/structure/subsystem_mgr.hxx>
#include <simgear/props/props.hxx>
+#include <simgear/props/tiedpropertylist.hxx>
#include <simgear/math/SGMath.hxx>
// forward decls
private:
void do_bind();
-
- std::list<const char*> tied_props;
+
+ simgear::TiedPropertyList _tiedProperties;
double axis_long;
double axis_lat;