1
0
Fork 0
<abs>true</abs>
for input elements.
If set to true, the input value is filtered thru fabs() function.
Defaults to false if absent, so there is no impact for existing configurations
This commit is contained in:
torsten 2009-05-18 20:27:57 +00:00 committed by Tim Moore
parent d9c3c6da96
commit ec0ed21b73
2 changed files with 7 additions and 1 deletions

View file

@ -74,6 +74,10 @@ void FGXMLAutoInput::parse( SGPropertyNode_ptr node, double aValue, double aOffs
min = new FGXMLAutoInput( n );
}
if( (n = node->getChild( "abs" )) != NULL ) {
abs = n->getBoolValue();
}
SGPropertyNode *valueNode = node->getChild( "value" );
if ( valueNode != NULL ) {
value = valueNode->getDoubleValue();
@ -144,7 +148,7 @@ double FGXMLAutoInput::get_value()
value = m;
}
return value;
return abs ? fabs(value) : value;
}
FGXMLAutoComponent::FGXMLAutoComponent( SGPropertyNode * node ) :

View file

@ -52,6 +52,7 @@ using std::deque;
class FGXMLAutoInput : public SGReferenced {
private:
double value; // The value as a constant or initializer for the property
bool abs; // return absolute value
SGPropertyNode_ptr property; // The name of the property containing the value
SGSharedPtr<FGXMLAutoInput> offset; // A fixed offset, defaults to zero
SGSharedPtr<FGXMLAutoInput> scale; // A constant scaling factor defaults to one
@ -63,6 +64,7 @@ public:
FGXMLAutoInput( SGPropertyNode_ptr node = NULL, double value = 0.0, double offset = 0.0, double scale = 1.0 ) :
property(NULL),
value(0.0),
abs(false),
offset(NULL),
scale(NULL),
min(NULL),