]> git.mxchange.org Git - flightgear.git/commitdiff
Re-sync JSBSim with FlightGear including James Turner's fix for the call to the funct...
authorbcoconni <bcoconni>
Tue, 18 Nov 2014 18:54:52 +0000 (19:54 +0100)
committerbcoconni <bcoconni>
Tue, 18 Nov 2014 18:54:52 +0000 (19:54 +0100)
src/FDM/JSBSim/initialization/FGInitialCondition.cpp
src/FDM/JSBSim/input_output/FGPropertyManager.h
src/FDM/JSBSim/math/FGRealValue.cpp
src/FDM/JSBSim/math/FGRealValue.h

index 9149caa1641c9e972e004a5044514fcc4a88994f..b9ad81e12c006d15542e2620752a4db09c94bd77 100644 (file)
@@ -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");
       }
index e3595941baa619785fa20b6143393a53e1ba6039..774904ce2286e4ce26b17e6fa256b670d0c7c0ca 100644 (file)
@@ -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.
index 54d185799837ff7d6d0f55147853f177c0e63023..47693f88744e296af3c68d8c355299ac49592803 100644 (file)
@@ -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);
+}
+  
 }
index 9e7eef8b376741ec98e26c33c6224c21b84eabfe..6f7483318c07d3719d48e603090e4f6a49e92752 100644 (file)
@@ -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;