support
<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:
parent
d9c3c6da96
commit
ec0ed21b73
2 changed files with 7 additions and 1 deletions
|
@ -74,6 +74,10 @@ void FGXMLAutoInput::parse( SGPropertyNode_ptr node, double aValue, double aOffs
|
||||||
min = new FGXMLAutoInput( n );
|
min = new FGXMLAutoInput( n );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( (n = node->getChild( "abs" )) != NULL ) {
|
||||||
|
abs = n->getBoolValue();
|
||||||
|
}
|
||||||
|
|
||||||
SGPropertyNode *valueNode = node->getChild( "value" );
|
SGPropertyNode *valueNode = node->getChild( "value" );
|
||||||
if ( valueNode != NULL ) {
|
if ( valueNode != NULL ) {
|
||||||
value = valueNode->getDoubleValue();
|
value = valueNode->getDoubleValue();
|
||||||
|
@ -144,7 +148,7 @@ double FGXMLAutoInput::get_value()
|
||||||
value = m;
|
value = m;
|
||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
return abs ? fabs(value) : value;
|
||||||
}
|
}
|
||||||
|
|
||||||
FGXMLAutoComponent::FGXMLAutoComponent( SGPropertyNode * node ) :
|
FGXMLAutoComponent::FGXMLAutoComponent( SGPropertyNode * node ) :
|
||||||
|
|
|
@ -52,6 +52,7 @@ using std::deque;
|
||||||
class FGXMLAutoInput : public SGReferenced {
|
class FGXMLAutoInput : public SGReferenced {
|
||||||
private:
|
private:
|
||||||
double value; // The value as a constant or initializer for the property
|
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
|
SGPropertyNode_ptr property; // The name of the property containing the value
|
||||||
SGSharedPtr<FGXMLAutoInput> offset; // A fixed offset, defaults to zero
|
SGSharedPtr<FGXMLAutoInput> offset; // A fixed offset, defaults to zero
|
||||||
SGSharedPtr<FGXMLAutoInput> scale; // A constant scaling factor defaults to one
|
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 ) :
|
FGXMLAutoInput( SGPropertyNode_ptr node = NULL, double value = 0.0, double offset = 0.0, double scale = 1.0 ) :
|
||||||
property(NULL),
|
property(NULL),
|
||||||
value(0.0),
|
value(0.0),
|
||||||
|
abs(false),
|
||||||
offset(NULL),
|
offset(NULL),
|
||||||
scale(NULL),
|
scale(NULL),
|
||||||
min(NULL),
|
min(NULL),
|
||||||
|
|
Loading…
Reference in a new issue