Minor fixes from Cameron Moore.

This commit is contained in:
david 2002-01-30 15:09:56 +00:00
parent 9a4152eb2d
commit 2d1b2ca938
2 changed files with 59 additions and 22 deletions

View File

@ -45,9 +45,9 @@ if (argc == 8){
var = calc_magvar( SGD_DEGREES_TO_RADIANS * lat_deg, SGD_DEGREES_TO_RADIANS * lon_deg, h,
yymmdd_to_julian_days(yy,mm,dd), field );
fprintf(stdout,"%6.0lf %6.0lf %6.0lf\n", field[0], field[1], field[2] );
fprintf(stdout,"%6.0lf %6.0lf %6.0lf\n", field[3], field[4], field[5] );
fprintf(stdout,"%6.0lf %6.0lf %6.0lf %4.2lf %4.2lf \n",
fprintf(stdout,"%6.0f %6.0f %6.0f\n", field[0], field[1], field[2] );
fprintf(stdout,"%6.0f %6.0f %6.0f\n", field[3], field[4], field[5] );
fprintf(stdout,"%6.0f %6.0f %6.0f %4.2f %4.2f \n",
field[3],field[4],field[5],
SGD_RADIANS_TO_DEGREES * (atan(field[5]/pow(field[3]*field[3]+field[4]*field[4],0.5))),
SGD_RADIANS_TO_DEGREES * var);

View File

@ -450,9 +450,10 @@ SGPropertyNode::get_string () const
case STRING:
case UNSPECIFIED:
return GET_STRING;
case NONE:
default:
return "";
}
return ""; // if NONE
}
@ -676,9 +677,10 @@ SGPropertyNode::getBoolValue () const
case STRING:
case UNSPECIFIED:
return (GET_STRING == "true" || getDoubleValue() != 0.0L);
case NONE:
default:
return false;
}
return false; // if NONE
}
int
@ -702,9 +704,10 @@ SGPropertyNode::getIntValue () const
case STRING:
case UNSPECIFIED:
return atoi(GET_STRING.c_str());
case NONE:
default:
return 0;
}
return 0; // if NONE
}
long
@ -728,9 +731,10 @@ SGPropertyNode::getLongValue () const
case STRING:
case UNSPECIFIED:
return strtol(GET_STRING.c_str(), 0, 0);
case NONE:
default:
return 0L;
}
return 0L; // if NONE
}
float
@ -754,9 +758,10 @@ SGPropertyNode::getFloatValue () const
case STRING:
case UNSPECIFIED:
return atof(GET_STRING.c_str());
case NONE:
default:
return 0.0;
}
return 0.0; // if NONE
}
double
@ -780,9 +785,10 @@ SGPropertyNode::getDoubleValue () const
case STRING:
case UNSPECIFIED:
return strtod(GET_STRING.c_str(), 0);
case NONE:
default:
return 0.0L;
}
return 0.0L; // if NONE
}
string
@ -823,8 +829,12 @@ SGPropertyNode::setBoolValue (bool value)
result = SET_DOUBLE(double(value));
break;
case STRING:
case UNSPECIFIED:
result = SET_STRING(value ? "true" : "false");
break;
case NONE:
default:
break;
}
DO_TRACE_WRITE(BOOL);
@ -861,12 +871,16 @@ SGPropertyNode::setIntValue (int value)
case DOUBLE:
result = SET_DOUBLE(double(value));
break;
case STRING: {
case STRING:
case UNSPECIFIED: {
char buf[128];
sprintf(buf, "%d", value);
result = SET_STRING(buf);
break;
}
case NONE:
default:
break;
}
DO_TRACE_WRITE(INT);
@ -903,12 +917,16 @@ SGPropertyNode::setLongValue (long value)
case DOUBLE:
result = SET_DOUBLE(double(value));
break;
case STRING: {
case STRING:
case UNSPECIFIED: {
char buf[128];
sprintf(buf, "%d", value);
sprintf(buf, "%ld", value);
result = SET_STRING(buf);
break;
}
case NONE:
default:
break;
}
DO_TRACE_WRITE(LONG);
@ -945,12 +963,16 @@ SGPropertyNode::setFloatValue (float value)
case DOUBLE:
result = SET_DOUBLE(double(value));
break;
case STRING: {
case STRING:
case UNSPECIFIED: {
char buf[128];
sprintf(buf, "%f", value);
result = SET_STRING(buf);
break;
}
case NONE:
default:
break;
}
DO_TRACE_WRITE(FLOAT);
@ -987,12 +1009,16 @@ SGPropertyNode::setDoubleValue (double value)
case DOUBLE:
result = SET_DOUBLE(value);
break;
case STRING: {
case STRING:
case UNSPECIFIED: {
char buf[128];
sprintf(buf, "%lf", value);
sprintf(buf, "%f", value);
result = SET_STRING(buf);
break;
}
case NONE:
default:
break;
}
DO_TRACE_WRITE(DOUBLE);
@ -1030,8 +1056,12 @@ SGPropertyNode::setStringValue (string value)
result = SET_DOUBLE(strtod(value.c_str(), 0));
break;
case STRING:
case UNSPECIFIED:
result = SET_STRING(value);
break;
case NONE:
default:
break;
}
DO_TRACE_WRITE(STRING);
@ -1072,6 +1102,9 @@ SGPropertyNode::setUnspecifiedValue (string value)
case UNSPECIFIED:
result = SET_STRING(value);
break;
case NONE:
default:
break;
}
DO_TRACE_WRITE(UNSPECIFIED);
@ -1252,7 +1285,8 @@ SGPropertyNode::untie ()
SET_DOUBLE(val);
break;
}
case STRING: {
case STRING:
case UNSPECIFIED: {
string val = getStringValue();
clear_value();
_type = STRING;
@ -1260,6 +1294,9 @@ SGPropertyNode::untie ()
SET_STRING(val);
break;
}
case NONE:
default:
break;
}
_tied = false;