diff --git a/src/FDM/JSBSim/initialization/FGInitialCondition.cpp b/src/FDM/JSBSim/initialization/FGInitialCondition.cpp index 9149caa16..b9ad81e12 100644 --- a/src/FDM/JSBSim/initialization/FGInitialCondition.cpp +++ b/src/FDM/JSBSim/initialization/FGInitialCondition.cpp @@ -66,7 +66,7 @@ using namespace std; namespace JSBSim { -IDENT(IdSrc,"$Id: FGInitialCondition.cpp,v 1.95 2014/05/01 18:32:54 bcoconni Exp $"); +IDENT(IdSrc,"$Id: FGInitialCondition.cpp,v 1.97 2014/11/15 11:57:37 bcoconni Exp $"); IDENT(IdHdr,ID_INITIALCONDITION); //****************************************************************************** @@ -918,8 +918,15 @@ bool FGInitialCondition::Load_v1(Element* document) { bool result = true; - if (document->FindElement("latitude")) - SetLatitudeRadIC(document->FindElementValueAsNumberConvertTo("latitude", "RAD")); + if (document->FindElement("latitude")) { + double latitude = document->FindElementValueAsNumberConvertTo("latitude", "RAD"); + string lat_type = document->FindElement("latitude")->GetAttributeValue("type"); + if (lat_type == "geod" || lat_type == "geodetic") + position.SetPositionGeodetic(0.0, latitude, 0.0); // Longitude and altitude will be set later on + else + position.SetLatitude(latitude); + } + if (document->FindElement("longitude")) SetLongitudeRadIC(document->FindElementValueAsNumberConvertTo("longitude", "RAD")); if (document->FindElement("elevation")) @@ -1032,6 +1039,15 @@ bool FGInitialCondition::Load_v2(Element* document) position = position.GetTi2ec() * position_el->FindElementTripletConvertTo("FT"); } else if (frame == "ecef") { if (!position_el->FindElement("x") && !position_el->FindElement("y") && !position_el->FindElement("z")) { + Element* latitude_el = position_el->FindElement("latitude"); + if (latitude_el) { + string lat_type = latitude_el->GetAttributeValue("type"); + double latitude = position_el->FindElementValueAsNumberConvertTo("latitude", "RAD"); + if (lat_type == "geod" || lat_type == "geodetic") + position.SetPositionGeodetic(0.0, latitude, 0.0); // Longitude and altitude will be set later on + else + position.SetLatitude(latitude); + } if (position_el->FindElement("longitude")) position.SetLongitude(position_el->FindElementValueAsNumberConvertTo("longitude", "RAD")); @@ -1048,19 +1064,6 @@ bool FGInitialCondition::Load_v2(Element* document) result = false; } - Element* latitude_el = position_el->FindElement("latitude"); - if (latitude_el) { - string lat_type = latitude_el->GetAttributeValue("type"); - double latitude = position_el->FindElementValueAsNumberConvertTo("latitude", "RAD"); - if (lat_type == "geod" || lat_type == "geodetic") { - double longitude = position.GetLongitude(); - double altitude = position.GetAltitudeASL(); // SetPositionGeodetic() assumes altitude - position.SetPositionGeodetic(longitude, latitude, altitude); // is geodetic, but it's close enough for now. - position.SetAltitudeAGL(altitude, 0.0); - } else { - position.SetLatitude(latitude); - } - } } else { position = position_el->FindElementTripletConvertTo("FT"); } diff --git a/src/FDM/JSBSim/input_output/FGPropertyManager.h b/src/FDM/JSBSim/input_output/FGPropertyManager.h index e3595941b..774904ce2 100644 --- a/src/FDM/JSBSim/input_output/FGPropertyManager.h +++ b/src/FDM/JSBSim/input_output/FGPropertyManager.h @@ -53,7 +53,7 @@ INCLUDES DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -#define ID_PROPERTYMANAGER "$Id: FGPropertyManager.h,v 1.28 2013/09/28 14:43:15 bcoconni Exp $" +#define ID_PROPERTYMANAGER "$Id: FGPropertyManager.h,v 1.29 2014/11/15 11:32:54 bcoconni Exp $" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FORWARD DECLARATIONS @@ -233,7 +233,7 @@ class FGPropertyNode : public SGPropertyNode * Assign a bool value to a property. If the property does not * yet exist, it will be created and its type will be set to * BOOL; if it has a type of UNKNOWN, the type will also be set to - * BOOL; otherwise, the bool value will be converted to the property's + * BOOL; otherwise, the value type will be converted to the property's * type. * * @param name The property name. @@ -249,7 +249,7 @@ class FGPropertyNode : public SGPropertyNode * Assign an int value to a property. If the property does not * yet exist, it will be created and its type will be set to * INT; if it has a type of UNKNOWN, the type will also be set to - * INT; otherwise, the bool value will be converted to the property's + * INT; otherwise, the value type will be converted to the property's * type. * * @param name The property name. @@ -265,7 +265,7 @@ class FGPropertyNode : public SGPropertyNode * Assign a long value to a property. If the property does not * yet exist, it will be created and its type will be set to * LONG; if it has a type of UNKNOWN, the type will also be set to - * LONG; otherwise, the bool value will be converted to the property's + * LONG; otherwise, the value type will be converted to the property's * type. * * @param name The property name. @@ -281,7 +281,7 @@ class FGPropertyNode : public SGPropertyNode * Assign a float value to a property. If the property does not * yet exist, it will be created and its type will be set to * FLOAT; if it has a type of UNKNOWN, the type will also be set to - * FLOAT; otherwise, the bool value will be converted to the property's + * FLOAT; otherwise, the value type will be converted to the property's * type. * * @param name The property name. diff --git a/src/FDM/JSBSim/math/FGRealValue.cpp b/src/FDM/JSBSim/math/FGRealValue.cpp index 54d185799..47693f887 100644 --- a/src/FDM/JSBSim/math/FGRealValue.cpp +++ b/src/FDM/JSBSim/math/FGRealValue.cpp @@ -30,9 +30,13 @@ INCLUDES #include "FGRealValue.h" +#include "input_output/string_utilities.h" + +using namespace std; + namespace JSBSim { -IDENT(IdSrc,"$Id: FGRealValue.cpp,v 1.6 2014/01/13 10:46:03 ehofman Exp $"); +IDENT(IdSrc,"$Id: FGRealValue.cpp,v 1.7 2014/11/18 18:38:27 bcoconni Exp $"); IDENT(IdHdr,ID_REALVALUE); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -50,4 +54,9 @@ double FGRealValue::GetValue(void) const return Value; } +std::string FGRealValue::GetName(void) const +{ + return std::string("constant value ") + to_string(Value); +} + } diff --git a/src/FDM/JSBSim/math/FGRealValue.h b/src/FDM/JSBSim/math/FGRealValue.h index 9e7eef8b3..6f7483318 100644 --- a/src/FDM/JSBSim/math/FGRealValue.h +++ b/src/FDM/JSBSim/math/FGRealValue.h @@ -35,13 +35,12 @@ INCLUDES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ #include "FGParameter.h" -#include "input_output/string_utilities.h" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -#define ID_REALVALUE "$Id: FGRealValue.h,v 1.6 2014/08/28 13:44:27 bcoconni Exp $" +#define ID_REALVALUE "$Id: FGRealValue.h,v 1.7 2014/11/18 18:38:25 bcoconni Exp $" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FORWARD DECLARATIONS @@ -69,8 +68,7 @@ public: ~FGRealValue() {}; double GetValue(void) const; - std::string GetName(void) const - { return std::string("constant value ") + to_string(Value); } + std::string GetName(void) const; private: double Value;