Hi,
I have just pushed a little patch to SimGear to implement feature
request #372 (http://code.google.com/p/flightgear-bugs/issues/detail?id=372)
This adds some fuzzy-logic to <condition> elements by introducing an
optional <precision> element. Without the <precision> element the
behavior is unchanged and existing conditions should evaluate as before.
The idea behind this is to make life easier for float/double comparisons.
Example:
<condition>
<equals>
<property>/more/or/less/pi</property>
<value type="double">3.14</value>
<precision type="double">0.001</precision>
</equals>
</condition>
evaluates to true if /more/or/less/pi is between 3.135 and 3.145 (both
inclusive).
The precision element works for int, long, float and double properties.
It has no meaning for bool properties as I could not think of any fuzzy
logic between true and false.
For string properties, the precision element dictates the length of the
strings to compare, so
<condition>
<equals>
<property>/type/of/navaid</property>
<value type="string">VOR</value>
<precision>3</precision>
</equals>
</condition>
evaluates to true if /type/of/navaid contains VOR, VOR/DME or VORTAC but
evaluates to false for VO, VAR etc.
Beware that the first element dictates the comparison type. If, in the
first example the type of /more/or/less/pi is string (or unspecified),
precision would be interpreted as an int resulting in a string compare
with length of zero (always true, I assume).
Please let me know what you think...
Torsten
------------------------------------------------------------------------------
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management
Up to 160% more powerful than alternatives and 25% more efficient.
Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
_______________________________________________
Flightgear-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/flightgear-devel