diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-04-22 14:02:03 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-04-22 14:02:03 (GMT) |
commit | 1fb6bcf30f954e426f2d3002d14887574fb941dd (patch) | |
tree | 08cff7f2b879c50efe79e3c04d255075522af862 /test/uscxml/scripts | |
parent | 71c334bf4e35559496feac3f3cf00b72ceb88812 (diff) | |
download | uscxml-1fb6bcf30f954e426f2d3002d14887574fb941dd.zip uscxml-1fb6bcf30f954e426f2d3002d14887574fb941dd.tar.gz uscxml-1fb6bcf30f954e426f2d3002d14887574fb941dd.tar.bz2 |
Major refactoring
- Moved tests
- Changes to promela datamodel
- Implemented Trie
Diffstat (limited to 'test/uscxml/scripts')
-rw-r--r-- | test/uscxml/scripts/GreatCircle.js | 46 | ||||
-rw-r--r-- | test/uscxml/scripts/test-simple-ecmascript.scxml | 12 |
2 files changed, 58 insertions, 0 deletions
diff --git a/test/uscxml/scripts/GreatCircle.js b/test/uscxml/scripts/GreatCircle.js new file mode 100644 index 0000000..7a866d9 --- /dev/null +++ b/test/uscxml/scripts/GreatCircle.js @@ -0,0 +1,46 @@ +// taken from http://trac.osgeo.org/openlayers/wiki/GreatCircleAlgorithms +var EARTH_RADIUS = 3958.75; +var PI = 3.1415926535897932384626433832795; +var DEG2RAD = 0.01745329252; +var RAD2DEG = 57.29577951308; + +function WGS84Distance(x1, y1, x2, y2) { + x1 = x1 * DEG2RAD; + y1 = y1 * DEG2RAD; + x2 = x2 * DEG2RAD; + y2 = y2 * DEG2RAD; + + var a = sin(( y2-y1 ) / 2.0 )^2; + var b = sin(( x2-x1 ) / 2.0 )^2; + var c = sqrt( a + cos( y2 ) * cos( y1 ) * b ); + + return 2 * asin( c ) * EARTH_RADIUS; +} + +function WGS84Bearing(x1, y1, x2, y2) { + x1 = x1 * DEG2RAD; + y1 = y1 * DEG2RAD; + x2 = x2 * DEG2RAD; + y2 = y2 * DEG2RAD; + + var a = cos(y2) * sin(x2 - x1); + var b = cos(y1) * sin(y2) - sin(y1) * cos(y2) * cos(x2 - x1); + var adjust = 0; + + if((a == 0) && (b == 0)) { + bearing = 0; + } else if( b == 0) { + if( a < 0) + bearing = 3 * PI / 2; + else + bearing = PI / 2; + } else if( b < 0) + adjust = PI; + else { + if( a < 0) + adjust = 2 * PI; + else + adjust = 0; + } + return (atan(a/b) + adjust) * RAD2DEG; +} diff --git a/test/uscxml/scripts/test-simple-ecmascript.scxml b/test/uscxml/scripts/test-simple-ecmascript.scxml new file mode 100644 index 0000000..10dee02 --- /dev/null +++ b/test/uscxml/scripts/test-simple-ecmascript.scxml @@ -0,0 +1,12 @@ +<scxml datamodel="ecmascript"> + <state id="start"> + <onentry> + <script> + var nodeSet = document.evaluate("//state").asNodeSet(); + nodeSet[0].setAttribute("foo", "bar"); + </script> + <raise event="redo" /> + </onentry> + <transition target="start" event="redo" /> + </state> +</scxml>
\ No newline at end of file |