1
0
Fork 0

Re-sync JSBSim with FlightGear including James Turner's fix for the call to the function to_string that failed to compile on Mac and MSVC.

This commit is contained in:
bcoconni 2014-11-18 19:54:52 +01:00
parent c3eda927a9
commit 5f0bffde58
4 changed files with 36 additions and 26 deletions

View file

@ -66,7 +66,7 @@ using namespace std;
namespace JSBSim { 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); IDENT(IdHdr,ID_INITIALCONDITION);
//****************************************************************************** //******************************************************************************
@ -918,8 +918,15 @@ bool FGInitialCondition::Load_v1(Element* document)
{ {
bool result = true; bool result = true;
if (document->FindElement("latitude")) if (document->FindElement("latitude")) {
SetLatitudeRadIC(document->FindElementValueAsNumberConvertTo("latitude", "RAD")); 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")) if (document->FindElement("longitude"))
SetLongitudeRadIC(document->FindElementValueAsNumberConvertTo("longitude", "RAD")); SetLongitudeRadIC(document->FindElementValueAsNumberConvertTo("longitude", "RAD"));
if (document->FindElement("elevation")) if (document->FindElement("elevation"))
@ -1032,6 +1039,15 @@ bool FGInitialCondition::Load_v2(Element* document)
position = position.GetTi2ec() * position_el->FindElementTripletConvertTo("FT"); position = position.GetTi2ec() * position_el->FindElementTripletConvertTo("FT");
} else if (frame == "ecef") { } else if (frame == "ecef") {
if (!position_el->FindElement("x") && !position_el->FindElement("y") && !position_el->FindElement("z")) { 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")) if (position_el->FindElement("longitude"))
position.SetLongitude(position_el->FindElementValueAsNumberConvertTo("longitude", "RAD")); position.SetLongitude(position_el->FindElementValueAsNumberConvertTo("longitude", "RAD"));
@ -1048,19 +1064,6 @@ bool FGInitialCondition::Load_v2(Element* document)
result = false; 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 { } else {
position = position_el->FindElementTripletConvertTo("FT"); position = position_el->FindElementTripletConvertTo("FT");
} }

View file

@ -53,7 +53,7 @@ INCLUDES
DEFINITIONS 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 FORWARD DECLARATIONS
@ -233,7 +233,7 @@ class FGPropertyNode : public SGPropertyNode
* Assign a bool value to a property. If the property does not * 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 * 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; 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. * type.
* *
* @param name The property name. * @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 * 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 * 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; 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. * type.
* *
* @param name The property name. * @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 * 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 * 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; 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. * type.
* *
* @param name The property name. * @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 * 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 * 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; 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. * type.
* *
* @param name The property name. * @param name The property name.

View file

@ -30,9 +30,13 @@ INCLUDES
#include "FGRealValue.h" #include "FGRealValue.h"
#include "input_output/string_utilities.h"
using namespace std;
namespace JSBSim { 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); IDENT(IdHdr,ID_REALVALUE);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -50,4 +54,9 @@ double FGRealValue::GetValue(void) const
return Value; return Value;
} }
std::string FGRealValue::GetName(void) const
{
return std::string("constant value ") + to_string(Value);
}
} }

View file

@ -35,13 +35,12 @@ INCLUDES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#include "FGParameter.h" #include "FGParameter.h"
#include "input_output/string_utilities.h"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DEFINITIONS 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 FORWARD DECLARATIONS
@ -69,8 +68,7 @@ public:
~FGRealValue() {}; ~FGRealValue() {};
double GetValue(void) const; double GetValue(void) const;
std::string GetName(void) const std::string GetName(void) const;
{ return std::string("constant value ") + to_string(Value); }
private: private:
double Value; double Value;