+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+//
+// This private class function checks to verify consistency in the choice of
+// aerodynamic axes used in the config file. One set of LIFT|DRAG|SIDE, or
+// X|Y|Z, or AXIAL|NORMAL|SIDE must be chosen; mixed system axes are not allowed.
+// Note that if the "SIDE" axis specifier is entered first in a config file,
+// a warning message will be given IF the AXIAL|NORMAL specifiers are also given.
+// This is OK, and the warning is due to the SIDE specifier used for both
+// the Lift/Drag and Axial/Normal axis systems.
+
+void FGAerodynamics::DetermineAxisSystem()
+{
+ Element* axis_element = document->FindElement("axis");
+ string axis;
+ while (axis_element) {
+ axis = axis_element->GetAttributeValue("name");
+ if (axis == "LIFT" || axis == "DRAG") {
+ if (axisType == atNone) axisType = atLiftDrag;
+ else if (axisType != atLiftDrag) {
+ cerr << endl << " Mixed aerodynamic axis systems have been used in the"
+ << " aircraft config file. (LIFT DRAG)" << endl;
+ }
+ } else if (axis == "SIDE") {
+ if (axisType != atNone && axisType != atLiftDrag && axisType != atAxialNormal) {
+ cerr << endl << " Mixed aerodynamic axis systems have been used in the"
+ << " aircraft config file. (SIDE)" << endl;
+ }
+ } else if (axis == "AXIAL" || axis == "NORMAL") {
+ if (axisType == atNone) axisType = atAxialNormal;
+ else if (axisType != atAxialNormal) {
+ cerr << endl << " Mixed aerodynamic axis systems have been used in the"
+ << " aircraft config file. (NORMAL AXIAL)" << endl;
+ }
+ } else if (axis == "X" || axis == "Y" || axis == "Z") {
+ if (axisType == atNone) axisType = atBodyXYZ;
+ else if (axisType != atBodyXYZ) {
+ cerr << endl << " Mixed aerodynamic axis systems have been used in the"
+ << " aircraft config file. (XYZ)" << endl;
+ }
+ } else if (axis != "ROLL" && axis != "PITCH" && axis != "YAW") { // error
+ cerr << endl << " An unknown axis type, " << axis << " has been specified"
+ << " in the aircraft configuration file." << endl;
+ exit(-1);
+ }
+ axis_element = document->FindNextElement("axis");
+ }
+ if (axisType == atNone) {
+ axisType = atLiftDrag;
+ cerr << endl << " The aerodynamic axis system has been set by default"
+ << " to the Lift/Side/Drag system." << endl;
+ }
+}
+