summaryrefslogtreecommitdiff
path: root/misc/openlayers/tests/speed/geometry.html
diff options
context:
space:
mode:
authorChris Schlaeger <chris@linux.com>2014-08-12 21:56:44 +0200
committerChris Schlaeger <chris@linux.com>2014-08-12 21:56:44 +0200
commitea346a785dc1b3f7c156f6fc33da634e1f1a627b (patch)
treeaf67530553d20b6e82ad60fd79593e9c4abf5565 /misc/openlayers/tests/speed/geometry.html
parent59741cd535c47f25971bf8c32b25da25ceadc6d5 (diff)
downloadpostrunner-fb1989bda5d3e0a5472ba7644d57cae197733a8f.zip
Adding jquery, flot and openlayers to be included with the GEM.v0.0.4
Diffstat (limited to 'misc/openlayers/tests/speed/geometry.html')
-rw-r--r--misc/openlayers/tests/speed/geometry.html43
1 files changed, 43 insertions, 0 deletions
diff --git a/misc/openlayers/tests/speed/geometry.html b/misc/openlayers/tests/speed/geometry.html
new file mode 100644
index 0000000..bc2b488
--- /dev/null
+++ b/misc/openlayers/tests/speed/geometry.html
@@ -0,0 +1,43 @@
+<html>
+<script src="../../lib/OpenLayers.js"></script>
+<script>
+
+var test_data = {};
+
+function setup_test() {
+ if (test_data['polygon']) { return; }
+ var f = new OpenLayers.Format.WKT();
+ var list = f.read("POLYGON((-78.046875 5.9765625, -78.75 5.9765625, -79.453125 5.2734375, -79.453125 4.5703125, -80.15625 3.8671875, -80.15625 2.4609375, -80.15625 1.0546875, -80.15625 -1.0546875, -80.15625 -2.4609375, -80.15625 -3.8671875, -80.15625 -4.5703125, -80.15625 -5.2734375, -80.15625 -5.9765625, -80.15625 -6.6796875, -80.15625 -8.0859375, -80.15625 -8.7890625, -80.15625 -9.4921875, -80.15625 -10.8984375, -79.453125 -13.0078125, -78.046875 -13.7109375, -78.046875 -15.1171875, -76.640625 -15.1171875, -76.640625 -16.5234375, -75.9375 -16.5234375, -75.9375 -17.2265625, -75.234375 -17.9296875, -75.234375 -18.6328125, -74.53125 -19.3359375, -74.53125 -20.0390625, -74.53125 -20.7421875, -73.828125 -20.7421875, -73.828125 -22.8515625, -73.828125 -24.2578125, -72.421875 -25.6640625, -71.015625 -25.6640625, -71.015625 -26.3671875, -69.609375 -27.7734375, -69.609375 -28.4765625, -68.90625 -29.1796875, -68.203125 -29.8828125, -67.5 -30.5859375, -67.5 -31.9921875, -67.5 -32.6953125, -67.5 -33.3984375, -67.5 -34.8046875, -67.5 -36.9140625, -68.203125 -39.0234375, -68.203125 -39.7265625, -70.3125 -41.1328125, -71.015625 -41.8359375, -71.015625 -43.2421875, -71.015625 -43.9453125, -71.015625 -44.6484375, -71.71875 -48.8671875, -71.71875 -50.2734375, -71.71875 -50.9765625, -72.421875 -52.3828125, -72.421875 -53.0859375, -73.828125 -53.7890625, -73.828125 -55.1953125, -73.828125 -55.8984375, -73.828125 -56.6015625, -73.828125 -57.3046875, -73.828125 -58.0078125, -72.421875 -59.4140625, -71.71875 -60.1171875, -71.015625 -60.1171875, -70.3125 -60.1171875, -68.90625 -60.8203125, -68.203125 -60.8203125, -67.5 -60.8203125, -66.796875 -60.8203125, -66.796875 -59.4140625, -65.390625 -58.0078125, -65.390625 -57.3046875, -65.390625 -55.8984375, -65.390625 -55.1953125, -65.390625 -54.4921875, -65.390625 -53.7890625, -65.390625 -53.0859375, -64.6875 -52.3828125, -60.46875 -50.2734375, -57.65625 -48.8671875, -55.546875 -47.4609375, -54.84375 -47.4609375, -54.84375 -46.7578125, -54.140625 -46.7578125, -54.140625 -46.0546875, -54.140625 -45.3515625, -54.140625 -43.2421875, -54.140625 -41.1328125, -54.140625 -39.0234375, -53.4375 -37.6171875, -52.734375 -36.2109375, -51.328125 -36.2109375, -49.921875 -35.5078125, -48.515625 -34.8046875, -45 -33.3984375, -41.484375 -31.9921875, -35.15625 -28.4765625, -33.046875 -27.0703125, -33.046875 -24.9609375, -33.046875 -23.5546875, -33.046875 -22.1484375, -33.046875 -19.3359375, -32.34375 -13.0078125, -31.640625 -11.6015625, -31.640625 -10.8984375, -31.640625 -10.1953125, -31.640625 -8.0859375, -31.640625 -7.3828125, -31.640625 -5.9765625, -31.640625 -4.5703125, -31.640625 -2.4609375, -32.34375 -2.4609375, -34.453125 0.3515625, -37.265625 3.1640625, -41.484375 6.6796875, -45.703125 8.7890625, -53.4375 12.3046875, -55.546875 14.4140625, -56.953125 14.4140625, -59.0625 15.1171875, -61.875 13.7109375, -65.390625 13.0078125, -71.015625 12.3046875, -75.234375 11.6015625, -78.75 11.6015625, -80.859375 11.6015625, -81.5625 11.6015625, -81.5625 10.8984375, -81.5625 10.1953125, -81.5625 9.4921875, -81.5625 8.7890625, -80.15625 8.7890625, -80.15625 6.6796875, -80.15625 5.2734375, -80.15625 4.5703125, -80.15625 3.8671875, -79.453125 3.8671875, -78.046875 5.9765625))");
+ test_data['polygon'] = list.geometry;
+ var list = f.read("POLYGON((-125.15625 48.1640625, -125.859375 48.1640625, -125.859375 46.7578125, -125.15625 46.7578125, -124.453125 46.0546875, -123.75 46.0546875, -123.046875 46.0546875, -122.34375 46.0546875, -120.9375 46.0546875, -116.71875 46.7578125, -113.90625 46.7578125, -113.203125 46.7578125, -112.5 46.7578125, -111.796875 46.7578125, -111.09375 46.7578125, -110.390625 46.7578125, -109.6875 46.7578125, -106.875 46.7578125, -102.65625 46.7578125, -95.625 47.4609375, -91.40625 48.1640625, -87.890625 48.1640625, -87.1875 48.1640625, -86.484375 48.1640625, -85.78125 48.1640625, -84.375 48.1640625, -82.96875 48.1640625, -81.5625 48.1640625, -80.15625 48.1640625, -79.453125 47.4609375, -79.453125 46.7578125, -78.75 46.7578125, -78.75 45.3515625, -78.046875 45.3515625, -77.34375 45.3515625, -76.640625 45.3515625, -75.234375 45.3515625, -71.015625 46.7578125, -69.609375 47.4609375, -68.90625 47.4609375, -68.203125 48.1640625, -67.5 48.1640625, -66.09375 48.1640625, -65.390625 49.5703125, -63.984375 49.5703125, -63.28125 49.5703125, -62.578125 49.5703125, -61.875 48.8671875, -61.875 48.1640625, -61.875 46.7578125, -61.171875 46.0546875, -61.171875 43.2421875, -61.171875 41.8359375, -61.171875 40.4296875, -61.171875 39.7265625, -61.875 39.7265625, -62.578125 39.7265625, -63.28125 39.7265625, -63.984375 39.7265625, -66.796875 39.7265625, -67.5 39.7265625, -68.203125 39.7265625, -68.90625 39.7265625, -68.90625 39.0234375, -69.609375 38.3203125, -69.609375 36.9140625, -71.015625 34.8046875, -71.015625 32.6953125, -72.421875 31.2890625, -73.125 30.5859375, -73.828125 29.8828125, -74.53125 29.1796875, -75.234375 28.4765625, -76.640625 26.3671875, -76.640625 25.6640625, -76.640625 24.9609375, -77.34375 24.2578125, -77.34375 23.5546875, -78.046875 23.5546875, -79.453125 23.5546875, -80.15625 23.5546875, -80.859375 23.5546875, -81.5625 23.5546875, -82.265625 23.5546875, -82.96875 23.5546875, -83.671875 23.5546875, -83.671875 24.2578125, -85.078125 24.2578125, -85.78125 24.9609375, -85.78125 25.6640625, -86.484375 25.6640625, -87.1875 26.3671875, -87.1875 27.7734375, -87.1875 28.4765625, -87.890625 28.4765625, -88.59375 28.4765625, -89.296875 28.4765625, -90 28.4765625, -90.703125 28.4765625, -91.40625 28.4765625, -91.40625 27.7734375, -92.8125 27.7734375, -92.8125 27.0703125, -92.8125 26.3671875, -92.8125 25.6640625, -92.8125 24.9609375, -92.8125 24.2578125, -93.515625 24.2578125, -94.921875 23.5546875, -95.625 23.5546875, -97.03125 23.5546875, -97.734375 23.5546875, -98.4375 23.5546875, -99.140625 23.5546875, -99.84375 24.2578125, -101.25 24.2578125, -104.0625 24.9609375, -106.171875 25.6640625, -106.875 26.3671875, -107.578125 26.3671875, -108.28125 26.3671875, -108.984375 26.3671875, -110.390625 26.3671875, -113.90625 26.3671875, -116.015625 26.3671875, -116.71875 27.0703125, -118.125 27.0703125, -118.828125 27.7734375, -120.234375 27.7734375, -120.234375 28.4765625, -120.9375 28.4765625, -120.9375 29.1796875, -121.640625 29.8828125, -121.640625 30.5859375, -121.640625 31.2890625, -123.046875 31.2890625, -123.75 32.6953125, -124.453125 33.3984375, -125.15625 34.1015625, -126.5625 34.8046875, -127.265625 34.8046875, -127.96875 35.5078125, -125.15625 48.1640625))");
+ test_data['miss_polygon'] = list.geometry;
+ var list = f.read("POLYGON((-32.34375 13.0078125, -33.046875 13.0078125, -33.75 13.0078125, -34.453125 13.0078125, -35.15625 13.0078125, -35.859375 13.0078125, -36.5625 13.0078125, -37.265625 13.0078125, -37.96875 13.0078125, -37.96875 12.3046875, -38.671875 12.3046875, -39.375 12.3046875, -40.078125 12.3046875, -40.078125 11.6015625, -41.484375 11.6015625, -42.890625 10.8984375, -43.59375 10.8984375, -44.296875 10.1953125, -44.296875 9.4921875, -44.296875 8.7890625, -44.296875 8.0859375, -44.296875 6.6796875, -44.296875 5.9765625, -44.296875 5.2734375, -43.59375 5.2734375, -43.59375 4.5703125, -43.59375 3.8671875, -42.890625 3.1640625, -42.890625 2.4609375, -42.890625 1.7578125, -42.890625 1.0546875, -42.1875 -0.3515625, -41.484375 -1.0546875, -41.484375 -2.4609375, -41.484375 -3.1640625, -42.890625 -3.1640625, -44.296875 -3.8671875, -44.296875 -4.5703125, -45.703125 -5.2734375, -46.40625 -5.2734375, -47.109375 -5.2734375, -47.109375 -5.9765625, -47.109375 -6.6796875, -47.109375 -7.3828125, -47.109375 -8.0859375, -47.109375 -9.4921875, -47.109375 -10.1953125, -47.109375 -10.8984375, -47.109375 -11.6015625, -47.109375 -12.3046875, -47.109375 -13.7109375, -47.109375 -15.1171875, -47.109375 -15.8203125, -47.8125 -15.8203125, -47.8125 -16.5234375, -46.40625 -16.5234375, -45.703125 -16.5234375, -44.296875 -17.2265625, -43.59375 -17.9296875, -42.890625 -18.6328125, -42.1875 -18.6328125, -41.484375 -18.6328125, -40.78125 -18.6328125, -39.375 -18.6328125, -37.265625 -18.6328125, -35.859375 -18.6328125, -34.453125 -17.9296875, -33.75 -17.9296875, -33.046875 -17.9296875, -32.34375 -17.9296875, -32.34375 -18.6328125, -32.34375 -19.3359375, -32.34375 -20.0390625, -32.34375 -21.4453125, -31.640625 -22.1484375, -30.9375 -22.8515625, -28.828125 -22.8515625, -26.71875 -22.8515625, -23.90625 -20.0390625, -23.203125 -19.3359375, -22.5 -19.3359375, -21.796875 -17.2265625, -21.09375 -16.5234375, -21.09375 -15.8203125, -21.09375 -15.1171875, -21.09375 -14.4140625, -19.6875 -10.8984375, -19.6875 -8.0859375, -19.6875 -7.3828125, -19.6875 -5.9765625, -19.6875 -5.2734375, -19.6875 -3.1640625, -19.6875 -1.7578125, -19.6875 -0.3515625, -19.6875 0.3515625, -19.6875 1.0546875, -19.6875 1.7578125, -19.6875 2.4609375, -19.6875 3.1640625, -20.390625 4.5703125, -20.390625 5.9765625, -20.390625 6.6796875, -21.09375 6.6796875, -22.5 8.0859375, -23.90625 8.7890625, -25.3125 8.7890625, -26.015625 9.4921875, -26.71875 9.4921875, -27.421875 9.4921875, -28.125 9.4921875, -32.34375 13.0078125))");
+ test_data['hit_polygon'] = list.geometry;
+
+}
+
+function run_test() {
+ test_data['polygon'].intersects(test_data['hit_polygon']);
+ test_data['polygon'].intersects(test_data['miss_polygon']);
+}
+
+function run_many(x) {
+ var elapsed = 0;
+ for (var i = 0; i < x; i++) {
+ var time = new Date();
+ run_test();
+ elapsed += (new Date() - time);
+ }
+ return elapsed;
+}
+
+function print_results(x) {
+ var t = run_many(x);
+ document.getElementById("out").innerHTML += (t +"ms to run " + x + " times<br />");
+}
+ setup_test()
+</script>
+<body>
+<input type="submit" value="Run" onclick="print_results(5)" />
+<div id="out"></div>
+</body>